Re: [libvirt] [PATCH] mark a few diagnostics for translation
Jim Meyering j...@meyering.net wrote: Daniel P. Berrange berra...@redhat.com wrote: On Mon, Jan 26, 2009 at 03:05:05PM +0100, Jim Meyering wrote: Avoid compile-time warnings: From 4597152e0c4a1e4a5ee85156496a8625b5cc4f42 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Mon, 26 Jan 2009 14:54:21 +0100 Subject: [PATCH 2/3] mark a few diagnostics for translation Any calls which have a VIR_ERR_NO_MEMORY can just be replaced by a call to virReportOOMError(). Ack to the other non-OOM error msg changes. Ok. I've gone ahead and done those four here, I've just comitted that and the indentation fix. BTW, thanks for the quick feedback. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] trivial libvirt example code
Dave Allan dal...@redhat.com wrote: Richard W.M. Jones wrote: On Fri, Jan 23, 2009 at 02:51:02PM -0500, Dave Allan wrote: The examples directory doesn't have a trivial example of how to connect to a hypervisor, make a few calls, and disconnect, so I put one together. I would appreciate any suggestions on anything that I've done wrong as well as suggestions for other fundamental API calls that should be illustrated. Yes, I checked this example code and it is fine. My only comment would be on: +/* virConnectOpenAuth called here with all default parameters */ +conn = virConnectOpenAuth(NULL, virConnectAuthPtrDefault, 0); It might be better to let people connect to a named URI. Another possibility is to default to the test URI (test:///default) since that (almost) always exists. Hi Rich, Thanks for taking a look at it. I added a little code to let the user specify a URI on the command line. Do you think it is worth committing? Hi Dave, I like your example. Thanks for preparing it. Here are some suggestions: diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c new file mode 100644 index 000..22d3309 --- /dev/null +++ b/examples/hellolibvirt/hellolibvirt.c @@ -0,0 +1,151 @@ +/* This file contains trivial example code to connect to the running + * hypervisor and gather a few bits of information. */ + +#include stdio.h +#include stdlib.h +#include libvirt/libvirt.h + +static int +showHypervisorInfo(virConnectPtr conn) +{ +int ret = 0; +unsigned long hvVer, major, minor, release; +const char *hvType; + +/* virConnectGetType returns a pointer to a static string, so no + * allocation or freeing is necessary; it is possible for the call + * to fail if, for example, there is no connection to a + * hypervisor, so check what it returns. */ +hvType = virConnectGetType(conn); +if (NULL == hvType) { +ret = 1; +printf(Failed to get hypervisor type\n); +goto out; +} + +if (0 != virConnectGetVersion(conn, hvVer)) { +ret = 1; +printf(Failed to get hypervisor version\n); +goto out; +} + +major = hvVer / 100; +hvVer %= 100; +minor = hvVer / 1000; +release = hvVer % 1000; + +printf(Hypervisor: \%s\ version: %lu.%lu.%lu\n, + hvType, + major, + minor, + release); + How about initializing ret = 1 above and setting ret = 0 here to indicate success? It's a close call, since that results in removal of only two ret = 1 assignments. +out: +return ret; +} + + +static int +showDomains(virConnectPtr conn) +{ +int ret = 0, i, numNames, numInactiveDomains, numActiveDomains; +char **nameList = NULL; + +numActiveDomains = virConnectNumOfDomains(conn); +numInactiveDomains = virConnectNumOfDefinedDomains(conn); It'd be good to handle numInactiveDomains 0 differently. Currently it'll probably provoke a failed malloc, below. +printf(There are %d active and %d inactive domains\n, + numActiveDomains, numInactiveDomains); + +nameList = malloc(sizeof(char *) * (unsigned int)numInactiveDomains); Using the target variable name rather than the type is a little more maintainable, in general, so set a good example: And please drop the cast. We hate casts, and besides, it's not needed. nameList = malloc(sizeof(*nameList) * numInactiveDomains); +if (NULL == nameList) { +ret = 1; +printf(Could not allocate memory for list of inactive domains\n); +goto out; +} + +numNames = virConnectListDefinedDomains(conn, +nameList, +numInactiveDomains); + +if (-1 == numNames) { +ret = 1; +printf(Could not get list of defined domains from hypervisor\n); +goto out; +} + +if (numNames 0) { +printf(Inactive domains:\n); +} + +for (i = 0 ; i numNames ; i++) { +printf( %s\n, *(nameList + i)); +/* The API documentation doesn't say so, but the names + * returned by virConnectListDefinedDomains are strdup'd and + * must be freed here. */ +free(*(nameList + i)); +} Here's another case where you can save a line by initializing ret=1 up front and setting ret=0 here. +out: +if (NULL != nameList) { +free(nameList); The test for non-NULL-before-free is unnecessary, since free is guaranteed to handle NULL properly. So just call free: free(nameList); In fact, if you run make syntax-check before making the suggested change, it should detect and complain about this code. +return ret; +} + + +int +main(int argc, char *argv[]) +{ +int ret = 0; +virConnectPtr conn = NULL; The above initialization is unnecessary. +char *uri = NULL;
Re: [libvirt] [PATCH] kvm/virtio: Set IFF_VNET_HDR when setting up tap fds
On Mon, Jan 26, 2009 at 10:39:25AM +, Mark McLoughlin wrote: IFF_VNET_HDR is a tun/tap flag that allows you to send and receive large (i.e. GSO) packets and packets with partial checksums. Setting the flag means that every packet is proceeded by the same header which virtio uses to communicate GSO/csum metadata. By enabling this flag on the tap fds we create, we greatly increase the achievable throughput with virtio_net. However, we need to be careful to only set the flag when a) QEMU has support for this ABI and b) the value of the flag is queryable using the TUNGETIFF ioctl. It's nearly five months since kvm-74 - the first KVM release with this feature - was released. Up until now, we've not added libvirt support because there is no clean way to detect support for this in QEMU at runtime. A brief attempt to add a info capabilities monitor command to QEMU floundered. Perfect is the enemy of good enough. Probing the KVM version will suffice for now. ACK to the approach taken here. I've had todo the same version based check for the migration features, since that has broken compatability and is also totally undocumented in the command line help output. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] fix errors in virReportSystemErrorFull
Daniel P. Berrange berra...@redhat.com wrote: ... Looking at the whole method again, I think it needs to be re-written to something closer to this: Ok, I've adapted that. Changes: - handle snprintf and vsnprintf failure - insert : into the result string - use stpcpy, not strcat (as a general waste-avoidance measure, -- i.e., don't traverse potentially long strings unnecessarily -- no linux- or gnulib-using project should use strcat on arbitrary strings.) That latter one required pulling in the stpcpy module from gnulib. Linux has had stpcpy for ages, and POSIX now specifies it, but Solaris 10 and others still lack it. So there are two more patches that are prerequisites for this one: - update from gnulib - add stpcpy to bootstrap's module list and pull in the required gnulib files (2 new, 3 changed) I'm checking all of this in shortly. From 5c7812209b93654a0b236ef9529fdebe49af3972 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Mon, 26 Jan 2009 14:59:35 +0100 Subject: [PATCH] fix errors in virReportSystemErrorFull * src/virterror.c (virStrerror): New function. (virReportSystemErrorFull): Don't leak combined. In fact, don't even attempt allocation. Do include the result of formatted print in final diagnostic. --- src/virterror.c | 72 +++--- 1 files changed, 41 insertions(+), 31 deletions(-) diff --git a/src/virterror.c b/src/virterror.c index 0c66781..a577002 100644 --- a/src/virterror.c +++ b/src/virterror.c @@ -1005,57 +1005,67 @@ void virReportErrorHelper(virConnectPtr conn, int domcode, int errcode, } - -void virReportSystemErrorFull(virConnectPtr conn, - int domcode, - int theerrno, - const char *filename ATTRIBUTE_UNUSED, - const char *funcname ATTRIBUTE_UNUSED, - size_t linenr ATTRIBUTE_UNUSED, - const char *fmt, ...) +static const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen) { -va_list args; -char errorMessage[1024]; -char systemError[1024]; -char *theerrnostr; -const char *virerr; -char *combined = NULL; - #ifdef HAVE_STRERROR_R -#ifdef __USE_GNU +# ifdef __USE_GNU /* Annoying linux specific API contract */ -theerrnostr = strerror_r(theerrno, systemError, sizeof(systemError)); -#else -strerror_r(theerrno, systemError, sizeof(systemError)); -theerrnostr = systemError; -#endif +return strerror_r(theerrno, errBuf, errBufLen); +# else +strerror_r(theerrno, errBuf, errBufLen); +return errBuf; +# endif #else /* Mingw lacks strerror_r() and its strerror() is definitely not * threadsafe, so safest option is to just print the raw errno * value - we can at least reliably safely look it up in the * header files for debug purposes */ -snprintf(systemError, sizeof(systemError), errno=%d, theerrno); -theerrnostr = systemError; +int n = snprintf(errBuf, errBufLen, errno=%d, theerrno); +return (0 n n errBufLen +? errBuf : _(internal error: buffer too small)); #endif +} + +void virReportSystemErrorFull(virConnectPtr conn, + int domcode, + int theerrno, + const char *filename ATTRIBUTE_UNUSED, + const char *funcname ATTRIBUTE_UNUSED, + size_t linenr ATTRIBUTE_UNUSED, + const char *fmt, ...) +{ +char strerror_buf[1024]; +char msgDetailBuf[1024]; + +const char *errnoDetail = virStrerror(theerrno, strerror_buf, + sizeof(strerror_buf)); +const char *msg = virErrorMsg(VIR_ERR_SYSTEM_ERROR, fmt); +const char *msgDetail = NULL; if (fmt) { +va_list args; +int n; + va_start(args, fmt); -vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args); +n = vsnprintf(msgDetailBuf, sizeof(msgDetailBuf), fmt, args); va_end(args); -} else { -errorMessage[0] = '\0'; + +size_t len = strlen (msgDetailBuf); +if (0 = n n + 2 + len sizeof (msgDetailBuf)) { + char *p = msgDetailBuf + n; + stpcpy (stpcpy (p, : ), errnoDetail); + msgDetail = msgDetailBuf; +} } -if (virAsprintf(combined, %s: %s, errorMessage, theerrnostr) 0) -combined = theerrnostr; /* OOM, so lets just pass the strerror info as best effort */ +if (!msgDetailBuf) +msgDetail = errnoDetail; -virerr = virErrorMsg(VIR_ERR_SYSTEM_ERROR, (errorMessage[0] ? errorMessage : NULL)); virRaiseError(conn, NULL, NULL, domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR, - virerr, errorMessage, NULL, -1, -1, virerr, errorMessage); + msg, msgDetail,
Re: [libvirt] [PATCH] kvm/virtio: Set IFF_VNET_HDR when setting up tap fds
On Tue, 2009-01-27 at 10:05 +, Daniel P. Berrange wrote: On Mon, Jan 26, 2009 at 10:39:25AM +, Mark McLoughlin wrote: It's nearly five months since kvm-74 - the first KVM release with this feature - was released. Up until now, we've not added libvirt support because there is no clean way to detect support for this in QEMU at runtime. A brief attempt to add a info capabilities monitor command to QEMU floundered. Perfect is the enemy of good enough. Probing the KVM version will suffice for now. ACK to the approach taken here. I've had todo the same version based check for the migration features, since that has broken compatability and is also totally undocumented in the command line help output. Thanks, committed now. Cheers, Mark. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] PATCH: Reset global error object at end of test
There statstest test case is expected to raise a number of libvirt errors. Since these are now stored in thread locals, it is expected that this won't be free'd automatically at system shutdown. This patch adds a call to virResetError() at the end to release the memory associated with the stored error object. There is still one block of memory alocated though, which is the thread local error error object itself. We can't free this easily, so I just add a valgrind suppression rule instead. This lets 'make valgrind' pass again Also since the test case doesn't call virInitialize()as a normal app would do, we need to explicitly initialize the thread local storage to ensure things work correctly. Daniel diff -r 93337ec227d6 tests/.valgrind.supp --- a/tests/.valgrind.supp Mon Jan 26 15:25:53 2009 + +++ b/tests/.valgrind.supp Tue Jan 27 11:15:47 2009 + @@ -238,3 +238,18 @@ fun:virtTestRun fun:mymain } +{ + ignoreThreadLocalErrorObject + Memcheck:Leak + fun:calloc + fun:virAlloc + fun:virLastErrorObject + fun:virRaiseError + fun:statsErrorFunc + fun:xenLinuxDomainDeviceID + fun:testDeviceHelper + fun:virtTestRun + fun:mymain + fun:virtTestMain + fun:main +} diff -r 93337ec227d6 tests/testutils.c --- a/tests/testutils.c Mon Jan 26 15:25:53 2009 + +++ b/tests/testutils.c Tue Jan 27 11:15:47 2009 + @@ -26,6 +26,8 @@ #include internal.h #include memory.h #include util.h +#include threads.h +#include virterror_internal.h #if TEST_OOM_TRACE #include execinfo.h @@ -319,8 +321,8 @@ int virtTestMain(int argc, int (*func)(int, char **)) { char *debugStr; +int ret; #if TEST_OOM -int ret; int approxAlloc = 0; int n; char *oomStr = NULL; @@ -330,6 +332,10 @@ int virtTestMain(int argc, int worker = 0; #endif +if (virThreadInitialize() 0 || +virErrorInitialize() 0) +return 1; + if ((debugStr = getenv(VIR_TEST_DEBUG)) != NULL) { if (virStrToLong_ui(debugStr, NULL, 10, testDebug) 0) testDebug = 0; @@ -349,8 +355,10 @@ int virtTestMain(int argc, if (getenv(VIR_TEST_MP) != NULL) { mp = sysconf(_SC_NPROCESSORS_ONLN); fprintf(stderr, Using %d worker processes\n, mp); -if (VIR_ALLOC_N(workers, mp) 0) -return EXIT_FAILURE; +if (VIR_ALLOC_N(workers, mp) 0) { +ret = EXIT_FAILURE; +goto cleanup; +} } if (testOOM) @@ -359,7 +367,7 @@ int virtTestMain(int argc, /* Run once to count allocs, and ensure it passes :-) */ ret = (func)(argc, argv); if (ret != EXIT_SUCCESS) -return EXIT_FAILURE; +goto cleanup; #if TEST_OOM_TRACE if (testDebug) @@ -431,9 +439,11 @@ int virtTestMain(int argc, else fprintf(stderr, FAILED\n); } +cleanup: +#else +ret = (func)(argc, argv); +#endif + +virResetLastError(); return ret; - -#else -return (func)(argc, argv); -#endif } -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] about libvirt-qpid on libvirt.org
On Tue, Jan 27, 2009 at 12:51:57PM +0900, Atsushi SAKAI wrote: Hi, I have a question about libvirt-qpid. The libvirt-qpid is working for QPID broker? If so, it should be added in livirt is section of following pages. http://libvirt.org/ How do you think? Yes, it should be listed - here is an updated front page, also added the User Mode Linux driver, and mentioning the Windows client support. I also added details of URI format to all the per-driver pages, since people often seem to ask about this Daniel diff -r f787e41fb699 docs/drvopenvz.html --- a/docs/drvopenvz.html Tue Jan 27 11:15:48 2009 + +++ b/docs/drvopenvz.html Tue Jan 27 11:39:31 2009 + @@ -142,6 +142,7 @@ /p pre openvz:///system (local access) +openvz+unix:///system(local access) openvz://example.com/system (remote access, TLS/x509) openvz+tcp://example.com/system (remote access, SASl/Kerberos) openvz+ssh://r...@example.com/system (remote access, SSH tunnelled) diff -r f787e41fb699 docs/drvopenvz.html.in --- a/docs/drvopenvz.html.inTue Jan 27 11:15:48 2009 + +++ b/docs/drvopenvz.html.inTue Jan 27 11:39:31 2009 + @@ -21,6 +21,7 @@ pre openvz:///system (local access) +openvz+unix:///system(local access) openvz://example.com/system (remote access, TLS/x509) openvz+tcp://example.com/system (remote access, SASl/Kerberos) openvz+ssh://r...@example.com/system (remote access, SSH tunnelled) diff -r f787e41fb699 docs/drvqemu.html --- a/docs/drvqemu.html Tue Jan 27 11:15:48 2009 + +++ b/docs/drvqemu.html Tue Jan 27 11:39:31 2009 + @@ -149,6 +149,23 @@ node. If both are found, then Xen paravirtualized guests can be run using the KVM hardware acceleration. /li/ul +h2Connections to QEMU driver/h2 +p +The libvirt QEMU driver is a multi-instance driver, providing a single +system wide privileged driver (the system instance), and per-user +unprivileged drivers (the session instance). The of the driver protocol +is qemu. Some example conection URIs for the libvirt driver are: +/p +pre +qemu:///session (local access to per-user instance) +qemu+unix:///session (local access to per-user instance) + +qemu:///system (local access to system instance) +qemu+unix:///system (local access to system instance) +qemu://example.com/system(remote access, TLS/x509) +qemu+tcp://example.com/system(remote access, SASl/Kerberos) +qemu+ssh://r...@example.com/system (remote access, SSH tunnelled) +/pre h2 a name=xmlconfig id=xmlconfigExample domain XML config/a /h2 diff -r f787e41fb699 docs/drvqemu.html.in --- a/docs/drvqemu.html.in Tue Jan 27 11:15:48 2009 + +++ b/docs/drvqemu.html.in Tue Jan 27 11:39:31 2009 + @@ -32,6 +32,26 @@ /li /ul +h2Connections to QEMU driver/h2 + +p +The libvirt QEMU driver is a multi-instance driver, providing a single +system wide privileged driver (the system instance), and per-user +unprivileged drivers (the session instance). The of the driver protocol +is qemu. Some example conection URIs for the libvirt driver are: +/p + +pre +qemu:///session (local access to per-user instance) +qemu+unix:///session (local access to per-user instance) + +qemu:///system (local access to system instance) +qemu+unix:///system (local access to system instance) +qemu://example.com/system(remote access, TLS/x509) +qemu+tcp://example.com/system(remote access, SASl/Kerberos) +qemu+ssh://r...@example.com/system (remote access, SSH tunnelled) +/pre + h2a name=xmlconfigExample domain XML config/a/h2 h3QEMU emulated guest on x86_64/h3 diff -r f787e41fb699 docs/drvtest.html --- a/docs/drvtest.html Tue Jan 27 11:15:48 2009 + +++ b/docs/drvtest.html Tue Jan 27 11:39:31 2009 + @@ -126,6 +126,22 @@ /div div id=content h1Test mock driver/h1 +h2Connections to Test driver/h2 +p +The libvirt Test driver is a per-process fake hypervisor driver, +with a driver name of 'test'. The driver maintains all its state +in memory. It can start with a pre-configured default config, or +be given a path to a alternate config. Some example conection URIs +for the libvirt driver are: +/p +pre +test:///default (local access, default config) +test:///path/to/driver/config.xml (local access, custom config) +test+unix:///default(local access, default config, via daemon) +test://example.com/default (remote access,
Re: [libvirt] about libvirt-qpid on libvirt.org
Hi, Daniel It looks good for me. Thanks Atsushi SAKAI Daniel P. Berrange berra...@redhat.com wrote: On Tue, Jan 27, 2009 at 12:51:57PM +0900, Atsushi SAKAI wrote: Hi, I have a question about libvirt-qpid. The libvirt-qpid is working for QPID broker? If so, it should be added in livirt is section of following pages. http://libvirt.org/ How do you think? Yes, it should be listed - here is an updated front page, also added the User Mode Linux driver, and mentioning the Windows client support. I also added details of URI format to all the per-driver pages, since people often seem to ask about this Daniel diff -r f787e41fb699 docs/drvopenvz.html --- a/docs/drvopenvz.html Tue Jan 27 11:15:48 2009 + +++ b/docs/drvopenvz.html Tue Jan 27 11:39:31 2009 + @@ -142,6 +142,7 @@ /p pre openvz:///system (local access) +openvz+unix:///system(local access) openvz://example.com/system (remote access, TLS/x509) openvz+tcp://example.com/system (remote access, SASl/Kerberos) openvz+ssh://r...@example.com/system (remote access, SSH tunnelled) diff -r f787e41fb699 docs/drvopenvz.html.in --- a/docs/drvopenvz.html.in Tue Jan 27 11:15:48 2009 + +++ b/docs/drvopenvz.html.in Tue Jan 27 11:39:31 2009 + @@ -21,6 +21,7 @@ pre openvz:///system (local access) +openvz+unix:///system(local access) openvz://example.com/system (remote access, TLS/x509) openvz+tcp://example.com/system (remote access, SASl/Kerberos) openvz+ssh://r...@example.com/system (remote access, SSH tunnelled) diff -r f787e41fb699 docs/drvqemu.html --- a/docs/drvqemu.html Tue Jan 27 11:15:48 2009 + +++ b/docs/drvqemu.html Tue Jan 27 11:39:31 2009 + @@ -149,6 +149,23 @@ node. If both are found, then Xen paravirtualized guests can be run using the KVM hardware acceleration. /li/ul +h2Connections to QEMU driver/h2 +p +The libvirt QEMU driver is a multi-instance driver, providing a single +system wide privileged driver (the system instance), and per-user +unprivileged drivers (the session instance). The of the driver protocol +is qemu. Some example conection URIs for the libvirt driver are: +/p +pre +qemu:///session (local access to per-user instance) +qemu+unix:///session (local access to per-user instance) + +qemu:///system (local access to system instance) +qemu+unix:///system (local access to system instance) +qemu://example.com/system(remote access, TLS/x509) +qemu+tcp://example.com/system(remote access, SASl/Kerberos) +qemu+ssh://r...@example.com/system (remote access, SSH tunnelled) +/pre h2 a name=xmlconfig id=xmlconfigExample domain XML config/a /h2 diff -r f787e41fb699 docs/drvqemu.html.in --- a/docs/drvqemu.html.inTue Jan 27 11:15:48 2009 + +++ b/docs/drvqemu.html.inTue Jan 27 11:39:31 2009 + @@ -32,6 +32,26 @@ /li /ul +h2Connections to QEMU driver/h2 + +p +The libvirt QEMU driver is a multi-instance driver, providing a single +system wide privileged driver (the system instance), and per-user +unprivileged drivers (the session instance). The of the driver protocol +is qemu. Some example conection URIs for the libvirt driver are: +/p + +pre +qemu:///session (local access to per-user instance) +qemu+unix:///session (local access to per-user instance) + +qemu:///system (local access to system instance) +qemu+unix:///system (local access to system instance) +qemu://example.com/system(remote access, TLS/x509) +qemu+tcp://example.com/system(remote access, SASl/Kerberos) +qemu+ssh://r...@example.com/system (remote access, SSH tunnelled) +/pre + h2a name=xmlconfigExample domain XML config/a/h2 h3QEMU emulated guest on x86_64/h3 diff -r f787e41fb699 docs/drvtest.html --- a/docs/drvtest.html Tue Jan 27 11:15:48 2009 + +++ b/docs/drvtest.html Tue Jan 27 11:39:31 2009 + @@ -126,6 +126,22 @@ /div div id=content h1Test mock driver/h1 +h2Connections to Test driver/h2 +p +The libvirt Test driver is a per-process fake hypervisor driver, +with a driver name of 'test'. The driver maintains all its state +in memory. It can start with a pre-configured default config, or +be given a path to a alternate config. Some example conection URIs +for the libvirt driver are: +/p +pre +test:///default (local access,
Re: [libvirt] [PATCH] fix errors in virReportSystemErrorFull
On Tue, Jan 27, 2009 at 11:28:32AM +0100, Jim Meyering wrote: Daniel P. Berrange berra...@redhat.com wrote: ... Looking at the whole method again, I think it needs to be re-written to something closer to this: Ok, I've adapted that. +void virReportSystemErrorFull(virConnectPtr conn, + int domcode, + int theerrno, + const char *filename ATTRIBUTE_UNUSED, + const char *funcname ATTRIBUTE_UNUSED, + size_t linenr ATTRIBUTE_UNUSED, + const char *fmt, ...) +{ +char strerror_buf[1024]; +char msgDetailBuf[1024]; + +const char *errnoDetail = virStrerror(theerrno, strerror_buf, + sizeof(strerror_buf)); +const char *msg = virErrorMsg(VIR_ERR_SYSTEM_ERROR, fmt); +const char *msgDetail = NULL; if (fmt) { +va_list args; +int n; + va_start(args, fmt); -vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args); +n = vsnprintf(msgDetailBuf, sizeof(msgDetailBuf), fmt, args); va_end(args); -} else { -errorMessage[0] = '\0'; + +size_t len = strlen (msgDetailBuf); +if (0 = n n + 2 + len sizeof (msgDetailBuf)) { + char *p = msgDetailBuf + n; + stpcpy (stpcpy (p, : ), errnoDetail); + msgDetail = msgDetailBuf; +} } -if (virAsprintf(combined, %s: %s, errorMessage, theerrnostr) 0) -combined = theerrnostr; /* OOM, so lets just pass the strerror info as best effort */ +if (!msgDetailBuf) +msgDetail = errnoDetail; This should be if (!msgDetail) - indeed just noticed the compiler warns on this cc1: warnings being treated as errors virterror.c: In function 'virReportSystemErrorFull': virterror.c:1062: error: the address of 'msgDetailBuf' will always evaluate as 'true' Dainel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] fix errors in virReportSystemErrorFull
Daniel P. Berrange berra...@redhat.com wrote: On Tue, Jan 27, 2009 at 11:28:32AM +0100, Jim Meyering wrote: Daniel P. Berrange berra...@redhat.com wrote: ... Looking at the whole method again, I think it needs to be re-written to something closer to this: Ok, I've adapted that. +void virReportSystemErrorFull(virConnectPtr conn, + int domcode, + int theerrno, + const char *filename ATTRIBUTE_UNUSED, + const char *funcname ATTRIBUTE_UNUSED, + size_t linenr ATTRIBUTE_UNUSED, + const char *fmt, ...) +{ +char strerror_buf[1024]; +char msgDetailBuf[1024]; + +const char *errnoDetail = virStrerror(theerrno, strerror_buf, + sizeof(strerror_buf)); +const char *msg = virErrorMsg(VIR_ERR_SYSTEM_ERROR, fmt); +const char *msgDetail = NULL; if (fmt) { +va_list args; +int n; + va_start(args, fmt); -vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args); +n = vsnprintf(msgDetailBuf, sizeof(msgDetailBuf), fmt, args); va_end(args); -} else { -errorMessage[0] = '\0'; + +size_t len = strlen (msgDetailBuf); +if (0 = n n + 2 + len sizeof (msgDetailBuf)) { + char *p = msgDetailBuf + n; + stpcpy (stpcpy (p, : ), errnoDetail); + msgDetail = msgDetailBuf; +} } -if (virAsprintf(combined, %s: %s, errorMessage, theerrnostr) 0) -combined = theerrnostr; /* OOM, so lets just pass the strerror info as best effort */ +if (!msgDetailBuf) +msgDetail = errnoDetail; This should be if (!msgDetail) - indeed just noticed the compiler warns on this cc1: warnings being treated as errors virterror.c: In function 'virReportSystemErrorFull': virterror.c:1062: error: the address of 'msgDetailBuf' will always evaluate as 'true' Good catch. I've just committed this: From 2bb6830c061a580328abf4647a26b9ecc7f7eaa1 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 13:25:16 +0100 Subject: [PATCH] virterror.c: don't read beyond end of buffer upon OOM * src/virterror.c (virReportSystemErrorFull): Fix typo in my previous change. Patch by Daniel P. Berrange. --- src/virterror.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/virterror.c b/src/virterror.c index a577002..160fea3 100644 --- a/src/virterror.c +++ b/src/virterror.c @@ -1059,7 +1059,7 @@ void virReportSystemErrorFull(virConnectPtr conn, } } -if (!msgDetailBuf) +if (!msgDetail) msgDetail = errnoDetail; virRaiseError(conn, NULL, NULL, domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR, -- 1.6.1.401.gf39d5 -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] about libvirt-qpid on libvirt.org
On Tue, Jan 27, 2009 at 09:04:22PM +0900, Atsushi SAKAI wrote: Hi, Daniel It looks good for me. Ok, i committed that Daniel P. Berrange berra...@redhat.com wrote: On Tue, Jan 27, 2009 at 12:51:57PM +0900, Atsushi SAKAI wrote: Hi, I have a question about libvirt-qpid. The libvirt-qpid is working for QPID broker? If so, it should be added in livirt is section of following pages. http://libvirt.org/ How do you think? Yes, it should be listed - here is an updated front page, also added the User Mode Linux driver, and mentioning the Windows client support. I also added details of URI format to all the per-driver pages, since people often seem to ask about this Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] * POTFILES.in: update: remove src/lxc_conf.c; Add src/bridge.c.
make syntax-check broke. Here's the fix: From 5bfc2955253b173e13659104890448d427c5e716 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 16:27:07 +0100 Subject: [PATCH] * POTFILES.in: update: remove src/lxc_conf.c; Add src/bridge.c. --- po/POTFILES.in |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 49b72e7..401043a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,13 +1,13 @@ gnulib/lib/gai_strerror.c qemud/qemud.c qemud/remote.c +src/bridge.c src/conf.c src/console.c src/datatypes.c src/domain_conf.c src/iptables.c src/libvirt.c -src/lxc_conf.c src/lxc_container.c src/lxc_controller.c src/lxc_driver.c -- 1.6.1.1.363.g2a3bd -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] * POTFILES.in: update: remove src/lxc_conf.c; Add src/bridge.c.
On Tue, 2009-01-27 at 16:28 +0100, Jim Meyering wrote: make syntax-check broke. Here's the fix: Looks good, sorry. Seems I ran syntax-check before my patch, but not after. Doh. Thanks, Mark. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] use virReportOOMError, not VIR_ERR_NO_MEMORY
I've changed over 200 uses of some_error_function with the VIR_ERR_NO_MEMORY flag to call virReportOOMError with whatever conn-like argument (if any) was in the original call. I don't claim to have tested these changes (OOM is a pain to simulate, and besides, testing so many failure points would take more infrastructure than we have right now). However, I did automate most of the process. most of the changes were performed automatically via this: perl -0x0 -pi -e \ 's/\w+( ?)\(([\w-]+), *(?:(?:VIR_FROM_NONE|domcode|vm|dom|net|NULL), ?){0,3}VIR_ERR_NO_MEMORY,.*?\);/virReportOOMError$1($2);/sg' \ $(g grep -l VIR_ERR_NO_MEMORY|grep '\.c$'|grep -vF virterror.c) Exceptions: == Exceptions (as noted in ChangeLog) were to add the now-required definitions of VIR_FROM_THIS, as needed, e.g., #define VIR_FROM_THIS VIR_FROM_OPENVZ in openvz-related files. Also, I replaced uses of qparam_report_oom automatically: perl -pi -e 's/qparam_report_oom\(\);/virReportOOMError(NULL);/' \ src/qparams.c and removed the definition of that macro manually. I spotted and manually adjusted one misuse of VIR_ERR_NO_MEMORY: remote_internal.c: fix typo that would mistakenly report OOM * src/remote_internal.c (addrToString): Report VIR_ERR_UNKNOWN_HOST, not VIR_ERR_NO_MEMORY. ctxt in src/conf.c is not usable: perl -pi -e 's/virReportOOMError\(ctxt\);/virReportOOMError(NULL);/' \ src/conf.c I manually converted two uses of virSexprError(VIR_ERR_NO_MEMORY in src/sexpr.c. And of course, copyright dates were updated via an emacs write hook. The first iteration involved applying the perl-based xforms more of less file by file, and making sure everything still compiled. Once done, I repeated the process on a new branch, automating as much as possible, and then diff'd the branches. The diff was nearly empty, modulo copyright dates and added VIR_FROM_THIS definitions. I'm posting two small sort-of-different changes here. I'll post this big first one separately. From 099536470ae2cbe9503ed471d391e403fb2587a4 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 12:20:06 +0100 Subject: [PATCH 1/3] error-reporting calls using VIR_ERR_NO_MEMORY: use virReportOOMError instead * src/uml_conf.c (VIR_FROM_THIS): Define to VIR_FROM_UML. * src/xs_internal.c (VIR_FROM_THIS): Define to VIR_FROM_XEN. * src/xml.c (VIR_FROM_THIS): Define to VIR_FROM_XML. * src/stats_linux.c (VIR_FROM_THIS): Define to VIR_FROM_STATS_LINUX. * src/datatypes.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/lxc_conf.c (VIR_FROM_THIS): Define to VIR_FROM_LXC. * src/libvirt.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/node_device_conf.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/openvz_conf.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/openvz_driver.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/conf.c (VIR_FROM_THIS): Define to VIR_FROM_CONF. Note: this loses config_filename:config_lineno diagnostics, but that's ok. * src/node_device.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/sexpr.c (VIR_FROM_THIS): Define to VIR_FROM_SEXPR. --- ... From a223b8f6064e867d304df9a0a1498ef2940631ef Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 15:58:07 +0100 Subject: [PATCH 2/3] qparams.c: Use virReportOOMError(NULL), not qparam_report_oom() * src/qparams.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. (qparam_report_oom): Remove definition. Replace all uses. --- src/qparams.c | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/qparams.c b/src/qparams.c index 22c5853..d0a84b3 100644 --- a/src/qparams.c +++ b/src/qparams.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Red Hat, Inc. +/* Copyright (C) 2007, 2009 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 @@ -33,9 +33,7 @@ #include memory.h #include qparams.h -#define qparam_report_oom(void) \ -virReportErrorHelper(NULL, VIR_FROM_NONE, VIR_ERR_NO_MEMORY, \ - __FILE__, __FUNCTION__, __LINE__, NULL) +#define VIR_FROM_THIS VIR_FROM_NONE struct qparam_set * new_qparam_set (int init_alloc, ...) @@ -47,14 +45,14 @@ new_qparam_set (int init_alloc, ...) if (init_alloc = 0) init_alloc = 1; if (VIR_ALLOC(ps) 0) { -qparam_report_oom(); +virReportOOMError(NULL); return NULL; } ps-n = 0; ps-alloc = init_alloc; if (VIR_ALLOC_N(ps-p, ps-alloc) 0) { VIR_FREE (ps); -qparam_report_oom(); +virReportOOMError(NULL); return NULL; } @@ -98,7 +96,7 @@ grow_qparam_set (struct qparam_set *ps) { if (ps-n = ps-alloc) { if (VIR_REALLOC_N(ps-p, ps-alloc * 2) 0) { -qparam_report_oom(); +virReportOOMError(NULL); return
Re: [libvirt] PATCH: Support storage copy on write volumes
Daniel P. Berrange berra...@redhat.com wrote: On Thu, Jan 22, 2009 at 07:15:19PM +0100, Jim Meyering wrote: Daniel P. Berrange berra...@redhat.com wrote: ... Did that, and likewise the similar allocation a little above this chunk ... All looks fine. ACK. You'll have noticed that the fix below is already committed. diff --git a/src/virterror.c b/src/virterror.c --- a/src/virterror.c +++ b/src/virterror.c @@ -1059,7 +1059,7 @@ void virReportSystemErrorFull(virConnect } } -if (!msgDetailBuf) +if (!msgDetail) msgDetail = errnoDetail; virRaiseError(conn, NULL, NULL, domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR, -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Clock problems with Windows guests and Xen
When I start Windows guests with libvirt my clocks are 5 hours off. When I use a Xen configuration file, I can specify an offset (rtc_timeoffset = -18000) to get my clock to sync with the host. Is there a way to do specify this offset in XML with libvirt? Right now, I'm using version 0.4.4 but I downloaded the source for 0.5.1 and it looks like that part of domain_conf.c hasn't changed. Thanks for any help! -matthew -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Clock problems with Windows guests and Xen
On Tue, Jan 27, 2009 at 01:33:21PM -0500, Matthew Donovan wrote: When I start Windows guests with libvirt my clocks are 5 hours off. When I use a Xen configuration file, I can specify an offset (rtc_timeoffset = -18000) to get my clock to sync with the host. Is there a way to do specify this offset in XML with libvirt? Right now, I'm using version 0.4.4 but I downloaded the source for 0.5.1 and it looks like that part of domain_conf.c hasn't changed. Sounds like you have the wrong clock offset setting, in the XML. There are two options: clock offset=localtime/ clock offset=utc/ Usually for Windows you want the 'localtime' one since it is dumb at time keeping DST shifts. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] proxy: Fix use of uninitalized memory
On short read, members of packet header are checked before actually read. If uninitialized values can pass the test, they can be set to arbitrary values while reading remaining portion of a packet. Buffer overflow is possible. libvirt_proxy is suid-root. diff -urp libvirt-0.5.1/proxy/libvirt_proxy.c libvirt-dev/proxy/libvirt_proxy.c --- libvirt-0.5.1/proxy/libvirt_proxy.c 2008-11-20 08:58:43.0 +0100 +++ libvirt-dev/proxy/libvirt_proxy.c 2009-01-25 12:51:33.0 +0100 @@ -385,7 +385,8 @@ retry: fprintf(stderr, read %d bytes from client %d on socket %d\n, ret, nr, pollInfos[nr].fd); -if ((req-version != PROXY_PROTO_VERSION) || +if ((ret != sizeof(virProxyPacket)) || +(req-version != PROXY_PROTO_VERSION) || (req-len sizeof(virProxyPacket)) || (req-len sizeof(virProxyFullPacket))) goto comm_error; -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Clock problems with Windows guests and Xen
On Tue, Jan 27, 2009 at 01:33:21PM -0500, Matthew Donovan wrote: When I start Windows guests with libvirt my clocks are 5 hours off. When I use a Xen configuration file, I can specify an offset (rtc_timeoffset = -18000) to get my clock to sync with the host. Is there a way to do specify this offset in XML with libvirt? Right now, I'm using version 0.4.4 but I downloaded the source for 0.5.1 and it looks like that part of domain_conf.c hasn't changed. Sounds like you have the wrong clock offset setting, in the XML. There are two options: clock offset=localtime/ clock offset=utc/ Usually for Windows you want the 'localtime' one since it is dumb at time keeping DST shifts. Daniel That seems to have done it. Thanks! -matthew -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] PATCH: Support storage copy on write volumes
On Tue, Jan 27, 2009 at 05:59:37PM +0100, Jim Meyering wrote: Daniel P. Berrange berra...@redhat.com wrote: On Thu, Jan 22, 2009 at 07:15:19PM +0100, Jim Meyering wrote: Daniel P. Berrange berra...@redhat.com wrote: ... Did that, and likewise the similar allocation a little above this chunk ... All looks fine. ACK. I've commited this COW file suport now. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] use virReportOOMError, not VIR_ERR_NO_MEMORY
On Tue, Jan 27, 2009 at 04:57:58PM +0100, Jim Meyering wrote: I've changed over 200 uses of some_error_function with the VIR_ERR_NO_MEMORY flag to call virReportOOMError with whatever conn-like argument (if any) was in the original call. I don't claim to have tested these changes (OOM is a pain to simulate, and besides, testing so many failure points would take more infrastructure than we have right now). We do ability to test OOM handling on any of our current test cases, via the --enable-test-oom configure option, and then setting VIR_TEST_OOM=1 when running a test. I don't run it automatically though, since it kills performance of my personal server doing the nightly builds. Basically any time we add more unit test cases, we should automatically improve OOM testing coverage. From 099536470ae2cbe9503ed471d391e403fb2587a4 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 12:20:06 +0100 Subject: [PATCH 1/3] error-reporting calls using VIR_ERR_NO_MEMORY: use virReportOOMError instead * src/uml_conf.c (VIR_FROM_THIS): Define to VIR_FROM_UML. * src/xs_internal.c (VIR_FROM_THIS): Define to VIR_FROM_XEN. * src/xml.c (VIR_FROM_THIS): Define to VIR_FROM_XML. * src/stats_linux.c (VIR_FROM_THIS): Define to VIR_FROM_STATS_LINUX. * src/datatypes.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/lxc_conf.c (VIR_FROM_THIS): Define to VIR_FROM_LXC. * src/libvirt.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/node_device_conf.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/openvz_conf.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/openvz_driver.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/conf.c (VIR_FROM_THIS): Define to VIR_FROM_CONF. Note: this loses config_filename:config_lineno diagnostics, but that's ok. * src/node_device.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/sexpr.c (VIR_FROM_THIS): Define to VIR_FROM_SEXPR. ACK From a223b8f6064e867d304df9a0a1498ef2940631ef Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 15:58:07 +0100 Subject: [PATCH 2/3] qparams.c: Use virReportOOMError(NULL), not qparam_report_oom() * src/qparams.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. (qparam_report_oom): Remove definition. Replace all uses. ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] use virReportOOMError, not VIR_ERR_NO_MEMORY
On Tue, Jan 27, 2009 at 04:59:20PM +0100, Jim Meyering wrote: Here's the big one: From 099536470ae2cbe9503ed471d391e403fb2587a4 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 12:20:06 +0100 Subject: [PATCH 1/3] error-reporting calls using VIR_ERR_NO_MEMORY: use virReportOOMError instead * src/uml_conf.c (VIR_FROM_THIS): Define to VIR_FROM_UML. * src/xs_internal.c (VIR_FROM_THIS): Define to VIR_FROM_XEN. * src/xml.c (VIR_FROM_THIS): Define to VIR_FROM_XML. * src/stats_linux.c (VIR_FROM_THIS): Define to VIR_FROM_STATS_LINUX. * src/datatypes.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/lxc_conf.c (VIR_FROM_THIS): Define to VIR_FROM_LXC. * src/libvirt.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/node_device_conf.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/openvz_conf.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/openvz_driver.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/conf.c (VIR_FROM_THIS): Define to VIR_FROM_CONF. Note: this loses config_filename:config_lineno diagnostics, but that's ok. * src/node_device.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/sexpr.c (VIR_FROM_THIS): Define to VIR_FROM_SEXPR. ACK. After a quick run through the patch I don't see any problems hiding there - well at least none which weren't already present. I see this is PATCH 1/3, but you've not sent a #2 or #3 in this series to the list ?!?! We should add a Makefile.maint rule to prohibit use of VIR_ERR_NO_MEMORY in any file except virterror.c Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] use virReportOOMError, not VIR_ERR_NO_MEMORY
Daniel P. Berrange berra...@redhat.com wrote: On Tue, Jan 27, 2009 at 04:59:20PM +0100, Jim Meyering wrote: Here's the big one: From 099536470ae2cbe9503ed471d391e403fb2587a4 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 27 Jan 2009 12:20:06 +0100 Subject: [PATCH 1/3] error-reporting calls using VIR_ERR_NO_MEMORY: use virReportOOMError instead * src/uml_conf.c (VIR_FROM_THIS): Define to VIR_FROM_UML. * src/xs_internal.c (VIR_FROM_THIS): Define to VIR_FROM_XEN. * src/xml.c (VIR_FROM_THIS): Define to VIR_FROM_XML. * src/stats_linux.c (VIR_FROM_THIS): Define to VIR_FROM_STATS_LINUX. * src/datatypes.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/lxc_conf.c (VIR_FROM_THIS): Define to VIR_FROM_LXC. * src/libvirt.c (VIR_FROM_THIS): Define to VIR_FROM_NONE. * src/node_device_conf.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/openvz_conf.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/openvz_driver.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ. * src/conf.c (VIR_FROM_THIS): Define to VIR_FROM_CONF. Note: this loses config_filename:config_lineno diagnostics, but that's ok. * src/node_device.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV. * src/sexpr.c (VIR_FROM_THIS): Define to VIR_FROM_SEXPR. ACK. After a quick run through the patch I don't see any problems hiding there - well at least none which weren't already present. Thanks. I see this is PATCH 1/3, but you've not sent a #2 or #3 in this series to the list ?!?! It looks like you ACK'd the other two, in Message-ID: 20090127203433.ge...@redhat.com We should add a Makefile.maint rule to prohibit use of VIR_ERR_NO_MEMORY in any file except virterror.c Yes, I'll definitely do that. After merging with your recent cow-support patch, I spotted/converted two new uses. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] patch: allow disk cache mode to be specified in a domain's xml definition.
Daniel P. Berrange wrote: If you loook at src/qemu_conf.c, you'll find a nice method called qemudExtractVersionInfo, which runs 'qemu -help' and checks for certain interesting command line arguments :-) That problem does seem to be crying for some type of structured interface to avoid subtle breakage should someone modify the output of --help. I'm sure I'm preaching to the choir here. So it now adapts for the cases of old syntax and writethrough as well as new syntax and on since qemu will otherwise balk at those cache flag / version combinations. One note about the enums - rather than adding old style CACHEON CACHE_OFF options to the main enum in domain_conf, just create a second enum in the qemu_conf.c file for recording the mapping of virDomainDiskCache values to old style QEMU arguments values.. As we are adapting in both directions I left the single enum representing the entire option list to simplify things. Updated patch is attached. -john -- john.coo...@redhat.com domain_conf.c | 31 --- domain_conf.h | 16 qemu_conf.c | 40 +++- qemu_conf.h |1 + 4 files changed, 76 insertions(+), 12 deletions(-) = --- a/src/domain_conf.h +++ b/src/domain_conf.h @@ -80,6 +80,21 @@ enum virDomainDiskBus { VIR_DOMAIN_DISK_BUS_LAST }; +/* summary of all possible host open file cache modes + */ +typedef enum { +VIR_DOMAIN_DISK_CACHE_UNSPECIFIED, /* reserved */ +VIR_DOMAIN_DISK_CACHE_OFF, +VIR_DOMAIN_DISK_CACHE_ON, +VIR_DOMAIN_DISK_CACHE_DISABLE, +VIR_DOMAIN_DISK_CACHE_WRITEBACK, +VIR_DOMAIN_DISK_CACHE_WRITETHRU, + +VIR_DOMAIN_DISK_CACHE_LAST +} virDomainDiskCache; + +VIR_ENUM_DECL(virDomainDiskCache) + /* Stores the virtual disk configuration */ typedef struct _virDomainDiskDef virDomainDiskDef; typedef virDomainDiskDef *virDomainDiskDefPtr; @@ -91,6 +106,7 @@ struct _virDomainDiskDef { char *dst; char *driverName; char *driverType; +int cachemode; unsigned int readonly : 1; unsigned int shared : 1; int slotnum; /* pci slot number for unattach */ = --- a/src/qemu_conf.c +++ b/src/qemu_conf.c @@ -449,7 +449,9 @@ int qemudExtractVersionInfo(const char * if (strstr(help, -domid)) flags |= QEMUD_CMD_FLAG_DOMID; if (strstr(help, -drive)) -flags |= QEMUD_CMD_FLAG_DRIVE; +flags |= QEMUD_CMD_FLAG_DRIVE | +(strstr(help, cache=writethrough|writeback|none) ? +QEMUD_CMD_FLAG_DRIVE_CACHEMODE : 0); if (strstr(help, boot=on)) flags |= QEMUD_CMD_FLAG_DRIVE_BOOT; if (version = 9000) @@ -616,6 +618,20 @@ qemudNetworkIfaceConnect(virConnectPtr c return NULL; } +/* map from internal cache mode to qemu cache arg text + * + * Note: currently this replicates virDomainDiskCache, but will need to + * error flag potential new entries in virDomainDiskCache which are + * not supported by qemu (raising exceptions as appropriate). + */ +VIR_ENUM_IMPL(qemu_cache_map, VIR_DOMAIN_DISK_CACHE_LAST, +, /* reserved -- mode not specified */ +off, /* depreciated by none */ +on, /* obsolete by writethrough */ +none, +writeback, +writethrough) + static int qemudBuildCommandLineChrDevStr(virDomainChrDefPtr dev, char *buf, int buflen) @@ -721,6 +737,7 @@ int qemudBuildCommandLine(virConnectPtr const char *emulator; char uuid[VIR_UUID_STRING_BUFLEN]; char domid[50]; +unsigned int qf; uname(ut); @@ -946,6 +963,7 @@ int qemudBuildCommandLine(virConnectPtr virDomainDiskDefPtr disk = vm-def-disks[i]; int idx = virDiskNameToIndex(disk-dst); const char *bus = virDomainDiskQEMUBusTypeToString(disk-bus); +int nc, cachemode; if (disk-bus == VIR_DOMAIN_DISK_BUS_USB) { if (disk-device == VIR_DOMAIN_DISK_DEVICE_DISK) { @@ -980,15 +998,27 @@ int qemudBuildCommandLine(virConnectPtr break; } -snprintf(opt, PATH_MAX, file=%s,if=%s,%sindex=%d%s%s, +nc = snprintf(opt, PATH_MAX, file=%s,if=%s,%sindex=%d%s, disk-src ? disk-src : , bus, media ? media : , idx, bootable disk-device == VIR_DOMAIN_DISK_DEVICE_DISK - ? ,boot=on : , - disk-shared ! disk-readonly - ? ,cache=off : ); + ? ,boot=on : ); + +if (cachemode = disk-cachemode) { +if (qemudExtractVersionInfo(vm-def-emulator, NULL, qf) 0) +;/* error reported */ +else if (!(qf
[libvirt] libvirt for rhel-5?
hi, is there any plan to be able to buils libvirt on rhel-5 ie. epel-5? currently all virt and kvm releated packages can be build on epel except libvirt since this dbus problem. thanks in advance. -- gcc -I../gnulib/lib -I../gnulib/lib -I../include -I../include -I../src -I/usr/include/libxml2 -Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -DLOCAL_STATE_DIR=\/var\ -DSYSCONF_DIR=\/etc\ -DQEMUD_PID_FILE=\\ -DREMOTE_PID_FILE=\/var/run/libvirtd.pid\ -DGETTEXT_PACKAGE=\libvirt\ -D_REENTRANT -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -o .libs/libvirtd libvirtd-event.o libvirtd-qemud.o libvirtd-remote.o libvirtd-remote_protocol.o libvirtd-mdns.o ../gnulib/lib/.libs/libgnu.a ../src/.libs/libvirt_driver_qemu.a ../src/.libs/libvirt_driver_lxc.a ../src/.libs/libvirt_driver_uml.a ../src/.libs/libvirt_driver_storage.a ../src/.libs/libvirt_driver_network.a ../src/.libs/libvirt_driver_nodedev.a -L/lib64 -lhal -ldbus-1 ../src/.libs/libvirt.so -lxml2 -lz -lm -lselinux -lgnutls -lsasl2 -lxenstore -lavahi-common -lavahi-client -lpthread ../src/.libs/libvirt_driver_nodedev.a(libvirt_driver_nodedev_la-node_device_hal.o): In function `add_dbus_watch': /home/robot/rpm/BUILD/libvirt-0.5.1/src/node_device_hal.c:578: undefined reference to `dbus_watch_get_unix_fd' collect2: ld returned 1 exit status make[2]: *** [libvirtd] Error 1 make[2]: Leaving directory `/home/robot/rpm/BUILD/libvirt-0.5.1/qemud' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/robot/rpm/BUILD/libvirt-0.5.1' make: *** [all] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.39202 (%build) -- -- Levente Si vis pacem para bellum! -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix misuse of PF_UNIX
# HG changeset patch # User john.le...@sun.com # Date 1233105335 28800 # Node ID b3a2537e2f3d5ccb055df1820c112b469a26efdb # Parent 35f5d4f77a3f50cadacf32100fdbd992394f6002 Fix misuse of PF_UNIX PF_UNIX is a protocol familay, not a valid protocol, so isn't suitable for the 3rd socket() argument. Solaris should be ignoring the invalid protocol anyway, but this fix is correct regardless. Signed-off-by: John Levon john.le...@sun.com diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -752,7 +752,11 @@ xenDaemonOpen_unix(virConnectPtr conn, c memset(priv-addr, 0, sizeof(priv-addr)); priv-addrfamily = AF_UNIX; -priv-addrprotocol = PF_UNIX; +/* + * This must be zero on Solaris at least for AF_UNIX (which should + * really be PF_UNIX, but doesn't matter). + */ +priv-addrprotocol = 0; priv-addrlen = sizeof(struct sockaddr_un); addr = (struct sockaddr_un *)priv-addr; -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] trivial libvirt example code
Jim Meyering wrote: Dave Allan dal...@redhat.com wrote: Richard W.M. Jones wrote: On Fri, Jan 23, 2009 at 02:51:02PM -0500, Dave Allan wrote: The examples directory doesn't have a trivial example of how to connect to a hypervisor, make a few calls, and disconnect, so I put one together. I would appreciate any suggestions on anything that I've done wrong as well as suggestions for other fundamental API calls that should be illustrated. Yes, I checked this example code and it is fine. My only comment would be on: +/* virConnectOpenAuth called here with all default parameters */ +conn = virConnectOpenAuth(NULL, virConnectAuthPtrDefault, 0); It might be better to let people connect to a named URI. Another possibility is to default to the test URI (test:///default) since that (almost) always exists. Hi Rich, Thanks for taking a look at it. I added a little code to let the user specify a URI on the command line. Do you think it is worth committing? Hi Dave, I like your example. Thanks for preparing it. Here are some suggestions: Thanks for the style suggestions--that's one of the reasons I was sending the code around. diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c new file mode 100644 index 000..22d3309 --- /dev/null +++ b/examples/hellolibvirt/hellolibvirt.c @@ -0,0 +1,151 @@ +/* This file contains trivial example code to connect to the running + * hypervisor and gather a few bits of information. */ + +#include stdio.h +#include stdlib.h +#include libvirt/libvirt.h + +static int +showHypervisorInfo(virConnectPtr conn) +{ +int ret = 0; +unsigned long hvVer, major, minor, release; +const char *hvType; + +/* virConnectGetType returns a pointer to a static string, so no + * allocation or freeing is necessary; it is possible for the call + * to fail if, for example, there is no connection to a + * hypervisor, so check what it returns. */ +hvType = virConnectGetType(conn); +if (NULL == hvType) { +ret = 1; +printf(Failed to get hypervisor type\n); +goto out; +} + +if (0 != virConnectGetVersion(conn, hvVer)) { +ret = 1; +printf(Failed to get hypervisor version\n); +goto out; +} + +major = hvVer / 100; +hvVer %= 100; +minor = hvVer / 1000; +release = hvVer % 1000; + +printf(Hypervisor: \%s\ version: %lu.%lu.%lu\n, + hvType, + major, + minor, + release); + How about initializing ret = 1 above and setting ret = 0 here to indicate success? It's a close call, since that results in removal of only two ret = 1 assignments. In this case, I think that the error cases are very unlikely, so I made the initialization 0, but I agree, it could go either way. I left it as is for now. +out: +return ret; +} + + +static int +showDomains(virConnectPtr conn) +{ +int ret = 0, i, numNames, numInactiveDomains, numActiveDomains; +char **nameList = NULL; + +numActiveDomains = virConnectNumOfDomains(conn); +numInactiveDomains = virConnectNumOfDefinedDomains(conn); It'd be good to handle numInactiveDomains 0 differently. Currently it'll probably provoke a failed malloc, below. Doh--thanks. I missed that those calls could fail. +printf(There are %d active and %d inactive domains\n, + numActiveDomains, numInactiveDomains); + +nameList = malloc(sizeof(char *) * (unsigned int)numInactiveDomains); Using the target variable name rather than the type is a little more maintainable, in general, so set a good example: And please drop the cast. We hate casts, and besides, it's not needed. nameList = malloc(sizeof(*nameList) * numInactiveDomains); Thanks on sizeof(char *) vs. sizeof(*nameList)--fixed. The cast was there because virConnectNumOfDefinedDomains returns a signed value to allow for returning -1 on error, but malloc expects an unsigned argument. gcc 4.3 -Wconversion complains about this situation [different behavior from gcc 4.3] I've turned off that warning and removed the cast. +if (NULL == nameList) { +ret = 1; +printf(Could not allocate memory for list of inactive domains\n); +goto out; +} + +numNames = virConnectListDefinedDomains(conn, +nameList, +numInactiveDomains); + +if (-1 == numNames) { +ret = 1; +printf(Could not get list of defined domains from hypervisor\n); +goto out; +} + +if (numNames 0) { +printf(Inactive domains:\n); +} + +for (i = 0 ; i numNames ; i++) { +printf( %s\n, *(nameList + i)); +/* The API documentation doesn't say so, but the names + * returned by virConnectListDefinedDomains are strdup'd and + * must be freed here. */ +free(*(nameList + i)); +} Here's another case where you
[libvirt] [PATCH] Install schemas into correct location for Solaris
# HG changeset patch # User john.le...@sun.com # Date 1233119659 28800 # Node ID cc848242fa810e8d0126b651849de715c7ef32e4 # Parent f91041f0c607be72c4b5695f081d20716521f6c5 Install schemas into correct location for Solaris Signed-off-by: John Levon john.le...@sun.com diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -141,6 +141,10 @@ if test -n $UDEVSETTLE; then AC_DEFINE_UNQUOTED([UDEVSETTLE],[$UDEVSETTLE], [Location or name of the udevsettle program]) fi + +SCHEMA_DIR=${pkgdatadir}/schemas +test `uname -s` = SunOS SCHEMA_DIR=${datadir}/lib/xml/rng/libvirt +AC_SUBST([SCHEMA_DIR]) dnl Specific dir for HTML output ? AC_ARG_WITH([html-dir], [AC_HELP_STRING([--with-html-dir=path], diff --git a/docs/schemas/Makefile.am b/docs/schemas/Makefile.am --- a/docs/schemas/Makefile.am +++ b/docs/schemas/Makefile.am @@ -1,6 +1,7 @@ -schemadir = $(pkgdatadir)/schemas +schemadir = $(SCHEMA_DIR) + schema_DATA = \ domain.rng \ network.rng \ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fixes for VNC port handling
# HG changeset patch # User john.le...@sun.com # Date 1233118371 28800 # Node ID f91041f0c607be72c4b5695f081d20716521f6c5 # Parent 8fce2ce6108eb1ff1865ecc21d57114db036f2a2 Fixes for VNC port handling When parsing sexpr, the VNC port should not be ignored, even when vncunused is set. Fix the parsing of vncdisplay, which was broken due to strtol() (never use this function!). Signed-off-by: John Levon john.le...@sun.com diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -612,7 +612,9 @@ sexpr_get(virConnectPtr xend, const char * * convenience function to lookup an int value in the S-Expression * - * Returns the value found or 0 if not found (but may not be an error) + * Returns the value found or 0 if not found (but may not be an error). + * This function suffers from the flaw that zero is both a correct + * return value and an error indicator: careful! */ static int sexpr_int(const struct sexpr *sexpr, const char *name) @@ -2091,15 +2093,16 @@ xenDaemonParseSxprGraphicsNew(virConnect port = xenStoreDomainGetVNCPort(conn, def-id); xenUnifiedUnlock(priv); +// Didn't find port entry in xenstore if (port == -1) { -// Didn't find port entry in xenstore -port = sexpr_int(node, device/vfb/vncdisplay); +const char *value = sexpr_node(node, +device/vfb/vncdisplay); +if (value != NULL) +port = strtol(value, NULL, 0); } -if ((unused STREQ(unused, 1)) || port == -1) { +if ((unused STREQ(unused, 1)) || port == -1) graphics-data.vnc.autoport = 1; -port = -1; -} if (port = 0 port 5900) port += 5900; diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.sexpr b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.sexpr new file mode 100644 --- /dev/null +++ b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.sexpr @@ -0,0 +1,85 @@ +(domain +(domid 21) +(on_crash destroy) +(uuid e0c172e6-4ad8-7353-0ece-515d2f181365) +(bootloader_args ) +(vcpus 1) +(name domu-224) +(on_poweroff destroy) +(on_reboot destroy) +(bootloader ) +(maxmem 512) +(memory 512) +(shadow_memory 5) +(cpu_weight 256) +(cpu_cap 0) +(features ) +(on_xend_start ignore) +(on_xend_stop shutdown) +(start_time 1233108538.42) +(cpu_time 907.159661051) +(online_vcpus 1) +(image +(hvm +(kernel /usr/lib/xen/boot/hvmloader) +(boot d) +(device_model /usr/lib/xen/bin/qemu-dm) +(keymap en-us) +(localtime 1) +(pae 1) +(serial pty) +(usb 1) +(usbdevice tablet) +(notes (SUSPEND_CANCEL 1)) +) +) +(status 2) +(state r-) +(store_mfn 131070) +(device +(vif +(bridge e1000g0) +(mac 00:16:3e:1b:e8:18) +(script vif-vnic) +(uuid 7da8c614-018b-dc87-6bfc-a296a95bca4f) +(backend 0) +) +) +(device +(vbd +(uname phy:/iscsi/winxp) +(uuid 65e19258-f4a2-a9ff-3b31-469ceaf4ec8d) +(mode w) +(dev hda:disk) +(backend 0) +(bootable 1) +) +) +(device +(vbd +(uname file:/net/heaped/export/netimage/windows/xp-sp2-vol.iso) +(uuid 87d9383b-f0ad-11a4-d668-b965f55edc3f) +(mode r) +(dev hdc:cdrom) +(backend 0) +(bootable 0) +) +) +(device (vkbd (backend 0))) +(device +(vfb +(vncunused 1) +(keymap en-us) +(type vnc) +(uuid 09666ad1-0c94-d79c-1439-99e05394ee51) +(location localhost:5900) +) +) +(device +(console +(protocol vt100) +(location 3) +(uuid cabfc0f5-1c9c-0e6f-aaa8-9974262aff66) +) +) +) diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml new file mode 100644 --- /dev/null +++ b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml @@ -0,0 +1,48 @@ +domain type='xen' id='21' + namedomu-224/name + uuide0c172e6-4ad8-7353-0ece-515d2f181365/uuid + memory524288/memory + currentMemory524288/currentMemory + vcpu1/vcpu + os +typehvm/type +loader/usr/lib/xen/boot/hvmloader/loader +boot dev='cdrom'/ + /os + features +pae/ + /features + clock offset='localtime'/ + on_poweroffdestroy/on_poweroff + on_rebootdestroy/on_reboot + on_crashdestroy/on_crash + devices +emulator/usr/lib/xen/bin/qemu-dm/emulator +disk type='block' device='disk' + driver name='phy'/ + source