[libvirt] [PATCH] Add test for transient disk support in VMX files
by Wout Mertens
From: Wout Mertens <Wout.Mertens(a)gmail.com>
Adds test for transient disk translation in vmx files
---
tests/vmx2xmldata/vmx2xml-harddisk-transient.vmx | 6 +++++
tests/vmx2xmldata/vmx2xml-harddisk-transient.xml | 25 ++++++++++++++++++++++
tests/vmx2xmltest.c | 1 +
3 files changed, 32 insertions(+), 0 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-harddisk-transient.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-harddisk-transient.xml
diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-transient.vmx b/tests/vmx2xmldata/vmx2xml-harddisk-transient.vmx
new file mode 100644
index 0000000..68ef382
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-harddisk-transient.vmx
@@ -0,0 +1,6 @@
+config.version = "8"
+virtualHW.version = "4"
+ide0:0.present = "true"
+ide0:0.deviceType = "ata-hardDisk"
+ide0:0.fileName = "harddisk.vmdk"
+ide0:0.mode = "independent-nonpersistent"
diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-transient.xml b/tests/vmx2xmldata/vmx2xml-harddisk-transient.xml
new file mode 100644
index 0000000..3786e2f
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-harddisk-transient.xml
@@ -0,0 +1,25 @@
+<domain type='vmware'>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory unit='KiB'>32768</memory>
+ <currentMemory unit='KiB'>32768</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='[datastore] directory/harddisk.vmdk'/>
+ <target dev='hda' bus='ide'/>
+ <transient/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 13515f0..70178f7 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -221,6 +221,7 @@ mymain(void)
DO_TEST("harddisk-scsi-file", "harddisk-scsi-file");
DO_TEST("harddisk-ide-file", "harddisk-ide-file");
+ DO_TEST("harddisk-transient", "harddisk-transient");
DO_TEST("cdrom-scsi-file", "cdrom-scsi-file");
DO_TEST("cdrom-scsi-device", "cdrom-scsi-device");
--
1.7.1
10 years, 10 months
[libvirt] can't build python bindings on FreeBSD
by Jason Helfman
Any ideas?
Clang: FreeBSD clang version 3.1
creating build/temp.freebsd-9.1-RELEASE-p4-i386-2.7
creating build/temp.freebsd-9.1-RELEASE-p4-i386-2.7/build
clang -DNDEBUG -O2 -pipe -fno-strict-aliasing -O2 -pipe
-fno-strict-aliasing -fPIC -I. -I/usr/local/include/python2.7 -c
libvirt-override.c -o
build/temp.freebsd-9.1-RELEASE-p4-i386-2.7/libvirt-override.o
-I/usr/local/include
In file included from libvirt-override.c:26:
./libvirt-utils.h:87:22: error: token is not a valid binary operator in a
preprocessor subexpression
# if __GNUC_PREREQ (3, 3)
~~~~~~~~~~~~~ ^
./libvirt-utils.h:99:22: error: token is not a valid binary operator in a
preprocessor subexpression
# if __GNUC_PREREQ (3, 4)
~~~~~~~~~~~~~ ^
2 errors generated.
error: command 'clang' failed with exit status 1
*** [do-build] Error code 1
Stop in /usr/home/jgh/workspace/ports/devel/py-libvirt.
Gcc: gcc (GCC) 4.2.1 20070831
gcc -DNDEBUG -O2 -pipe -fno-strict-aliasing -O2 -pipe -fno-strict-aliasing
-fPIC -I. -I/usr/local/include/python2.7 -c libvirt-override.c -o
build/temp.freebsd-9.1-RELEASE-p4-i386-2.7/libvirt-override.o
-I/usr/local/include
In file included from libvirt-override.c:26:
libvirt-utils.h:87:22: error: missing binary operator before token "("
libvirt-utils.h:99:22: error: missing binary operator before token "("
error: command 'gcc' failed with exit status 1
*** [do-build] Error code 1
Thanks!
-jgh
--
Jason Helfman | FreeBSD Committer
jgh(a)FreeBSD.org | http://people.freebsd.org/~jgh | The Power to Serve
10 years, 10 months
[libvirt] newer libvirt version issues
by Franky Van Liedekerke
Hi,
since we're running more than 20 hosts per KVM server, we needed to
update libvirt to at least 1.1.2 for virtlockd to be able to cope with
this (due to an old hardcoded limit that was in there before).
But where 1.1.0 compiles and runs just fine on a fully-patched CentOS
6.4 server, newer version have all kinds of issues:
Every version of libvirt >= 1.1.2 crashes with a segfault on up-to-date
CentOS 6.4 servers (see below).
Also, versions of libvirt >= 1.1.3 need a change in the spec file to be
able to compile:
apparently the %doc entries that are different with 1.1.2 prevent
rpmbuild to succeed on
CentOS servers. Using the %doc lines as per the 1.1.2 spec file results
in a working rpmbuild.
The 1.1.4 version has issues with a symbol not found after compiling
and letting it run:
error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_network.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_network.so:
undefined symbol: virNetworkList
error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_storage.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_storage.so:
undefined symbol: virAsprintf
error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_nodedev.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_nodedev.so:
undefined symbol: virNodeDeviceList
31677: error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_secret.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_secret.so: undefined
symbol: virAsprintf
31677: error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_nwfilter.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_nwfilter.so:
undefined symbol: virAsprintf
31677: error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_interface.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_interface.so:
undefined symbol: virAsprintf
31677: error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so: undefined
symbol: networkAllocateActualDevice
31677: error : virDriverLoadModule:78 : failed to load module
/usr/lib64/libvirt/connection-driver/libvirt_driver_lxc.so
/usr/lib64/libvirt/connection-driver/libvirt_driver_lxc.so: undefined
symbol: networkAllocateActualDevice
And every time libvirt segfaults, there's this in the logs:
debug : virJSONValueToString:1133 :
result={"id":"libvirt-6","error":{"class":"CommandNotFound","desc":"The
command qom-list has not been found","data":{"name":"qom-list"}}}
debug : virEventPollRunOnce:627 : EVENT_POLL_RUN: nhandles=32
timeout=1684
9479: debug : qemuMonitorJSONCheckError:341 : unable to execute QEMU
command
{"execute":"qom-list","arguments":{"path":"/"},"id":"libvirt-6"}:
{"id":"libvirt-6","error":{"class":"CommandNotFound","desc":"The command
qom-list has not been found","data":{"name":"qom-list"}}}
9479: error : qemuMonitorJSONCheckError:352 : internal error: unable to
execute QEMU command 'qom-list': The command qom-list has not been found
Any insights on any of these issues?
Franky
10 years, 11 months
[libvirt] [PATCH] libxl: avoid crashing if calling `virsh numatune' on inactive domain
by Dario Faggioli
by, in libxlDomainGetNumaParameters(), calling libxl_bitmap_init() as soon as
possible, which avoids getting to 'cleanup:', where libxl_bitmap_dispose()
happens, without having initialized the nodemap, and hence crashing after some
invalid free()-s:
# ./daemon/libvirtd -v
*** Error in `/home/xen/libvirt.git/daemon/.libs/lt-libvirtd': munmap_chunk(): invalid pointer: 0x00007fdd42592666 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7bbe7)[0x7fdd3f767be7]
/lib64/libxenlight.so.4.3(libxl_bitmap_dispose+0xd)[0x7fdd2c88c045]
/home/xen/libvirt.git/daemon/.libs/../../src/.libs/libvirt_driver_libxl.so(+0x12d26)[0x7fdd2caccd26]
/home/xen/libvirt.git/src/.libs/libvirt.so.0(virDomainGetNumaParameters+0x15c)[0x7fdd4247898c]
/home/xen/libvirt.git/daemon/.libs/lt-libvirtd(+0x1d9a2)[0x7fdd42ecc9a2]
/home/xen/libvirt.git/src/.libs/libvirt.so.0(virNetServerProgramDispatch+0x3da)[0x7fdd424e9eaa]
/home/xen/libvirt.git/src/.libs/libvirt.so.0(+0x1a6f38)[0x7fdd424e3f38]
/home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa81e5)[0x7fdd423e51e5]
/home/xen/libvirt.git/src/.libs/libvirt.so.0(+0xa783e)[0x7fdd423e483e]
/lib64/libpthread.so.0(+0x7c53)[0x7fdd3febbc53]
/lib64/libc.so.6(clone+0x6d)[0x7fdd3f7e1dbd]
Signed-off-by: Dario Faggili <dario.faggioli(a)citrix.com>
Cc: Jim Fehlig <jfehlig(a)suse.com>
Cc: Ian Jackson <Ian.Jackson(a)eu.citrix.com>
---
src/libxl/libxl_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 29aa6c7..d91744f 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3958,6 +3958,8 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
* the filtering on behalf of older clients that can't parse it. */
flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
+ libxl_bitmap_init(&nodemap);
+
if (!(vm = libxlDomObjFromDomain(dom)))
goto cleanup;
@@ -3972,8 +3974,6 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
priv = vm->privateData;
- libxl_bitmap_init(&nodemap);
-
if ((*nparams) == 0) {
*nparams = LIBXL_NUMA_NPARAM;
ret = 0;
10 years, 11 months
[libvirt] [PATCH] docs: fix layout of code snippets
by Eric Blake
Similar to commit 52dbeac, we should indent code snippets in
other places to ensure they appear correctly in html. See
http://libvirt.org/html/libvirt-libvirt.html#virNodeGetCPUStats
for an example improved by this patch. Also fix some missing
semicolons in the samples.
* src/libvirt.c: Indent code samples in comments.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
src/libvirt.c | 97 +++++++++++++++++++++++++++++------------------------------
1 file changed, 47 insertions(+), 50 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 77f481e..66841c8 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1150,9 +1150,9 @@ do_open(const char *name,
}
/*
- * If no URI is passed, then check for an environment string if not
- * available probe the compiled in drivers to find a default hypervisor
- * if detectable.
+ * If no URI is passed, then check for an environment string if not
+ * available probe the compiled in drivers to find a default hypervisor
+ * if detectable.
*/
if (!name &&
virConnectGetDefaultURI(conf, &name) < 0)
@@ -7629,14 +7629,14 @@ error:
*
* Here is a sample code snippet:
*
- * if ((virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0) &&
- * (nparams != 0)) {
- * if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL)
- * goto error;
- * memset(params, 0, sizeof(virNodeCPUStats) * nparams);
- * if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0))
- * goto error;
- * }
+ * if (virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0 &&
+ * nparams != 0) {
+ * if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL)
+ * goto error;
+ * memset(params, 0, sizeof(virNodeCPUStats) * nparams);
+ * if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0))
+ * goto error;
+ * }
*
* This function doesn't require privileged access to the hypervisor.
* This function expects the caller to allocate the @params.
@@ -7722,14 +7722,14 @@ error:
*
* Here is the sample code snippet:
*
- * if ((virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0) &&
- * (nparams != 0)) {
- * if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL)
- * goto error;
- * memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams);
- * if (virNodeGetMemoryStats(conn, params, &nparams, 0))
- * goto error;
- * }
+ * if (virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0 &&
+ * nparams != 0) {
+ * if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL)
+ * goto error;
+ * memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams);
+ * if (virNodeGetMemoryStats(conn, params, &nparams, 0))
+ * goto error;
+ * }
*
* This function doesn't require privileged access to the hypervisor.
* This function expects the caller to allocate the @params.
@@ -8134,14 +8134,14 @@ error:
*
* Here is a sample code snippet:
*
- * char *ret = virDomainGetSchedulerType(dom, &nparams);
- * if (ret && nparams != 0) {
- * if ((params = malloc(sizeof(*params) * nparams)) == NULL)
- * goto error;
- * memset(params, 0, sizeof(*params) * nparams);
- * if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, 0))
- * goto error;
- * }
+ * char *ret = virDomainGetSchedulerType(dom, &nparams);
+ * if (ret && nparams != 0) {
+ * if ((params = malloc(sizeof(*params) * nparams)) == NULL)
+ * goto error;
+ * memset(params, 0, sizeof(*params) * nparams);
+ * if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, 0))
+ * goto error;
+ * }
*
* Returns -1 in case of error, 0 in case of success.
*/
@@ -9381,24 +9381,21 @@ error:
* on each array element, then calling free() on @domains.
*
* Example of usage:
- * virDomainPtr *domains;
- * size_t i;
- * int ret;
- * unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING |
- * VIR_CONNECT_LIST_DOMAINS_PERSISTENT;
- *
- * ret = virConnectListAllDomains(conn, &domains, flags);
- * if (ret < 0)
- * error();
*
- * for (i = 0; i < ret; i++) {
- * do_something_with_domain(domains[i]);
- *
- * //here or in a separate loop if needed
- * virDomainFree(domains[i]);
- * }
- *
- * free(domains);
+ * virDomainPtr *domains;
+ * size_t i;
+ * int ret;
+ * unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING |
+ * VIR_CONNECT_LIST_DOMAINS_PERSISTENT;
+ * ret = virConnectListAllDomains(conn, &domains, flags);
+ * if (ret < 0)
+ * error();
+ * for (i = 0; i < ret; i++) {
+ * do_something_with_domain(domains[i]);
+ * //here or in a separate loop if needed
+ * virDomainFree(domains[i]);
+ * }
+ * free(domains);
*/
int
virConnectListAllDomains(virConnectPtr conn,
@@ -17023,7 +17020,7 @@ virStreamRef(virStreamPtr stream)
* API looks like
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_RDONLY)
+ * int fd = open("demo.iso", O_RDONLY);
*
* virConnectUploadFile(conn, "demo.iso", st);
*
@@ -17040,7 +17037,7 @@ virStreamRef(virStreamPtr stream)
* }
* int offset = 0;
* while (offset < got) {
- * int sent = virStreamSend(st, buf+offset, got-offset)
+ * int sent = virStreamSend(st, buf+offset, got-offset);
* if (sent < 0) {
* virStreamAbort(st);
* goto done;
@@ -17117,7 +17114,7 @@ error:
* API looks like
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_WRONLY, 0600)
+ * int fd = open("demo.iso", O_WRONLY, 0600);
*
* virConnectDownloadFile(conn, "demo.iso", st);
*
@@ -17132,7 +17129,7 @@ error:
* }
* int offset = 0;
* while (offset < got) {
- * int sent = write(fd, buf+offset, got-offset)
+ * int sent = write(fd, buf + offset, got - offset);
* if (sent < 0) {
* virStreamAbort(st);
* goto done;
@@ -17216,7 +17213,7 @@ error:
* }
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_RDONLY)
+ * int fd = open("demo.iso", O_RDONLY);
*
* virConnectUploadFile(conn, st);
* if (virStreamSendAll(st, mysource, &fd) < 0) {
@@ -17313,7 +17310,7 @@ cleanup:
* }
*
* virStreamPtr st = virStreamNew(conn, 0);
- * int fd = open("demo.iso", O_WRONLY)
+ * int fd = open("demo.iso", O_WRONLY);
*
* virConnectUploadFile(conn, st);
* if (virStreamRecvAll(st, mysink, &fd) < 0) {
--
1.8.4.2
10 years, 11 months
[libvirt] [PATCH] maint: update to latest gnulib
by Eric Blake
A couple of fixes for bootstrap issues reported on IRC:
- on some older glibc systems, ./configure could deadlock due to
a glibc malloc bug
- on FreeBSD systems, a broken autom4te coupled with gettext
0.18.3 prevents bootstrap; we can't work around it, but can at
least inform the user why they have a problem
And as always, portability fixes in other modules, some of which
are used by libvirt.
* .gnulib: Update to latest, in part for bootstrap improvements.
* bootstrap: Resync to gnulib.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Hmm, in reading this gnulib changelog, I'm not sure I want to
push right away: the line about md5 being tweaked to use openssl
makes me wonder if this update is dragging in a new library
dependency; I'll have to do a bit more investigation. But
here's the patch, if anyone else also wants to investigate.
* .gnulib 831b84c...fdfe96f (18):
> bootstrap: warn about BSD toolchain snafu
> open-tests: port to glibc with _FORTIFY_SOURCE and -O1
> include_next: minimize code duplication
> getcwd: fix compile error in configure check
> regex: suppress core dumps from detection code
> md5, sha1, sha256, sha512: support mandating use of openssl
> test-xvasprintf: disable some -Wformat-security diagnostics
> regex: avoid glibc deadlock during configure
> md5, sha1, sha256, sha512: use openssl routines if available
> base64: fix recent compilation regression on some compilers
> autoupdate
> autoupdate
> ignore-value: revert previous code change
> selinux-h: improve stub types and add more stub functions
> ignore-value: prefer GCC version back through 2.0
> pty: Activate the signature wrapper of forkpty.
> maint: fix gendocs.sh permissions
> autoupdate
.gnulib | 2 +-
bootstrap | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/.gnulib b/.gnulib
index 831b84c..fdfe96f 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 831b84c59ef413c57a36b67344467d66a8a2ba70
+Subproject commit fdfe96fe43746d63364f823ab3032c8301d53d1f
diff --git a/bootstrap b/bootstrap
index e31d17d..5acbe5b 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2013-08-15.22; # UTC
+scriptversion=2013-12-05.23; # UTC
# Bootstrap this package from checked-out sources.
@@ -551,6 +551,14 @@ if ! printf "$buildreq" | check_versions; then
fi
fi
+# Warn the user if autom4te appears to be broken; this causes known
+# issues with at least gettext 0.18.3.
+probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
+if test "x$probe" != xhi; then
+ warn_ "WARNING: your autom4te wrapper eats stdin;"
+ warn_ "if bootstrap fails, consider upgrading your autotools"
+fi
+
echo "$0: Bootstrapping from checked-out $package sources..."
# See if we can use gnulib's git-merge-changelog merge driver.
--
1.8.3.1
10 years, 11 months
[libvirt] [PATCHv2] maint: improve debug of libvirt-{qemu, lxc} apis
by Eric Blake
I noticed that the virDomainQemuMonitorCommand debug output wasn't
telling me the name of the domain it was working on. While it was
easy enough to determine which pointer matches the domain based on
other log messages, it is nicer to be consistent.
* src/util/viruuid.h (VIR_UUID_DEBUG): Moved here from...
* src/libvirt.c (VIR_UUID_DEBUG): ...here.
(VIR_ARG15, VIR_HAS_COMMA, VIR_DOMAIN_DEBUG_EXPAND)
(VIR_DOMAIN_DEBUG_PASTE, VIR_DOMAIN_DEBUG_0, VIR_DOMAIN_DEBUG_1)
(VIR_DOMAIN_DEBUG_2, VIR_DOMAIN_DEBUG): Move...
* src/datatypes.h: ...here.
* src/libvirt-qemu.c (virDomainQemuMonitorCommand)
(virDomainQemuAgentCommand): Better debug messages.
* src/libvirt-lxc.c (virDomainLxcOpenNamespace): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
The simpler part of my changes; the work on cleaning up the
remaining virLib*Error() calls in libvirt.c is turning into
a bigger cleanup project.
src/datatypes.h | 60 ++++++++++++++++++++++++++++++++++++++++++++-
src/libvirt-lxc.c | 4 +--
src/libvirt-qemu.c | 11 +++++----
src/libvirt.c | 71 ------------------------------------------------------
src/util/viruuid.h | 20 ++++++++++++++-
5 files changed, 86 insertions(+), 80 deletions(-)
diff --git a/src/datatypes.h b/src/datatypes.h
index 6026bb0..7f325b0 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -1,7 +1,7 @@
/*
* datatypes.h: management of structs for public data types
*
- * Copyright (C) 2006-2008, 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2008, 2010-2011, 2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -94,6 +94,64 @@ extern virClassPtr virStoragePoolClass;
(VIR_IS_SNAPSHOT(obj) && VIR_IS_DOMAIN((obj)->domain))
+/* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This
+ * assumes you pass fewer than 15 arguments to VIR_DOMAIN_DEBUG, but
+ * can easily be expanded if needed.
+ *
+ * Note that gcc provides extensions of "define a(b...) b" or
+ * "define a(b,...) b,##__VA_ARGS__" as a means of eliding a comma
+ * when no var-args are present, but we don't want to require gcc.
+ */
+# define VIR_ARG15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
+ _11, _12, _13, _14, _15, ...) _15
+# define VIR_HAS_COMMA(...) VIR_ARG15(__VA_ARGS__, \
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
+
+/* Form the name VIR_DOMAIN_DEBUG_[01], then call that macro,
+ * according to how many arguments are present. Two-phase due to
+ * macro expansion rules. */
+# define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \
+ VIR_DOMAIN_DEBUG_PASTE(a, b, __VA_ARGS__)
+# define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \
+ a##b(__VA_ARGS__)
+
+/* Internal use only, when VIR_DOMAIN_DEBUG has one argument. */
+# define VIR_DOMAIN_DEBUG_0(dom) \
+ VIR_DOMAIN_DEBUG_2(dom, "%s", "")
+
+/* Internal use only, when VIR_DOMAIN_DEBUG has three or more arguments. */
+# define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \
+ VIR_DOMAIN_DEBUG_2(dom, ", " fmt, __VA_ARGS__)
+
+/* Internal use only, with final format. */
+# define VIR_DOMAIN_DEBUG_2(dom, fmt, ...) \
+ do { \
+ char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
+ const char *_domname = NULL; \
+ \
+ if (!VIR_IS_DOMAIN(dom)) { \
+ memset(_uuidstr, 0, sizeof(_uuidstr)); \
+ } else { \
+ virUUIDFormat((dom)->uuid, _uuidstr); \
+ _domname = (dom)->name; \
+ } \
+ \
+ VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s)" fmt, \
+ dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
+ } while (0)
+
+/**
+ * VIR_DOMAIN_DEBUG:
+ * @dom: domain
+ * @fmt: optional format for additional information
+ * @...: optional arguments corresponding to @fmt.
+ */
+# define VIR_DOMAIN_DEBUG(...) \
+ VIR_DOMAIN_DEBUG_EXPAND(VIR_DOMAIN_DEBUG_, \
+ VIR_HAS_COMMA(__VA_ARGS__), \
+ __VA_ARGS__)
+
+
typedef struct _virConnectCloseCallbackData virConnectCloseCallbackData;
typedef virConnectCloseCallbackData *virConnectCloseCallbackDataPtr;
diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c
index c8cdcea..5cbe8bf 100644
--- a/src/libvirt-lxc.c
+++ b/src/libvirt-lxc.c
@@ -28,6 +28,7 @@
#include "virfile.h"
#include "virlog.h"
#include "virprocess.h"
+#include "viruuid.h"
#include "datatypes.h"
#ifdef WITH_SELINUX
# include <selinux/selinux.h>
@@ -69,8 +70,7 @@ virDomainLxcOpenNamespace(virDomainPtr domain,
{
virConnectPtr conn;
- VIR_DEBUG("domain=%p, fdlist=%p flags=%x",
- domain, fdlist, flags);
+ VIR_DOMAIN_DEBUG(domain, "fdlist=%p flags=%x", fdlist, flags);
virResetLastError();
diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c
index 83fb3b3..2fa5522 100644
--- a/src/libvirt-qemu.c
+++ b/src/libvirt-qemu.c
@@ -2,7 +2,7 @@
* libvirt-qemu.c: Interfaces for the libvirt library to handle qemu-specific
* APIs.
*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,7 @@
#include "virerror.h"
#include "virlog.h"
+#include "viruuid.h"
#include "datatypes.h"
#define VIR_FROM_THIS VIR_FROM_NONE
@@ -75,8 +76,8 @@ virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
{
virConnectPtr conn;
- VIR_DEBUG("domain=%p, cmd=%s, result=%p, flags=%x",
- domain, cmd, result, flags);
+ VIR_DOMAIN_DEBUG(domain, "cmd=%s, result=%p, flags=%x",
+ cmd, result, flags);
virResetLastError();
@@ -213,8 +214,8 @@ virDomainQemuAgentCommand(virDomainPtr domain,
virConnectPtr conn;
char *ret;
- VIR_DEBUG("domain=%p, cmd=%s, timeout=%d, flags=%x",
- domain, cmd, timeout, flags);
+ VIR_DOMAIN_DEBUG(domain, "cmd=%s, timeout=%d, flags=%x",
+ cmd, timeout, flags);
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
diff --git a/src/libvirt.c b/src/libvirt.c
index 77f481e..37de991 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -327,77 +327,6 @@ static struct gcry_thread_cbs virTLSThreadImpl = {
};
#endif /* WITH_GNUTLS_GCRYPT */
-/* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This
- * assumes you pass fewer than 15 arguments to VIR_DOMAIN_DEBUG, but
- * can easily be expanded if needed.
- *
- * Note that gcc provides extensions of "define a(b...) b" or
- * "define a(b,...) b,##__VA_ARGS__" as a means of eliding a comma
- * when no var-args are present, but we don't want to require gcc.
- */
-#define VIR_ARG15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) _15
-#define VIR_HAS_COMMA(...) VIR_ARG15(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
-
-/* Form the name VIR_DOMAIN_DEBUG_[01], then call that macro,
- * according to how many arguments are present. Two-phase due to
- * macro expansion rules. */
-#define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \
- VIR_DOMAIN_DEBUG_PASTE(a, b, __VA_ARGS__)
-#define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \
- a##b(__VA_ARGS__)
-
-/* Internal use only, when VIR_DOMAIN_DEBUG has one argument. */
-#define VIR_DOMAIN_DEBUG_0(dom) \
- VIR_DOMAIN_DEBUG_2(dom, "%s", "")
-
-/* Internal use only, when VIR_DOMAIN_DEBUG has three or more arguments. */
-#define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \
- VIR_DOMAIN_DEBUG_2(dom, ", " fmt, __VA_ARGS__)
-
-/* Internal use only, with final format. */
-#define VIR_DOMAIN_DEBUG_2(dom, fmt, ...) \
- do { \
- char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
- const char *_domname = NULL; \
- \
- if (!VIR_IS_DOMAIN(dom)) { \
- memset(_uuidstr, 0, sizeof(_uuidstr)); \
- } else { \
- virUUIDFormat((dom)->uuid, _uuidstr); \
- _domname = (dom)->name; \
- } \
- \
- VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s)" fmt, \
- dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
- } while (0)
-
-/**
- * VIR_DOMAIN_DEBUG:
- * @dom: domain
- * @fmt: optional format for additional information
- * @...: optional arguments corresponding to @fmt.
- */
-#define VIR_DOMAIN_DEBUG(...) \
- VIR_DOMAIN_DEBUG_EXPAND(VIR_DOMAIN_DEBUG_, \
- VIR_HAS_COMMA(__VA_ARGS__), \
- __VA_ARGS__)
-
-/**
- * VIR_UUID_DEBUG:
- * @conn: connection
- * @uuid: possibly null UUID array
- */
-#define VIR_UUID_DEBUG(conn, uuid) \
- do { \
- if (uuid) { \
- char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
- virUUIDFormat(uuid, _uuidstr); \
- VIR_DEBUG("conn=%p, uuid=%s", conn, _uuidstr); \
- } else { \
- VIR_DEBUG("conn=%p, uuid=(null)", conn); \
- } \
- } while (0)
-
static bool virGlobalError = false;
static virOnceControl virGlobalOnce = VIR_ONCE_CONTROL_INITIALIZER;
diff --git a/src/util/viruuid.h b/src/util/viruuid.h
index bebd338..b3b1d49 100644
--- a/src/util/viruuid.h
+++ b/src/util/viruuid.h
@@ -1,7 +1,7 @@
/*
* viruuid.h: helper APIs for dealing with UUIDs
*
- * Copyright (C) 2007, 2011, 2012 Red Hat, Inc.
+ * Copyright (C) 2007, 2011-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,24 @@
# include "internal.h"
+
+/**
+ * VIR_UUID_DEBUG:
+ * @conn: connection
+ * @uuid: possibly null UUID array
+ */
+# define VIR_UUID_DEBUG(conn, uuid) \
+ do { \
+ if (uuid) { \
+ char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
+ virUUIDFormat(uuid, _uuidstr); \
+ VIR_DEBUG("conn=%p, uuid=%s", conn, _uuidstr); \
+ } else { \
+ VIR_DEBUG("conn=%p, uuid=(null)", conn); \
+ } \
+ } while (0)
+
+
int virSetHostUUIDStr(const char *host_uuid);
int virGetHostUUID(unsigned char *host_uuid) ATTRIBUTE_NONNULL(1);
--
1.8.4.2
10 years, 11 months
[libvirt] [PATCH] maint: fix typo in error message
by Eric Blake
* src/util/virerror.h (virReportInvalidZeroArg): Fix double space.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
src/util/virerror.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virerror.h b/src/util/virerror.h
index 05e9950..87272e9 100644
--- a/src/util/virerror.h
+++ b/src/util/virerror.h
@@ -1,7 +1,7 @@
/*
* virerror.c: error handling and reporting code for libvirt
*
- * Copyright (C) 2006-2009, 2011 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -121,7 +121,7 @@ void virReportSystemErrorFull(int domcode,
#argname, \
NULL, \
0, 0, \
- _("%s in %s must be zero"), \
+ _("%s in %s must be zero"), \
#argname, __FUNCTION__)
# define virReportInvalidNonNegativeArg(argname) \
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
--
1.8.4.2
10 years, 11 months
[libvirt] fail to live migration is related to virtio-console
by yue
hi,all
this error occured when live migration windows os, log of that vm is:
features 0x1e unsupported allowed features 0x71000002
qemu warning error while loading state for instance 0x0 of device '0000:00:04.4/virtio-console'
do you have some idea about that?
thanks
10 years, 11 months