[libvirt] [PATCH] qemu: check for active domain after agent interaction
by Eric Blake
Commit b606bbb41 reminded me that any time we drop locks to run
back-to-back guest interaction commands, we have to check that
the guest didn't disappear in between the two commands. A quick
audit found a couple of spots that were missing this check.
* src/qemu/qemu_driver.c (qemuDomainShutdownFlags)
(qemuDomainSetVcpusFlags): Check that domain is still up.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
I found this by inspection, and did not try to actually reproduce
if it would cause failures. I think a failure could be easier
to reproduce by temporarily sticking a strategic sleep() call just
prior to the qemuDomainObjExtAgent() call, and during the time
while libvirtd is sleeping, manually cause the guest to exit. But
we've definitely fixed issues like this before.
src/qemu/qemu_driver.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 02088cc..4ae76e5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1921,6 +1921,13 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
(ret < 0 && (acpiRequested || !flags))) {
qemuDomainSetFakeReboot(driver, vm, isReboot);
+ /* Even if agent failed, we have to check if guest went away
+ * by itself while our locks were down. */
+ if (useAgent && !virDomainObjIsActive(vm)) {
+ ret = 0;
+ goto endjob;
+ }
+
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorSystemPowerdown(priv->mon);
qemuDomainObjExitMonitor(driver, vm);
@@ -4360,6 +4367,12 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (ncpuinfo < 0)
goto endjob;
+ if (!virDomainObjIsActive(vm)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain is not running"));
+ goto endjob;
+ }
+
if (qemuAgentUpdateCPUInfo(nvcpus, cpuinfo, ncpuinfo) < 0)
goto endjob;
--
1.9.3
10 years, 4 months
[libvirt] [PATCH] Fix spacing around commas
by Michal Privoznik
On some places in the libvirt code we have:
f(a,z)
instead of
f(a, z)
This trivial patch fixes couple of such occurrences.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
HACKING | 2 +-
docs/hacking.html.in | 2 +-
examples/object-events/event-test.c | 2 +-
src/driver.h | 2 +-
src/internal.h | 26 +++++++++++++-------------
src/locking/lock_driver_lockd.c | 2 +-
src/locking/lock_driver_sanlock.c | 2 +-
src/lxc/lxc_conf.c | 2 +-
src/nwfilter/nwfilter_dhcpsnoop.c | 2 +-
src/qemu/qemu_conf.c | 2 +-
src/storage/parthelper.c | 2 +-
11 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/HACKING b/HACKING
index 4cf2906..88a4286 100644
--- a/HACKING
+++ b/HACKING
@@ -477,7 +477,7 @@ Use parenthesis when checking if a macro is defined, and use indentation to
track nesting:
#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
- # define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
+ # define fallocate(a, ignored, b, c) posix_fallocate(a, b, c)
#endif
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 6a92f46..bc76542 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -614,7 +614,7 @@
</p>
<pre>
#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
- # define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
+ # define fallocate(a, ignored, b, c) posix_fallocate(a, b, c)
#endif
</pre>
diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 2a5a83b..d6cfe46 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -10,7 +10,7 @@
#include <libvirt/virterror.h>
#define VIR_DEBUG(fmt) printf("%s:%d: " fmt "\n", __func__, __LINE__)
-#define STREQ(a,b) (strcmp(a,b) == 0)
+#define STREQ(a, b) (strcmp(a, b) == 0)
#ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__((__unused__))
diff --git a/src/driver.h b/src/driver.h
index 158df79..ba7c1fc 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -78,7 +78,7 @@ typedef enum {
* != 0 Feature is supported.
* 0 Feature is not supported.
*/
-# define VIR_DRV_SUPPORTS_FEATURE(drv,conn,feature) \
+# define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature) \
((drv)->connectSupportsFeature ? \
(drv)->connectSupportsFeature((conn), (feature)) > 0 : 0)
diff --git a/src/internal.h b/src/internal.h
index d355344..f6a88b2 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -78,16 +78,16 @@
# endif
/* String equality tests, suggested by Jim Meyering. */
-# define STREQ(a,b) (strcmp(a,b) == 0)
-# define STRCASEEQ(a,b) (c_strcasecmp(a,b) == 0)
-# define STRNEQ(a,b) (strcmp(a,b) != 0)
-# define STRCASENEQ(a,b) (c_strcasecmp(a,b) != 0)
-# define STREQLEN(a,b,n) (strncmp(a,b,n) == 0)
-# define STRCASEEQLEN(a,b,n) (c_strncasecmp(a,b,n) == 0)
-# define STRNEQLEN(a,b,n) (strncmp(a,b,n) != 0)
-# define STRCASENEQLEN(a,b,n) (c_strncasecmp(a,b,n) != 0)
-# define STRPREFIX(a,b) (strncmp(a,b,strlen(b)) == 0)
-# define STRSKIP(a,b) (STRPREFIX(a,b) ? (a) + strlen(b) : NULL)
+# define STREQ(a, b) (strcmp(a, b) == 0)
+# define STRCASEEQ(a, b) (c_strcasecmp(a, b) == 0)
+# define STRNEQ(a, b) (strcmp(a, b) != 0)
+# define STRCASENEQ(a, b) (c_strcasecmp(a, b) != 0)
+# define STREQLEN(a, b, n) (strncmp(a, b, n) == 0)
+# define STRCASEEQLEN(a, b, n) (c_strncasecmp(a, b, n) == 0)
+# define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0)
+# define STRCASENEQLEN(a, b, n) (c_strncasecmp(a, b, n) != 0)
+# define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0)
+# define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL)
# define STREQ_NULLABLE(a, b) \
((a) ? (b) && STREQ((a) ? (a) : "", (b) ? (b) : "") : !(b))
@@ -109,7 +109,7 @@
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# else
-# define __GNUC_PREREQ(maj,min) 0
+# define __GNUC_PREREQ(maj, min) 0
# endif
/* Work around broken limits.h on debian etch */
@@ -162,10 +162,10 @@
*/
# ifndef ATTRIBUTE_FMT_PRINTF
# if __GNUC_PREREQ (4, 4)
-# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) \
+# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \
__attribute__((__format__ (__gnu_printf__, fmtpos, argpos)))
# else
-# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) \
+# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \
__attribute__((__format__ (__printf__, fmtpos, argpos)))
# endif
# endif
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 367d0ce..0a40e94 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -99,7 +99,7 @@ static int virLockManagerLockDaemonLoadConfig(const char *configFile)
if (!(conf = virConfReadFile(configFile, 0)))
return -1;
-#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \
+#define CHECK_TYPE(name, typ) if (p && p->type != (typ)) { \
virReportError(VIR_ERR_INTERNAL_ERROR, \
"%s: %s: expected type " #typ, \
configFile, (name)); \
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index ea43051..aade437 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -118,7 +118,7 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
if (!(conf = virConfReadFile(configFile, 0)))
return -1;
-#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \
+#define CHECK_TYPE(name, typ) if (p && p->type != (typ)) { \
virReportError(VIR_ERR_INTERNAL_ERROR, \
"%s: %s: expected type " #typ, \
configFile, (name)); \
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index b5fd3cb..17df7a8 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -259,7 +259,7 @@ virLXCLoadDriverConfig(virLXCDriverConfigPtr cfg,
if (!conf)
goto done;
-#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \
+#define CHECK_TYPE(name, typ) if (p && p->type != (typ)) { \
virReportError(VIR_ERR_INTERNAL_ERROR, \
"%s: %s: expected type " #typ, \
filename, (name)); \
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index bfd0553..a2f58ba 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -1229,7 +1229,7 @@ virNWFilterSnoopRateLimit(virNWFilterSnoopRateLimitConfPtr rl)
{
time_t now = time(0);
int diff;
-# define IN_BURST(n,b) ((n)-(b) <= 1) /* bursts span 2 discrete seconds */
+# define IN_BURST(n, b) ((n)-(b) <= 1) /* bursts span 2 discrete seconds */
if (rl->prev != now && !IN_BURST(now, rl->burst)) {
rl->prev = now;
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 25e6d5e..e2ec54f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -347,7 +347,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
if (!(conf = virConfReadFile(filename, 0)))
goto cleanup;
-#define CHECK_TYPE(name,typ) \
+#define CHECK_TYPE(name, typ) \
if (p && p->type != (typ)) { \
virReportError(VIR_ERR_INTERNAL_ERROR, \
"%s: %s: expected type " #typ, \
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index c04f1bd..84e7ba0 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -48,7 +48,7 @@
#include "virstring.h"
/* we don't need to include the full internal.h just for this */
-#define STREQ(a,b) (strcmp(a,b) == 0)
+#define STREQ(a, b) (strcmp(a, b) == 0)
/* Make the comparisons below fail if your parted headers
are so old that they lack the definition. */
--
1.8.5.5
10 years, 4 months
[libvirt] [PATCH 0/3] Resolve some Coverity issues
by John Ferlan
Resolve some issues seen by my daily Coverity run.
Interesting that they didn't show up on the internal Jenkins Coverity
scanner, but did show up on my daily run. Perhaps because I have 7.0.3
and the Jenkins has 7.0.0... I also see 7.5.0 is available - I'll give
that a go too...
John Ferlan (3):
commandtest: Resolve Coverity RESOURCE_LEAK
virnetsocket: Resolve Coverity RESOURCE_LEAK
xenconfig: Resolve Coverity RESOURCE_LEAK
src/rpc/virnetsocket.c | 8 ++++++--
src/xenconfig/xen_common.c | 2 ++
tests/commandtest.c | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
--
1.9.3
10 years, 4 months
[libvirt] [PATCH 0/2] parallels: use parallels SDK instead of prlctl tool
by Dmitry Guryanov
This patchset begins reworking of parallels driver. We have
published Opensource version of parallels SDK (under LGPL license),
so libvirt can link with it.
Dmitry Guryanov (2):
parallels: build with parallels SDK
parallels: login to parallels SDK
configure.ac | 11 +++++-----
po/POTFILES.in | 1 +
src/Makefile.am | 8 +++++--
src/parallels/parallels_driver.c | 46 +++++++++++++++++++++++++++++++++++++++-
src/parallels/parallels_utils.h | 3 +++
5 files changed, 60 insertions(+), 9 deletions(-)
--
1.9.3
10 years, 4 months
[libvirt] [PATCH v2 0/3] Wrong allocation size displayed for NFS volumes
by John Ferlan
Changes over v1 - different tact as more research discovers that the
posix_fallocate() does not perform the correct pre-allocation of space
for an NFS backed file/disk, some details of the findings can be found:
http://www.redhat.com/archives/libvir-list/2014-August/msg00367.html
The first patch in this series will refactor the safezero to allow for
more fallback than the current code. Initially implemented as a series
of three 'safezero()' functions in commit id 'c29d0929' using build
conditionals to determine which of the 3 is being used.
The refactored code will have one function that will make a series of
calls rather the just failing on whatever is built into the system.
The first is a global virFileFdPosixFallocate() with the build conditional
controlling only whether the function runs or will just return -1. It
will also be re-used by the Volume Resize code in a future patch.
If on creation the virFileFdPosixFallocate() fails, attempts will be made
to then try the mmap() method (if it exists), and then fall back to the
slow, old, safewrite of zero filled buffers. The mmap function will follow
the format of the posix_fallocate insomuch as if HAVE_MMAP is defined,
then that will be attempted or a -1 will be returned immediately.
The major change of this patch over the prior code is the fallback. One
other minor change is if the virFileFdPosixFallocate() tries to call
posix_fallocate() and fails, then a VIR_WARN will be used to indicate
something went wrong. Previously, the code would return errno and eventually
that would filter back to a caller which would use the errno in a sys
error message. This I think only is odd when it comes to the resize path.
The second patch looks to resolve the first issue discovered by:
https://bugzilla.redhat.com/show_bug.cgi?id=1077068
It does this by checking the returned size/len of the file in the
posix_fallocate() call and if it does not match a VIR_WARN will be
posted and a failure returned allowing either the mmap or write of
zero filled buffers to the file.
The third patch changes the virStorageFileResize() logic to follow
the safezero() logic with respect to build conditionals. Also, rather
than reinvent the wheel, it will reuse the virFileFdPosixFallocate().
The new static API resizeSysFallocate() will return -1 if the build
conditionals are not met.
A current "downside" is by calling virFileFdPosixFallocate() twice
(once directly and the other indirectly through safezero), the
VIR_WARN will be displayed twice, but that should only affect someone
trying to debug things.
NOTE:
Investigation and testing while creating this series also showed it's
possible to modify the NFS Pool Start code to add a "-o wsize=4096" to
the MOUNT command in order to force smaller write's. While that did fix
the symptoms, the fix just didn't "feel right". The block size of the
"source" export was 4096 bytes, while the block size of the "target"
file was 1048576 bytes (current NFSv4 wsize default value when not
specified). Whether those play into what posix_fallocate() does I
am not sure, but if it does and that's fixed, then the way these
patches are coded up - it won't matter. Compared to perhaps needing
to revisit or document heavily how to set some new field in the pool
XML source - this just seems more right.
John Ferlan (3):
virfile: Refactor safezero, introduce virFileFdPosixFallocate
virfile: Check returned size from virFileFdPosixFallocate
virstoragefile: Refactor virStorageFileResize
src/libvirt_private.syms | 1 +
src/util/virfile.c | 58 ++++++++++++++++++++++++++++++++++++++---------
src/util/virfile.h | 2 ++
src/util/virstoragefile.c | 52 +++++++++++++++++++++++++++---------------
4 files changed, 84 insertions(+), 29 deletions(-)
--
1.9.3
10 years, 4 months
[libvirt] [PATCHv2] qemu: min_guarantee: Parameter 'min_guarantee' not supported
by Erik Skultety
The 'min_guarantee' is used by VMware ESX and OpenVZ drivers,
with qemu however, libvirt should report error when starting a domain,
because this element is not used.
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1122455
---
docs/formatdomain.html.in | 3 ++-
src/qemu/qemu_process.c | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index bd99ae0..eacf8db 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -713,7 +713,8 @@
<dt><code>min_guarantee</code></dt>
<dd> The optional <code>min_guarantee</code> element is the guaranteed
minimum memory allocation for the guest. The units for this value are
- kibibytes (i.e. blocks of 1024 bytes)</dd>
+ kibibytes (i.e. blocks of 1024 bytes). This element is only supported
+ by VMware ESX and OpenVZ drivers.</dd>
</dl>
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9e6a9ae..39cce7c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3993,6 +3993,13 @@ int qemuProcessStart(virConnectPtr conn,
flags & VIR_QEMU_PROCESS_START_COLD) < 0)
goto cleanup;
+ if (vm->def->mem.min_guarantee) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Parameter 'min_guarantee' "
+ "not supported by QEMU."));
+ goto cleanup;
+ }
+
if (VIR_ALLOC(priv->monConfig) < 0)
goto cleanup;
--
1.9.3
10 years, 4 months
[libvirt] [PATCHv3] numatune: setting --mode does not work well
by Erik Skultety
When trying to set numatune mode directly using virsh numatune command,
correct error is raised, however numatune structure was not deallocated,
thus resulting in creating an empty numatune element in the guest XML,
if none was present before. Running the same command aftewards results
in a successful change with broken XML structure. Patch fixes the
deallocation problem as well as checking for invalid attribute
combination VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO + a nonempty nodeset.
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1129998
---
src/conf/numatune_conf.c | 45 ++++++++++++++--------
...-numad-auto-vcpu-static-numatune-no-nodeset.xml | 31 +++++++++++++++
tests/qemuxml2argvtest.c | 1 +
3 files changed, 62 insertions(+), 15 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numad-auto-vcpu-static-numatune-no-nodeset.xml
diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c
index 48d1d04..ff0f3eb 100644
--- a/src/conf/numatune_conf.c
+++ b/src/conf/numatune_conf.c
@@ -437,14 +437,27 @@ virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
int mode,
virBitmapPtr nodeset)
{
- bool create = !*numatunePtr; /* Whether we are creating new struct */
+ bool created = false;
int ret = -1;
- virDomainNumatunePtr numatune = NULL;
+ virDomainNumatunePtr numatune;
/* No need to do anything in this case */
if (mode == -1 && placement == -1 && !nodeset)
return 0;
+ if (!(*numatunePtr)) {
+ if (VIR_ALLOC(*numatunePtr) < 0)
+ goto cleanup;
+
+ created = true;
+ if (mode == -1)
+ mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
+ if (placement == -1)
+ placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT;
+ }
+
+ numatune = *numatunePtr;
+
/* Range checks */
if (mode != -1 &&
(mode < 0 || mode >= VIR_DOMAIN_NUMATUNE_MEM_LAST)) {
@@ -453,6 +466,7 @@ virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
mode);
goto cleanup;
}
+
if (placement != -1 &&
(placement < 0 || placement >= VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -461,21 +475,9 @@ virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
goto cleanup;
}
- if (create && VIR_ALLOC(*numatunePtr) < 0)
- goto cleanup;
- numatune = *numatunePtr;
-
- if (create) {
- /* Defaults for new struct */
- if (mode == -1)
- mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
-
- if (placement == -1)
- placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT;
- }
-
if (mode != -1)
numatune->memory.mode = mode;
+
if (nodeset) {
virBitmapFree(numatune->memory.nodeset);
numatune->memory.nodeset = virBitmapNewCopy(nodeset);
@@ -500,13 +502,26 @@ virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
goto cleanup;
}
+ /* setting nodeset when placement auto is invalid */
+ if (placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO &&
+ numatune->memory.nodeset) {
+ virBitmapFree(numatune->memory.nodeset);
+ numatune->memory.nodeset = NULL;
+ }
+
if (placement != -1)
numatune->memory.placement = placement;
numatune->memory.specified = true;
ret = 0;
+
cleanup:
+ if (ret < 0 && created) {
+ virDomainNumatuneFree(*numatunePtr);
+ *numatunePtr = NULL;
+ }
+
return ret;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-vcpu-static-numatune-no-nodeset.xml b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-vcpu-static-numatune-no-nodeset.xml
new file mode 100644
index 0000000..b3cb5c5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-vcpu-static-numatune-no-nodeset.xml
@@ -0,0 +1,31 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='auto'>2</vcpu>
+ <numatune>
+ <memory mode='interleave' placement='static'/>
+ </numatune>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu>
+ <topology sockets='2' cores='1' threads='1'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 65dc9c7..b289d0e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1223,6 +1223,7 @@ mymain(void)
DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE);
DO_TEST("numad", NONE);
DO_TEST("numad-auto-vcpu-static-numatune", NONE);
+ DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE);
DO_TEST("numad-auto-memory-vcpu-cpuset", NONE);
DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE);
DO_TEST("numad-static-memory-auto-vcpu", NONE);
--
1.9.3
10 years, 4 months
[libvirt] [PATCH] iotune: setting an invalid value now reports error
by Erik Skultety
When trying to set an invalid value into iotune element, standard
behavior was to not report any error, rather to reset all affected
subelements of the iotune element back to 0 which results in ignoring
those particular subelements by XML generator. Patch further
examines the return code of the virXPathULongLong function
and in case of an invalid non-integer value raises an error.
Fixed to preserve consistency with invalid value checking
of other elements.
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1131811
---
src/conf/domain_conf.c | 55 +++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 43 insertions(+), 12 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9557020..592aa94 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5416,6 +5416,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
char *mirrorType = NULL;
int expected_secret_usage = -1;
int auth_secret_usage = -1;
+ int ret = 0;
if (!(def = virDomainDiskDefNew()))
return NULL;
@@ -5644,40 +5645,70 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
} else if (xmlStrEqual(cur->name, BAD_CAST "iotune")) {
- if (virXPathULongLong("string(./iotune/total_bytes_sec)",
+ ret = virXPathULongLong("string(./iotune/total_bytes_sec)",
ctxt,
- &def->blkdeviotune.total_bytes_sec) < 0) {
+ &def->blkdeviotune.total_bytes_sec);
+ if (ret < 0 && ret != -2) {
def->blkdeviotune.total_bytes_sec = 0;
+ } else if (ret == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("total throughput limit must be an integer"));
+ goto error;
}
- if (virXPathULongLong("string(./iotune/read_bytes_sec)",
+ ret = virXPathULongLong("string(./iotune/read_bytes_sec)",
ctxt,
- &def->blkdeviotune.read_bytes_sec) < 0) {
+ &def->blkdeviotune.read_bytes_sec);
+ if (ret < 0 && ret != -2) {
def->blkdeviotune.read_bytes_sec = 0;
+ } else if (ret == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("read throughput limit must be an integer"));
+ goto error;
}
- if (virXPathULongLong("string(./iotune/write_bytes_sec)",
+ ret = virXPathULongLong("string(./iotune/write_bytes_sec)",
ctxt,
- &def->blkdeviotune.write_bytes_sec) < 0) {
+ &def->blkdeviotune.write_bytes_sec);
+ if (ret < 0 && ret != -2) {
def->blkdeviotune.write_bytes_sec = 0;
+ } else if (ret == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("write throughput limit must be an integer"));
+ goto error;
}
- if (virXPathULongLong("string(./iotune/total_iops_sec)",
+ ret = virXPathULongLong("string(./iotune/total_iops_sec)",
ctxt,
- &def->blkdeviotune.total_iops_sec) < 0) {
+ &def->blkdeviotune.total_iops_sec);
+ if (ret < 0 && ret != -2) {
def->blkdeviotune.total_iops_sec = 0;
+ } else if (ret == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("total I/O operations limit must be an integer"));
+ goto error;
}
- if (virXPathULongLong("string(./iotune/read_iops_sec)",
+ ret = virXPathULongLong("string(./iotune/read_iops_sec)",
ctxt,
- &def->blkdeviotune.read_iops_sec) < 0) {
+ &def->blkdeviotune.read_iops_sec);
+ if (ret < 0 && ret != -2) {
def->blkdeviotune.read_iops_sec = 0;
+ } else if (ret == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("read I/O operations limit must be an integer"));
+ goto error;
}
- if (virXPathULongLong("string(./iotune/write_iops_sec)",
+ ret = virXPathULongLong("string(./iotune/write_iops_sec)",
ctxt,
- &def->blkdeviotune.write_iops_sec) < 0) {
+ &def->blkdeviotune.write_iops_sec);
+ if (ret < 0 && ret != -2) {
def->blkdeviotune.write_iops_sec = 0;
+ } else if (ret == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("write I/O operations limit must be an integer"));
+ goto error;
}
if ((def->blkdeviotune.total_bytes_sec &&
--
1.9.3
10 years, 4 months
[libvirt] [PATCH v2 0/5] Parallels: patchset
by Alexander Burluka
Another patchset for Parallels libvirt driver. This patchset includes
some minor bugfixing and adds some functions required to start OpenStack
Changes in v2: fixed wrong error codes in config error handling.
Alexander Burluka (5):
Parallels: add virNodeGetCPUMap().
Parallels: fix error with video card RAM dimension
Parallels: Change config report errors code.
Parallels: Add domainCreateWithFlags() function.
Parallels: add events emiting while creating domain.
src/parallels/parallels_driver.c | 155 ++++++++++++++++++++++++++++-----------
1 file changed, 113 insertions(+), 42 deletions(-)
--
1.9.1
10 years, 4 months
[libvirt] [PATCH v5 0/3] OVMF exposure
by Michal Privoznik
Diff to v4:
-rebased onto current master
-introduced nvram/@template as requested by Dan
-yet another Laszlo's review worked in
Michal Privoznik (3):
conf: Extend <loader/> and introduce <nvram/>
qemu: Implement extended loader and nvram
qemu: Automatically create NVRAM store
docs/formatdomain.html.in | 22 +++-
docs/schemas/domaincommon.rng | 28 +++++
libvirt.spec.in | 2 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 96 ++++++++++++++-
src/conf/domain_conf.h | 23 +++-
src/libvirt_private.syms | 3 +
src/qemu/libvirtd_qemu.aug | 3 +
src/qemu/qemu.conf | 14 +++
src/qemu/qemu_command.c | 97 ++++++++++++++-
src/qemu/qemu_conf.c | 94 ++++++++++++++
src/qemu/qemu_conf.h | 5 +
src/qemu/qemu_process.c | 137 +++++++++++++++++++++
src/qemu/test_libvirtd_qemu.aug.in | 3 +
src/security/security_dac.c | 8 ++
src/security/security_selinux.c | 8 ++
src/security/virt-aa-helper.c | 4 +-
src/vbox/vbox_common.c | 7 +-
src/xenapi/xenapi_driver.c | 3 +-
src/xenconfig/xen_common.c | 7 +-
src/xenconfig/xen_sxpr.c | 16 +--
tests/domainschemadata/domain-bios-nvram-empty.xml | 40 ++++++
.../qemuxml2argvdata/qemuxml2argv-bios-nvram.args | 10 ++
tests/qemuxml2argvdata/qemuxml2argv-bios-nvram.xml | 40 ++++++
tests/qemuxml2argvtest.c | 2 +
.../qemuxml2xmlout-pci-bridge-many-disks.xml | 2 +-
tests/qemuxml2xmltest.c | 2 +
tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-net-ioemu.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 2 +-
.../sexpr2xml-fv-serial-dev-2-ports.xml | 2 +-
.../sexpr2xml-fv-serial-dev-2nd-port.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 2 +-
.../sexpr2xml-fv-serial-tcp-telnet.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-sound.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-utc.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv-v2.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-fv.xml | 2 +-
tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 2 +-
tests/xmconfigdata/test-escape-paths.xml | 2 +-
tests/xmconfigdata/test-fullvirt-force-hpet.xml | 2 +-
tests/xmconfigdata/test-fullvirt-force-nohpet.xml | 2 +-
tests/xmconfigdata/test-fullvirt-localtime.xml | 2 +-
tests/xmconfigdata/test-fullvirt-net-ioemu.xml | 2 +-
tests/xmconfigdata/test-fullvirt-net-netfront.xml | 2 +-
tests/xmconfigdata/test-fullvirt-new-cdrom.xml | 2 +-
tests/xmconfigdata/test-fullvirt-old-cdrom.xml | 2 +-
tests/xmconfigdata/test-fullvirt-parallel-tcp.xml | 2 +-
.../test-fullvirt-serial-dev-2-ports.xml | 2 +-
.../test-fullvirt-serial-dev-2nd-port.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-file.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-null.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-pipe.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-pty.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-stdio.xml | 2 +-
.../test-fullvirt-serial-tcp-telnet.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-tcp.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-udp.xml | 2 +-
tests/xmconfigdata/test-fullvirt-serial-unix.xml | 2 +-
tests/xmconfigdata/test-fullvirt-sound.xml | 2 +-
tests/xmconfigdata/test-fullvirt-usbmouse.xml | 2 +-
tests/xmconfigdata/test-fullvirt-usbtablet.xml | 2 +-
tests/xmconfigdata/test-fullvirt-utc.xml | 2 +-
tests/xmconfigdata/test-no-source-cdrom.xml | 2 +-
tests/xmconfigdata/test-pci-devs.xml | 2 +-
82 files changed, 705 insertions(+), 82 deletions(-)
create mode 100644 tests/domainschemadata/domain-bios-nvram-empty.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bios-nvram.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bios-nvram.xml
--
1.8.5.5
10 years, 4 months