[libvirt] [PATCH] cpu-driver: Fix the cross driver function call
by Daniel Hansel
For Intel and PowerPC the implementation is calling a cpu driver
function across driver layers (i.e. from qemu driver directly to cpu
driver).
The correct behavior is to use libvirt API functionality to perform such
a inter-driver call.
This patch introduces a new cpu driver API function getModels() to
retrieve the cpu models. The currect implementation to process the
cpu_map XML content is transferred to the INTEL and PowerPC cpu driver
specific API functions.
Additionally processing the cpu_map XML file is not safe due to the fact
that the cpu map does not exist for all architectures. Therefore it is
better to encapsulate the processing in the architecture specific cpu
drivers.
Signed-off-by: Daniel Hansel <daniel.hansel(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/cpu/cpu.c | 68 +++++++++------------------------------------------
src/cpu/cpu.h | 4 +++
src/cpu/cpu_powerpc.c | 37 ++++++++++++++++++++++++++++
src/cpu/cpu_x86.c | 33 +++++++++++++++++++++++++
4 files changed, 86 insertions(+), 56 deletions(-)
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 08bec5e..788f688 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -724,43 +724,6 @@ cpuModelIsAllowed(const char *model,
return false;
}
-struct cpuGetModelsData
-{
- char **data;
- size_t len; /* It includes the last element of DATA, which is NULL. */
-};
-
-static int
-cpuGetArchModelsCb(cpuMapElement element,
- xmlXPathContextPtr ctxt,
- void *cbdata)
-{
- char *name;
- struct cpuGetModelsData *data = cbdata;
- if (element != CPU_MAP_ELEMENT_MODEL)
- return 0;
-
- name = virXPathString("string(@name)", ctxt);
- if (name == NULL)
- return -1;
-
- if (!data->data) {
- VIR_FREE(name);
- data->len++;
- return 0;
- }
-
- return VIR_INSERT_ELEMENT(data->data, data->len - 1, data->len, name);
-}
-
-
-static int
-cpuGetArchModels(const char *arch, struct cpuGetModelsData *data)
-{
- return cpuMapLoad(arch, cpuGetArchModelsCb, data);
-}
-
-
/**
* cpuGetModels:
*
@@ -774,18 +737,17 @@ cpuGetArchModels(const char *arch, struct cpuGetModelsData *data)
int
cpuGetModels(const char *archName, char ***models)
{
- struct cpuGetModelsData data;
- virArch arch;
struct cpuArchDriver *driver;
- data.data = NULL;
- data.len = 1;
+ virArch arch;
+
+ VIR_DEBUG("arch=%s", archName);
arch = virArchFromString(archName);
if (arch == VIR_ARCH_NONE) {
virReportError(VIR_ERR_INVALID_ARG,
_("cannot find architecture %s"),
archName);
- goto error;
+ return -1;
}
driver = cpuGetSubDriver(arch);
@@ -793,21 +755,15 @@ cpuGetModels(const char *archName, char ***models)
virReportError(VIR_ERR_INVALID_ARG,
_("cannot find a driver for the architecture %s"),
archName);
- goto error;
+ return -1;
}
- if (models && VIR_ALLOC_N(data.data, data.len) < 0)
- goto error;
-
- if (cpuGetArchModels(driver->name, &data) < 0)
- goto error;
-
- if (models)
- *models = data.data;
-
- return data.len - 1;
+ if (!driver->getModels) {
+ virReportError(VIR_ERR_NO_SUPPORT,
+ _("CPU driver for %s has no CPU model support"),
+ virArchToString(arch));
+ return -1;
+ }
- error:
- virStringFreeList(data.data);
- return -1;
+ return driver->getModels(models);
}
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 339964c..09e9538 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -100,6 +100,9 @@ typedef char *
typedef virCPUDataPtr
(*cpuArchDataParse) (const char *xmlStr);
+typedef int
+(*cpuArchGetModels) (char ***models);
+
struct cpuArchDriver {
const char *name;
const virArch *arch;
@@ -115,6 +118,7 @@ struct cpuArchDriver {
cpuArchHasFeature hasFeature;
cpuArchDataFormat dataFormat;
cpuArchDataParse dataParse;
+ cpuArchGetModels getModels;
};
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 67cb9ff..155d93e 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -649,6 +649,42 @@ ppcBaseline(virCPUDefPtr *cpus,
goto cleanup;
}
+static int
+ppcGetModels(char ***models)
+{
+ struct ppc_map *map;
+ struct ppc_model *model;
+ char *name;
+ size_t nmodels = 0;
+
+ if (!(map = ppcLoadMap()))
+ goto error;
+
+ if (models && VIR_ALLOC_N(*models, 0) < 0)
+ goto error;
+
+ model = map->models;
+ while (model != NULL) {
+ if (VIR_STRDUP(name, model->name) < 0)
+ goto error;
+
+ if (VIR_INSERT_ELEMENT(*models, 0, nmodels, name) < 0)
+ goto error;
+
+ model = model->next;
+ }
+
+ cleanup:
+ ppcMapFree(map);
+
+ return nmodels;
+
+ error:
+ virStringFreeList(*models);
+ nmodels = -1;
+ goto cleanup;
+}
+
struct cpuArchDriver cpuDriverPowerPC = {
.name = "ppc64",
.arch = archs,
@@ -662,4 +698,5 @@ struct cpuArchDriver cpuDriverPowerPC = {
.baseline = ppcBaseline,
.update = ppcUpdate,
.hasFeature = NULL,
+ .getModels = ppcGetModels,
};
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 026b54e..f6dcba4 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2160,6 +2160,38 @@ x86HasFeature(const virCPUData *data,
return ret;
}
+static int
+x86GetModels(char ***models)
+{
+ const struct x86_map *map;
+ struct x86_model *model;
+ char *name;
+ size_t nmodels = 0;
+
+ if (!(map = virCPUx86GetMap()))
+ return -1;
+
+ if (models && VIR_ALLOC_N(*models, 0) < 0)
+ goto error;
+
+ model = map->models;
+ while (model != NULL) {
+ if (VIR_STRDUP(name, model->name) < 0)
+ goto error;
+
+ if (VIR_INSERT_ELEMENT(*models, 0, nmodels, name) < 0)
+ goto error;
+
+ model = model->next;
+ }
+
+ return nmodels;
+
+ error:
+ virStringFreeList(*models);
+ return -1;
+}
+
struct cpuArchDriver cpuDriverX86 = {
.name = "x86",
@@ -2180,4 +2212,5 @@ struct cpuArchDriver cpuDriverX86 = {
.hasFeature = x86HasFeature,
.dataFormat = x86CPUDataFormat,
.dataParse = x86CPUDataParse,
+ .getModels = x86GetModels,
};
--
1.8.5.5
9 years, 11 months
[libvirt] [PATCH] qemu: Fix virsh freeze when blockcopy storage file is removed
by Erik Skultety
If someone removes blockcopy storage file when still in mirroring phase
and then requesting blockjob abort using pivot, virsh cmd freezes. This
is not an issue with older qemu versions which did not support
asynchronous jobs (which we prefer by default).
As we have reached the mirroring phase successfully, polling monitor for
blockjob info always returns 1 and the loop never ends.
This fix introduces a check for qemuDomainBlockPivot return code, possibly
skipping the asynchronous waiting completely, if an error occured and
asynchronous waiting was the preferred method.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1139567
---
src/qemu/qemu_driver.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5dc62b0..2e11938 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15606,6 +15606,8 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
if (disk->mirror && (flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT)) {
ret = qemuDomainBlockPivot(conn, driver, vm, device, disk);
+ if (ret < 0 && async)
+ goto endjob;
goto waitjob;
}
if (disk->mirror) {
--
1.9.3
9 years, 11 months
[libvirt] [PATCH] qemu: output error when try to hotplug unsupport console
by Luyao Huang
https://bugzilla.redhat.com/show_bug.cgi?id=1164627
When try to use attach-device to hotplug a qemu
unsupport sonsole, command will return success,
and add a console in vm's xml.But this doesn't work
in qemu, qemu doesn't support these console.Add
a error output when try to hotplug a unsupport console
in qemuBuildConsoleChrDeviceStr.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/qemu/qemu_command.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1399ce4..2bf4a83 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10069,13 +10069,17 @@ qemuBuildConsoleChrDeviceStr(char **deviceStr,
break;
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL:
+ break;
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE:
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML:
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC:
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ:
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST:
- break;
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported console target type %s"),
+ NULLSTR(virDomainChrConsoleTargetTypeToString(chr->targetType)));
+ return ret;
}
ret = 0;
--
1.8.3.1
9 years, 11 months
[libvirt] [PATCH] network: Let domains be restricted to local DNS
by Josh Stone
This adds a new "localOnly" attribute on the domain element of the
network xml. With this set to "yes", DNS requests under that domain
will only be resolved by libvirt's dnsmasq, never forwarded upstream.
This was how it worked before commit f69a6b987d616, and I found that
functionality useful. For example, I have my host's NetworkManager
dnsmasq configured to forward that domain to libvirt's dnsmasq, so I can
easily resolve guest names from outside. But if libvirt's dnsmasq
doesn't know a name and forwards it to the host, I'd get an endless
forwarding loop. Now I can set localOnly="yes" to prevent the loop.
Signed-off-by: Josh Stone <jistone(a)redhat.com>
Cc: Laine Stump <laine(a)laine.org>
---
docs/formatnetwork.html.in | 12 +++++++++++-
docs/schemas/network.rng | 3 +++
src/conf/network_conf.c | 5 +++++
src/conf/network_conf.h | 1 +
src/network/bridge_driver.c | 5 +++++
.../networkxml2confdata/nat-network-dns-local-domain.conf | 14 ++++++++++++++
tests/networkxml2confdata/nat-network-dns-local-domain.xml | 9 +++++++++
tests/networkxml2conftest.c | 1 +
8 files changed, 49 insertions(+), 1 deletion(-)
create mode 100644 tests/networkxml2confdata/nat-network-dns-local-domain.conf
create mode 100644 tests/networkxml2confdata/nat-network-dns-local-domain.xml
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index dc438aee8622..defcdba00930 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -82,7 +82,7 @@
<pre>
...
<bridge name="virbr0" stp="on" delay="5"/>
- <domain name="example.com"/>
+ <domain name="example.com" localOnly="no"/>
<forward mode="nat" dev="eth0"/>
...</pre>
@@ -113,6 +113,16 @@
a <code><forward></code> mode of "nat" or "route" (or an
isolated network with no <code><forward></code>
element). <span class="since">Since 0.4.5</span>
+
+ <p>
+ If the optional <code>localOnly</code> attribute on the
+ <code>domain</code> element is "yes", then DNS requests under
+ this domain will only be resolved by the virtual network's own
+ DNS server - they will not be forwarded to the host's upstream
+ DNS server. If <code>localOnly</code> is "no", and by
+ default, unresolved requests <b>will</b> be forwarded.
+ <span class="since">Since 1.2.11</span>
+ </p>
</dd>
<dt><code>forward</code></dt>
<dd>Inclusion of the <code>forward</code> element indicates that
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 4546f8037580..a1da28092375 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -225,6 +225,9 @@
<optional>
<element name="domain">
<attribute name="name"><ref name="dnsName"/></attribute>
+ <optional>
+ <attribute name="localOnly"><ref name="virYesNo"/></attribute>
+ </optional>
</element>
</optional>
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 067334e87cb0..61451c39805f 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2083,6 +2083,11 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
/* Parse network domain information */
def->domain = virXPathString("string(./domain[1]/@name)", ctxt);
+ tmp = virXPathString("string(./domain[1]/@localOnly)", ctxt);
+ if (tmp) {
+ def->domain_local = STRCASEEQ(tmp, "yes");
+ VIR_FREE(tmp);
+ }
if ((bandwidthNode = virXPathNode("./bandwidth", ctxt)) != NULL &&
(def->bandwidth = virNetDevBandwidthParse(bandwidthNode, -1)) == NULL)
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 660cd2d10cd1..6308a7dcfbf7 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -232,6 +232,7 @@ struct _virNetworkDef {
char *bridge; /* Name of bridge device */
char *domain;
+ bool domain_local; /* Choose not to forward dns for this domain */
unsigned long delay; /* Bridge forward delay (ms) */
bool stp; /* Spanning tree protocol */
virMacAddr mac; /* mac address of bridge device */
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 6cb421c52850..dfa375d3aa72 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -912,6 +912,11 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
}
if (network->def->domain) {
+ if (network->def->domain_local) {
+ virBufferAsprintf(&configbuf,
+ "local=/%s/\n",
+ network->def->domain);
+ }
virBufferAsprintf(&configbuf,
"domain=%s\n"
"expand-hosts\n",
diff --git a/tests/networkxml2confdata/nat-network-dns-local-domain.conf b/tests/networkxml2confdata/nat-network-dns-local-domain.conf
new file mode 100644
index 000000000000..5f41b9186cbc
--- /dev/null
+++ b/tests/networkxml2confdata/nat-network-dns-local-domain.conf
@@ -0,0 +1,14 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+local=/example.com/
+domain=example.com
+expand-hosts
+except-interface=lo
+bind-dynamic
+interface=virbr0
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/nat-network-dns-local-domain.xml b/tests/networkxml2confdata/nat-network-dns-local-domain.xml
new file mode 100644
index 000000000000..a92d71f1f2f6
--- /dev/null
+++ b/tests/networkxml2confdata/nat-network-dns-local-domain.xml
@@ -0,0 +1,9 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
+ <forward dev='eth0' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <domain name='example.com' localOnly='yes'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ </ip>
+</network>
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 4f1d9345ffe4..d2aa8c62cfcd 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -146,6 +146,7 @@ mymain(void)
DO_TEST("nat-network-dns-hosts", full);
DO_TEST("nat-network-dns-forward-plain", full);
DO_TEST("nat-network-dns-forwarders", full);
+ DO_TEST("nat-network-dns-local-domain", full);
DO_TEST("dhcp6-network", dhcpv6);
DO_TEST("dhcp6-nat-network", dhcpv6);
DO_TEST("dhcp6host-routed-network", dhcpv6);
--
2.1.0
9 years, 11 months
[libvirt] [PATCH] docs: More html/docs changes from libvirt.h.in split
by John Ferlan
This changes the display from:
libvirt-storage: APIs for management of storages
to
libvirt-storage: APIs for management of storage pools and volumes
In making that change I expected my build tree html output to be
regenerated; however, it wasn't because the dependency for the separated
libvirt-storage.h wasn't there. It was only present for libvirt.h.in
So I added each in the order displayed on the docs/html/index.html page
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
docs/Makefile.am | 11 +++++++++++
include/libvirt/libvirt-storage.h | 4 ++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index bb52c35..d624827 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -291,6 +291,17 @@ $(python_generated_files): $(APIBUILD_STAMP)
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
$(srcdir)/../include/libvirt/libvirt.h.in \
+ $(srcdir)/../include/libvirt/libvirt-domain-snapshot.h \
+ $(srcdir)/../include/libvirt/libvirt-domain.h \
+ $(srcdir)/../include/libvirt/libvirt-event.h \
+ $(srcdir)/../include/libvirt/libvirt-host.h \
+ $(srcdir)/../include/libvirt/libvirt-interface.h \
+ $(srcdir)/../include/libvirt/libvirt-network.h \
+ $(srcdir)/../include/libvirt/libvirt-nodedev.h \
+ $(srcdir)/../include/libvirt/libvirt-nwfilter.h \
+ $(srcdir)/../include/libvirt/libvirt-secret.h \
+ $(srcdir)/../include/libvirt/libvirt-storage.h \
+ $(srcdir)/../include/libvirt/libvirt-stream.h \
$(srcdir)/../include/libvirt/libvirt-lxc.h \
$(srcdir)/../include/libvirt/libvirt-qemu.h \
$(srcdir)/../include/libvirt/virterror.h \
diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h
index 7b2a72d..1f3087b 100644
--- a/include/libvirt/libvirt-storage.h
+++ b/include/libvirt/libvirt-storage.h
@@ -1,7 +1,7 @@
/*
* libvirt-storage.h
- * Summary: APIs for management of storages
- * Description: Provides APIs for the management of storages
+ * Summary: APIs for management of storage pools and volumes
+ * Description: Provides APIs for the management of storage pools and volumes
* Author: Daniel Veillard <veillard(a)redhat.com>
*
* Copyright (C) 2006-2014 Red Hat, Inc.
--
1.9.3
9 years, 11 months
[libvirt] how to pin disk order when adding SATA disk with virt-manager ?
by Jason Vas Dias
Hi - this is my first post to this list - sorry if this is a newbie
question, but:
I want to mount 7 LVM disk volumes under my guest :
Physical Host Volume: Guest Device: Guest FS:
/dev/mapper/VG_A-vol1 : /dev/sda : /root file system
/dev/mapper/VG_S-swap2 : swap : swap partition
/dev/mapper/VG_C-vol3 : /dev/sdc : /home file system
/dev/mapper/VG_G-vol7 : /dev/sdg : /x some necessary other storage
I am booting with the "Direct Boot" option and kernel command line
containing "root=/dev/sda" - ie. there HAS to be some particular /dev/sdX
where X is the virtual order of the disks on the virtual SATA bus / device
minor number to letter mapping .
Every time I add a new volume via the virt-manager the ordering of ALL
disks change , and I must manually discover which drive letter
('a-g' in /dev/sd[a-g]) maps to which disk , even though the ordering as
shown in the GUI remains the same - ie. when I click on the 'SATA Disk 1'
icon in the virt-manager 'Details...' tab, it still shows the correct LVM
is associated with Disk 1, but the system does not boot because what
was '/dev/sda' is now '/dev/sdb' .
Is this a bug ? Can I request a "New Feature" which would allow me
to specify the "Bus Sequence Number" in the Virtual Disk panel
(where I currently can specify Source Path, Disk Bus, Advanced Options etc...
) - surely you could let users map disks to devices in a way that does not
change with each new disk added ?
Anyway, that's my 2 cents on $subject .
Any thoughts / suggestions gratefully received .
Thanks & Regards ,
Jason
9 years, 11 months
[libvirt] [PATCH] cpu: fix possible crash in getModels
by Pavel Hrdina
Commit 86a15a25 introduced a new cpu driver API 'getModels'. Public API
allow you to pass NULL for models to get only number of existing models.
However the new code will crash with segfault so we have to count with
the possibility that the user wants only the number.
There is also difference in order of the models gathered by this new API
as the old approach was inserting the elements to the end of the array
so we should use 'VIR_APPEND_ELEMENT'.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/cpu/cpu_powerpc.c | 15 ++++++++++-----
src/cpu/cpu_x86.c | 15 ++++++++++-----
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 871401b..86f80b3 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -666,11 +666,15 @@ ppcGetModels(char ***models)
model = map->models;
while (model != NULL) {
- if (VIR_STRDUP(name, model->name) < 0)
- goto error;
+ if (models) {
+ if (VIR_STRDUP(name, model->name) < 0)
+ goto error;
- if (VIR_INSERT_ELEMENT(*models, 0, nmodels, name) < 0)
- goto error;
+ if (VIR_APPEND_ELEMENT(*models, nmodels, name) < 0)
+ goto error;
+ } else {
+ nmodels++;
+ }
model = model->next;
}
@@ -681,7 +685,8 @@ ppcGetModels(char ***models)
return nmodels;
error:
- virStringFreeList(*models);
+ if (models)
+ virStringFreeList(*models);
nmodels = -1;
goto cleanup;
}
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index f6dcba4..dfbc16c 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2176,11 +2176,15 @@ x86GetModels(char ***models)
model = map->models;
while (model != NULL) {
- if (VIR_STRDUP(name, model->name) < 0)
- goto error;
+ if (models) {
+ if (VIR_STRDUP(name, model->name) < 0)
+ goto error;
- if (VIR_INSERT_ELEMENT(*models, 0, nmodels, name) < 0)
- goto error;
+ if (VIR_APPEND_ELEMENT(*models, nmodels, name) < 0)
+ goto error;
+ } else {
+ nmodels++;
+ }
model = model->next;
}
@@ -2188,7 +2192,8 @@ x86GetModels(char ***models)
return nmodels;
error:
- virStringFreeList(*models);
+ if (models)
+ virStringFreeList(*models);
return -1;
}
--
2.0.4
9 years, 11 months
[libvirt] [PATCH 0/2] qemu: Refactor reconnecting after daemon restart
by Peter Krempa
Peter Krempa (2):
qemu: driver: Reload snapshots and managedsaves prior to reconnecting
qemu: process: Refactor reconnecting to qemu processes
src/qemu/qemu_driver.c | 4 +-
src/qemu/qemu_process.c | 167 ++++++++++++++++++++++--------------------------
2 files changed, 78 insertions(+), 93 deletions(-)
--
2.1.0
9 years, 11 months
[libvirt] [PATCH 0/2] leaseshelper: Coverity/whitespace fixes
by Peter Krempa
Peter Krempa (2):
leaseshelper: Skip entries missing expiry time on INIT action
leaseshelper: Fix incorrect alignment of a switch case
src/network/leaseshelper.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
--
2.1.0
9 years, 11 months
[libvirt] [PATCH] tests: Fix misplaced parenthesis in qemumonitorjsontest
by Martin Kletzander
When trying clang, it found out that we were comparing sizeof with 0
even though we wanted to check the return value of memcmp.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
tests/qemumonitorjsontest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 5bfcd20..d3ae29a 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1879,7 +1879,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *data)
"drive-virtio-disk0", &info, false) < 0)
goto cleanup;
- if (memcmp(&info, &expectedInfo, sizeof(info) != 0)) {
+ if (memcmp(&info, &expectedInfo, sizeof(info)) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Invalid @info");
goto cleanup;
--
2.1.3
9 years, 11 months