Re: [libvirt] Compiling libvirt RPC client library for QNX
Panday Ritesh Sharma (rpanday) wrote: Thanks Roman for your response. Few questions which are not answered in that link. As I mentioned, my intent is to get only libvirt client library on QNX side not the whole libvirt. The libvirt daemon will still be running on linux box. The QNX machine will only be sending the request to define/start/destroy the domain and would be interested in getting lifecycle event. In that case do I need to compile whole libvirt which is down loaded or only subset of that suffice ? If only subset is needed, what are those ? You can specify features to compile in via ./configure flags, e.g. you could disable building of libvirtd using '--without-libvirtd' flag. Please check the output of ./configure --help. Can you please pass me the link where I could get latest libvirt, as you said 0.9.8 is quite old. JFYI, my linux box is running below host version so I would need compatible libvirt. You can find download links here: http://libvirt.org/downloads.html Roman Bogorodskiy -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] bhyve: implement node information reporting
- Implement nodeGetCPUStats using nodeGetCPUStats() - Implement nodeGetMemoryStats using nodeGetMemoryStats() --- src/bhyve/bhyve_driver.c | 29 + 1 file changed, 29 insertions(+) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 7c6500f..35171d2 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -48,6 +48,7 @@ #include virstring.h #include cpu/cpu.h #include viraccessapicheck.h +#include nodeinfo.h #include bhyve_driver.h #include bhyve_process.h @@ -497,6 +498,32 @@ cleanup: } static int +bhyveNodeGetCPUStats(virConnectPtr conn, + int cpuNum, + virNodeCPUStatsPtr params, + int *nparams, + unsigned int flags) +{ +if (virNodeGetCPUStatsEnsureACL(conn) 0) +return -1; + +return nodeGetCPUStats(cpuNum, params, nparams, flags); +} + +static int +bhyveNodeGetMemoryStats(virConnectPtr conn, + int cellNum, + virNodeMemoryStatsPtr params, + int *nparams, + unsigned int flags) +{ +if (virNodeGetMemoryStatsEnsureACL(conn) 0) +return -1; + +return nodeGetMemoryStats(cellNum, params, nparams, flags); +} + +static int bhyveStateCleanup(void) { VIR_DEBUG(bhyve state cleanup); @@ -594,6 +621,8 @@ static virDriver bhyveDriver = { .domainLookupByName = bhyveDomainLookupByName, /* 1.2.2 */ .domainDefineXML = bhyveDomainDefineXML, /* 1.2.2 */ .domainGetXMLDesc = bhyveDomainGetXMLDesc, /* 1.2.2 */ +.nodeGetCPUStats = bhyveNodeGetCPUStats, /* 1.2.2 */ +.nodeGetMemoryStats = bhyveNodeGetMemoryStats, /* 1.2.2 */ }; -- 1.8.4.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Entering freeze for libvirt-1.2.2
what about this patch: [PATCH] lxc: Add virCgroupSetOwner() http://thread.gmane.org/gmane.comp.emulators.libvirt/92811 without this patch lxc + user namespace does not works with systemd /stephan -- Software is like sex, it's better when it's free! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix memory leak when lookup pool list with invalid type option
On Mon, Feb 24, 2014 at 02:12:34PM +0800, shyu wrote: There will be memory leak when lookup pool list with invalid type option https://bugzilla.redhat.com/show_bug.cgi?id=1069068 ==23060== Memcheck, a memory error detector ==23060== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==23060== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==23060== Command: virsh pool-list --type invalid ==23060== error: Invalid pool type ==23060== ==23060== HEAP SUMMARY: ==23060== in use at exit: 138,383 bytes in 1,559 blocks ==23060== total heap usage: 4,199 allocs, 2,640 frees, 21,372,544 bytes allocated ==23060== ==23060== LEAK SUMMARY: ==23060==definitely lost: 8 bytes in 1 blocks ==23060==indirectly lost: 0 bytes in 0 blocks ==23060== possibly lost: 0 bytes in 0 blocks ==23060==still reachable: 138,375 bytes in 1,558 blocks ==23060== suppressed: 0 bytes in 0 blocks ==23060== Rerun with --leak-check=full to see details of leaked memory ==23060== ==23060== For counts of detected and suppressed errors, rerun with: -v ==23060== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 6) This info is useless since there is no information about the leak. You should've included this kind of info instead: ==2472== 5 bytes in 1 blocks are definitely lost in loss record 5 of 84 ==2472==at 0x4A069EE: malloc (vg_replace_malloc.c:270) ==2472==by 0x3B88281171: strdup (strdup.c:43) ==2472==by 0x40EB40: _vshStrdup (virsh.c:129) ==2472==by 0x40FC68: vshStringToArray (virsh.c:182) ==2472==by 0x42A9F9: cmdPoolList (virsh-pool.c:857) ==2472==by 0x40D240: vshCommandRun (virsh.c:1652) ==2472==by 0x410B4A: main (virsh.c:3093) Signed-off-by: shyu s...@redhat.com --- tools/virsh-pool.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 642b078..db4d3ae 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -859,6 +859,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) for (i = 0; i npoolTypes; i++) { if ((poolType = virStoragePoolTypeFromString(poolTypes[i])) 0) { vshError(ctl, %s, _(Invalid pool type)); +VIR_FREE(*poolTypes); This does not properly free all the poolTypes in case this doesn't fails with i 0. VIR_FREE(poolTypes); And judging by the code, this is not upstream at all, right? I guess this is not applicable upstream for half a year already, at least. Please submit patches that apply on top of current master when cloning from git://libvirt.org/libvirt.git . Thanks for your effort, but I believe this is already fixed within commit d64af6ce as I already commented in the Bug you referenced. Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Document the keyboard as a valid input type
Commit bc18373 added a new input type, but didn't change the documentation. --- docs/formatdomain.html.in | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ea1a97b..400de07 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3847,15 +3847,16 @@ qemu-kvm -net nic,model=? /dev/null ... lt;devicesgt; lt;input type='mouse' bus='usb'/gt; +lt;input type='keyboard' bus='usb'/gt; lt;/devicesgt; .../pre dl dtcodeinput/code/dt ddThe codeinput/code element has one mandatory attribute, -the codetype/code whose value can be either 'mouse' or -'tablet'. The latter provides absolute -cursor movement, while the former uses relative movement. The optional +the codetype/code whose value can be 'mouse', 'tablet' or +'keyboard'. The tablet provides absolute cursor movement, +while the mouse uses relative movement. The optional codebus/code attribute can be used to refine the exact device type. It takes values xen (paravirtualized), ps2 and usb./dd /dl -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Entering freeze for libvirt-1.2.2
On Mon, Feb 24, 2014 at 09:46:55AM +0100, Stephan Sachse wrote: what about this patch: [PATCH] lxc: Add virCgroupSetOwner() http://thread.gmane.org/gmane.comp.emulators.libvirt/92811 without this patch lxc + user namespace does not works with systemd /stephan That's small enough and fixing an use case, so assuming that someone like Dan ACk in, then it could go in IMHO Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veill...@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/3] libvirt-guests: Wait for libirtd to initialize
On 21.02.2014 18:28, Eric Blake wrote: On 02/21/2014 05:32 AM, Michal Privoznik wrote: s/libirtd/libvirtd/ in subject I've noticed that in some cases systemd was quick enough and even if libvirt-guests.service is marked to be started after the libvirtd.service my guests were not resumed as libvirt-guests.sh failed to connect. This is because of a simple fact: systemd correctly starts libvirt-guests after it execs libvirtd. However, the daemon is not able to accept connections right from the start. It's doing some initialization which may take ages. This problem is not limited to systemd only, indeed. Any init system that is able to startup services in parallel (e.g. OpenRC) may run into this situation. The fix is to try connecting not only once, but continuously a few times with a small sleep in between tries. +++ b/tools/libvirt-guests.sh.in @@ -37,6 +37,8 @@ SHUTDOWN_TIMEOUT=300 PARALLEL_SHUTDOWN=0 START_DELAY=0 BYPASS_CACHE=0 +CONNECT_RETRIES=10 +RETRIES_SLEEP=.5 fractional second sleep is a GNU sleep extension; it is not portable to all platforms. +fi +sleep ${RETRIES_SLEEP} You may need to rework this to be a bit more robust to a sleep failure, if sleep refuses to parse the fractional second. I've s/\.5/1/ and pushed. Thanks! Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v1 1/2] make qemu dump memory in kdump-compressed format
On Thu, Feb 20, 2014 at 10:30:31AM +0800, Qiao Nuohan wrote: --memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory in kdump-compressed format. This patch is used to add --compress and [--compression-format] string to virsh dump --memory-only and send dump-guest-memory command to qemu with dump format specified to one of elf, kdump-zlib, kdump-lzo and kdump-snappy. Signed-off-by: Qiao Nuohan qiaonuo...@cn.fujitsu.com --- include/libvirt/libvirt.h.in | 19 ++- src/qemu/qemu_driver.c | 20 src/qemu/qemu_monitor.c | 6 +++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 42 ++ 8 files changed, 83 insertions(+), 16 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..df62918 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1173,11 +1173,20 @@ typedef virDomainMemoryStatStruct *virDomainMemoryStatPtr; /* Domain core dump flags. */ typedef enum { -VIR_DUMP_CRASH= (1 0), /* crash after dump */ -VIR_DUMP_LIVE = (1 1), /* live dump */ -VIR_DUMP_BYPASS_CACHE = (1 2), /* avoid file system cache pollution */ -VIR_DUMP_RESET= (1 3), /* reset domain after dump finishes */ -VIR_DUMP_MEMORY_ONLY = (1 4), /* use dump-guest-memory */ +VIR_DUMP_CRASH = (1 0), /* crash after dump */ +VIR_DUMP_LIVE= (1 1), /* live dump */ +VIR_DUMP_BYPASS_CACHE= (1 2), /* avoid file system cache pollution */ +VIR_DUMP_RESET = (1 3), /* reset domain after dump finishes */ +VIR_DUMP_MEMORY_ONLY = (1 4), /* use dump-guest-memory */ +VIR_DUMP_COMPRESS_ZLIB = (1 5), /* dump guest memory in +kdump-compressed format, with +zlib-compressed */ +VIR_DUMP_COMPRESS_LZO= (1 6), /* dump guest memory in +kdump-compressed format, with +lzo-compressed */ +VIR_DUMP_COMPRESS_SNAPPY = (1 7), /* dump guest memory in +kdump-compressed format, with +snappy-compressed */ } virDomainCoreDumpFlags; I'm not really a fan of using flags for this, since all these new flags are mutually exclusive. This is a strong indication that they should not be flags, and instead be a separate parametere. So IMHO if we wnat to be able to specify a dump format we should have an explicit 'int dumpformat' parameter for it. Yes, I know this would involve a new API. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] bhyve: implement node information reporting
On Mon, Feb 24, 2014 at 12:30:38PM +0400, Roman Bogorodskiy wrote: - Implement nodeGetCPUStats using nodeGetCPUStats() - Implement nodeGetMemoryStats using nodeGetMemoryStats() --- src/bhyve/bhyve_driver.c | 29 + 1 file changed, 29 insertions(+) ACK Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH glib] Disable test suite unless glib = 2.38
On Thu, Feb 20, 2014 at 04:24:52PM +, Daniel P. Berrange wrote: diff --git a/tests/Makefile.am b/tests/Makefile.am index 56887ce..8cb98e5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,11 @@ +EXTRA_DIST = \ + xml/gconfig-domain.xml \ + xml/gconfig-domain-clock.xml \ + xml/gconfig-domain-os.xml \ + $(NULL) + +if ENABLE_TESTS + include $(top_srcdir)/build-aux/glib-tap.mk AM_CFLAGS = \ @@ -14,7 +22,9 @@ LDADD = \ test_programs = test-gconfig test-events -dist_test_data = \ - xml/gconfig-domain.xml \ - xml/gconfig-domain-clock.xml \ - xml/gconfig-domain-os.xml +else +EXTRA_DIST += \ + test-events.c \ + test-gconfig.c \ + $(NULL) +endif This is already committed, and not really important, but the else/endif block is not needed (on newer automake?) as when deciding which files to put in the tarball, it ignores the conditionals and picks all files which would be included for either value of the conditional. Christophe pgpAcAJi6zB7g.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib 0/2] Fix make distcheck
Hey, After the introduction of the GTest unit tests, make distcheck still has a few issues, with this series, make distcheck passes on my box (using glib 2.38). Christophe -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib 2/2] tests: Fix make distcheck
Some files are missing from EXTRA_DIST, causing make distcheck to fail when tests are enabled. --- Makefile.am | 2 ++ tests/Makefile.am | 10 ++ 2 files changed, 12 insertions(+) diff --git a/Makefile.am b/Makefile.am index 0eba6e2..ae8b06d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,6 +16,8 @@ EXTRA_DIST = $(PACKAGE).spec \ AUTHORS.in \ build-aux/check-symfile.pl \ build-aux/check-symsorting.pl \ +tap-driver.sh \ +tap-test \ $(NULL) DISTCLEAN_FILES = $(PACKAGE).spec $(pkgconfig_DATA) diff --git a/tests/Makefile.am b/tests/Makefile.am index 041415f..63865e8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,6 +19,16 @@ test_programs = test-gconfig test-events EXTRA_DIST += \ xml/gconfig-domain.xml \ xml/gconfig-domain-clock.xml \ + xml/gconfig-domain-cpu.xml \ + xml/gconfig-domain-device-channel.xml \ + xml/gconfig-domain-device-console.xml \ + xml/gconfig-domain-device-disk.xml \ + xml/gconfig-domain-device-graphics.xml \ + xml/gconfig-domain-device-input.xml \ + xml/gconfig-domain-device-network.xml \ + xml/gconfig-domain-device-sound.xml \ + xml/gconfig-domain-device-usbredir.xml \ + xml/gconfig-domain-device-video.xml \ xml/gconfig-domain-os.xml \ $(NULL) endif -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib 1/2] tests: Move EXTRA_DIST back into ENABLE_TESTS conditional
When deciding which files to put into the make dist tarball, automake is clever enough to ignore conditional blocks, and to pick all files which are needed for all values of the conditional. Having EXTRA_DIST=xxx at the beginning of tests/Makefile.am causes warnings from automake when ENABLE_TESTS is true as glib-tap.mk will unconditionally empty it. Keeping EXTRA_DIST+=xxx outside of the ENABLE_TESTS conditional would cause a different warning from automake when ENABLE_TESTS is false as we'd be appending to a variable which was never set. Moving EXTRA_DIST+= back into the conditional solves these 2 warnings. --- tests/Makefile.am | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 8cb98e5..041415f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,9 +1,3 @@ -EXTRA_DIST = \ - xml/gconfig-domain.xml \ - xml/gconfig-domain-clock.xml \ - xml/gconfig-domain-os.xml \ - $(NULL) - if ENABLE_TESTS include $(top_srcdir)/build-aux/glib-tap.mk @@ -22,9 +16,9 @@ LDADD = \ test_programs = test-gconfig test-events -else EXTRA_DIST += \ - test-events.c \ - test-gconfig.c \ + xml/gconfig-domain.xml \ + xml/gconfig-domain-clock.xml \ + xml/gconfig-domain-os.xml \ $(NULL) endif -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3] Add helper program to create custom leases
Introduce helper program to catch events from dnsmasq and maintain a custom lease file per network. It supports dhcpv4 and dhcpv6. The file is saved as interface-name.status. Each lease contains the following info: expiry-time (epoch time) mac iaid ip-address hostname clientid Example of custom leases file content: [ { iaid: 1221229, ip-address: 2001:db8:ca2:2:1::95, mac-address: 52:54:00:12:a2:6d, hostname: Fedora20, client-id: 00:04:1a:c1:d9:6b:5a:0a:e2:bc:f8:4b:1e:37:2e:38:22:55, expiry-time: 1393244216 }, { ip-address: 192.168.150.208, mac-address: 52:54:00:11:56:b3, hostname: Wani-PC, client-id: 01:52:54:00:11:56:b3, expiry-time: 1393244248 } ] src/Makefile.am: * Add options to compile the helper program src/network/bridge_driver.c: * Introduce networkDnsmasqLeaseFileNameCustom() * Invoke helper program along with dnsmasq * Delete the .status file when corresponding n/w is destroyed. src/util/leaseshelper.c * Helper program to create the custom lease file --- v3: * Improved file handling, removed redundant copying, introduced --help and --version v2: * Changed format to JSON * Refer: https://www.redhat.com/archives/libvir-list/2014-January/msg01234.html v1: * Refer: https://www.redhat.com/archives/libvir-list/2014-January/msg00626.html src/Makefile.am | 16 +++ src/network/bridge_driver.c | 19 +++ src/util/leaseshelper.c | 303 +++ 3 files changed, 338 insertions(+), 0 deletions(-) create mode 100644 src/util/leaseshelper.c diff --git a/src/Makefile.am b/src/Makefile.am index 6d21e5d..b8e1993 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -849,6 +849,9 @@ STORAGE_HELPER_DISK_SOURCES = \ UTIL_IO_HELPER_SOURCES = \ util/iohelper.c +UTIL_LEASES_HELPER_SOURCES = \ + util/leaseshelper.c + # Network filters NWFILTER_DRIVER_SOURCES = \ nwfilter/nwfilter_driver.h nwfilter/nwfilter_driver.c \ @@ -2444,6 +2447,19 @@ libvirt_iohelper_CFLAGS = \ $(AM_CFLAGS) \ $(PIE_CFLAGS) \ $(NULL) + +libexec_PROGRAMS += libvirt_leaseshelper +libvirt_leaseshelper_SOURCES = $(UTIL_LEASES_HELPER_SOURCES) +libvirt_leaseshelper_LDADD = \ + libvirt_util.la \ + ../gnulib/lib/libgnu.la +if WITH_DTRACE_PROBES +libvirt_leaseshelper_LDADD += libvirt_probes.lo +endif WITH_DTRACE_PROBES + +libvirt_leaseshelper_CFLAGS = \ + $(PIE_CFLAGS) \ + $(NULL) endif WITH_LIBVIRTD if WITH_STORAGE_DISK diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index a6c719d..9fb750f 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -205,6 +205,16 @@ networkDnsmasqLeaseFileNameFunc networkDnsmasqLeaseFileName = networkDnsmasqLeaseFileNameDefault; static char * +networkDnsmasqLeaseFileNameCustom(const char *bridge) +{ +char *leasefile; + +ignore_value(virAsprintf(leasefile, %s/%s.status, + driverState-dnsmasqStateDir, bridge)); +return leasefile; +} + +static char * networkDnsmasqConfigFileName(const char *netname) { char *conffile; @@ -240,6 +250,7 @@ networkRemoveInactive(virNetworkDriverStatePtr driver, virNetworkObjPtr net) { char *leasefile = NULL; +char *customleasefile = NULL; char *radvdconfigfile = NULL; char *configfile = NULL; char *radvdpidbase = NULL; @@ -258,6 +269,9 @@ networkRemoveInactive(virNetworkDriverStatePtr driver, if (!(leasefile = networkDnsmasqLeaseFileName(def-name))) goto cleanup; +if (!(customleasefile = networkDnsmasqLeaseFileNameCustom(def-bridge))) +goto cleanup; + if (!(radvdconfigfile = networkRadvdConfigFileName(def-name))) goto cleanup; @@ -274,6 +288,7 @@ networkRemoveInactive(virNetworkDriverStatePtr driver, /* dnsmasq */ dnsmasqDelete(dctx); unlink(leasefile); +unlink(customleasefile); unlink(configfile); /* radvd */ @@ -1117,6 +1132,10 @@ networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, cmd = virCommandNew(dnsmasqCapsGetBinaryPath(caps)); virCommandAddArgFormat(cmd, --conf-file=%s, configfile); + +/* This helper is used to create custom leases file for libvirt */ +virCommandAddArgFormat(cmd, --dhcp-script=%s, LIBEXECDIR /libvirt_leaseshelper); + *cmdout = cmd; ret = 0; cleanup: diff --git a/src/util/leaseshelper.c b/src/util/leaseshelper.c new file mode 100644 index 000..bd8110f --- /dev/null +++ b/src/util/leaseshelper.c @@ -0,0 +1,303 @@ +/* + * leasehelper.c: Helper program to create custom leases file + * + *
[libvirt] Error while running event-test.c in Libvirt package
Hello, I am trying to run event-test.c code available in libvirt-0.10.2 package under the folder /examples/domain-events/events-c. I am getting the following error /usr/bin/ld: cannot find -lvirt collect2: ld returned 1 exit status Please help me to solve this issue. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-glib 1/2] tests: Move EXTRA_DIST back into ENABLE_TESTS conditional
On Mon, Feb 24, 2014 at 12:56:21PM +0100, Christophe Fergeau wrote: When deciding which files to put into the make dist tarball, automake is clever enough to ignore conditional blocks, and to pick all files which are needed for all values of the conditional. Having EXTRA_DIST=xxx at the beginning of tests/Makefile.am causes warnings from automake when ENABLE_TESTS is true as glib-tap.mk will unconditionally empty it. Keeping EXTRA_DIST+=xxx outside of the ENABLE_TESTS conditional would cause a different warning from automake when ENABLE_TESTS is false as we'd be appending to a variable which was never set. Moving EXTRA_DIST+= back into the conditional solves these 2 warnings. --- tests/Makefile.am | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) ACK Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-glib 2/2] tests: Fix make distcheck
On Mon, Feb 24, 2014 at 12:56:22PM +0100, Christophe Fergeau wrote: Some files are missing from EXTRA_DIST, causing make distcheck to fail when tests are enabled. --- Makefile.am | 2 ++ tests/Makefile.am | 10 ++ 2 files changed, 12 insertions(+) ACK Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] lxc: Add virCgroupSetOwner()
On Fri, Feb 14, 2014 at 02:25:55PM +0100, Richard Weinberger wrote: diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index a6d60c5..4bef0db 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -3253,6 +3253,66 @@ cleanup: } +int virCgroupSetOwner(virCgroupPtr cgroup, + uid_t uid, + gid_t gid, + int controllers) +{ +size_t i; + +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { +char *base, *entry; +DIR *dh; +struct dirent *de; + +if (!((1 i) controllers)) +continue; + +if (!cgroup-controllers[i].mountPoint) +continue; + +if (virAsprintf(base, %s%s, cgroup-controllers[i].mountPoint, +cgroup-controllers[i].placement) 0) { +return -1; +} Indentation of 'return' is too deep + +dh = opendir(base); +if (!dh) { +VIR_ERROR(_(Unable to open %s: %s), base, strerror(errno)); +VIR_FREE(base); +return -1; +} This should use virReportSystemError. + +while ((de = readdir(dh)) != NULL) { +if (STREQ(de-d_name, .) || +STREQ(de-d_name, ..)) +continue; + +if (virAsprintf(entry, %s/%s, base, de-d_name) 0) { +VIR_FREE(base); +closedir(dh); +return -1; +} + +if (chown(entry, uid, gid) 0) +VIR_WARN(_(cannot chown '%s' to (%u, %u): %s), entry, uid, gid, +strerror(errno)); This should use virReportSystemError too, and propagate the error. + +VIR_FREE(entry); +} +closedir(dh); + +if (chown(base, uid, gid) 0) +VIR_WARN(_(cannot chown '%s' to (%u, %u): %s), entry, uid, gid, +strerror(errno)); Likewise. Also it uses NULL 'entry' var rather than 'base' in the message args. + +VIR_FREE(base); +} + +return 0; +} I'm going to send a followup with these fixes for review, which also centralizes the error cleanup code. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] lxc: Add virCgroupSetOwner()
Am 24.02.2014 13:20, schrieb Daniel P. Berrange: On Fri, Feb 14, 2014 at 02:25:55PM +0100, Richard Weinberger wrote: diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index a6d60c5..4bef0db 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -3253,6 +3253,66 @@ cleanup: } +int virCgroupSetOwner(virCgroupPtr cgroup, + uid_t uid, + gid_t gid, + int controllers) +{ +size_t i; + +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { +char *base, *entry; +DIR *dh; +struct dirent *de; + +if (!((1 i) controllers)) +continue; + +if (!cgroup-controllers[i].mountPoint) +continue; + +if (virAsprintf(base, %s%s, cgroup-controllers[i].mountPoint, +cgroup-controllers[i].placement) 0) { +return -1; +} Indentation of 'return' is too deep Do you have something like a checkpatch.pl? ;=) + +dh = opendir(base); +if (!dh) { +VIR_ERROR(_(Unable to open %s: %s), base, strerror(errno)); +VIR_FREE(base); +return -1; +} This should use virReportSystemError. To avoid further confusion. When to use VIR_ERROR() and when virReportSystemError()? + +while ((de = readdir(dh)) != NULL) { +if (STREQ(de-d_name, .) || +STREQ(de-d_name, ..)) +continue; + +if (virAsprintf(entry, %s/%s, base, de-d_name) 0) { +VIR_FREE(base); +closedir(dh); +return -1; +} + +if (chown(entry, uid, gid) 0) +VIR_WARN(_(cannot chown '%s' to (%u, %u): %s), entry, uid, gid, +strerror(errno)); This should use virReportSystemError too, and propagate the error. Do you we really want to propagate this error? IMHO a failing chown() is not a fatal error. + +VIR_FREE(entry); +} +closedir(dh); + +if (chown(base, uid, gid) 0) +VIR_WARN(_(cannot chown '%s' to (%u, %u): %s), entry, uid, gid, +strerror(errno)); Likewise. Also it uses NULL 'entry' var rather than 'base' in the message args. + +VIR_FREE(base); +} + +return 0; +} I'm going to send a followup with these fixes for review, which also centralizes the error cleanup code. Okay! Thanks, //richard -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3] Ensure systemd cgroup ownership is delegated to container with userns
From: Richard Weinberger rich...@nod.at This function is needed for user namespaces, where we need to chmod() the cgroup to the initial uid/gid such that systemd is allowed to use the cgroup. Signed-off-by: Richard Weinberger rich...@nod.at Signed-off-by: Daniel P. Berrange berra...@redhat.com Changed in v3: - Centralized all error reporting - Use virReportSystemError not VIR_WARN/VIR_ERROR --- src/libvirt_private.syms | 1 + src/lxc/lxc_cgroup.c | 12 + src/util/vircgroup.c | 70 src/util/vircgroup.h | 5 4 files changed, 88 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0b28bac..cfa9f75 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1056,6 +1056,7 @@ virCgroupSetMemory; virCgroupSetMemoryHardLimit; virCgroupSetMemorySoftLimit; virCgroupSetMemSwapHardLimit; +virCgroupSetOwner; virCgroupSupportsCpuBW; diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index cc0d5e8..39d955c 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -484,6 +484,18 @@ virCgroupPtr virLXCCgroupCreate(virDomainDefPtr def) cgroup) 0) goto cleanup; +/* setup control group permissions for user namespace */ +if (def-idmap.uidmap) { +if (virCgroupSetOwner(cgroup, + def-idmap.uidmap[0].target, + def-idmap.gidmap[0].target, + (1 VIR_CGROUP_CONTROLLER_SYSTEMD)) 0) { +virCgroupFree(cgroup); +cgroup = NULL; +goto cleanup; +} +} + cleanup: return cgroup; } diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index a6d60c5..18c891c 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -3253,6 +3253,76 @@ cleanup: } +int virCgroupSetOwner(virCgroupPtr cgroup, + uid_t uid, + gid_t gid, + int controllers) +{ +int ret = -1; +size_t i; +char *base = NULL, *entry = NULL; +DIR *dh = NULL; + +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { +struct dirent *de; + +if (!((1 i) controllers)) +continue; + +if (!cgroup-controllers[i].mountPoint) +continue; + +if (virAsprintf(base, %s%s, cgroup-controllers[i].mountPoint, +cgroup-controllers[i].placement) 0) +goto cleanup; + +if (!(dh = opendir(base))) { +virReportSystemError(errno, + _(Unable to open dir '%s'), base); +goto cleanup; +} + +while ((de = readdir(dh)) != NULL) { +if (STREQ(de-d_name, .) || +STREQ(de-d_name, ..)) +continue; + +if (virAsprintf(entry, %s/%s, base, de-d_name) 0) +goto cleanup; + +if (chown(entry, uid, gid) 0) { +virReportSystemError(errno, + _(cannot chown '%s' to (%u, %u)), + entry, uid, gid); +goto cleanup; +} + +VIR_FREE(entry); +} + +if (chown(base, uid, gid) 0) { +virReportSystemError(errno, + _(cannot chown '%s' to (%u, %u)), + base, uid, gid); +goto cleanup; +} + +VIR_FREE(base); +closedir(dh); +dh = NULL; +} + +ret = 0; + + cleanup: +if (dh) +closedir(dh); +VIR_FREE(entry); +VIR_FREE(base); +return ret; +} + + /** * virCgroupSupportsCpuBW(): * Check whether the host supports CFS bandwidth. diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index a70eb18..38d94f3 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -225,4 +225,9 @@ int virCgroupIsolateMount(virCgroupPtr group, bool virCgroupSupportsCpuBW(virCgroupPtr cgroup); +int virCgroupSetOwner(virCgroupPtr cgroup, + uid_t uid, + gid_t gid, + int controllers); + #endif /* __VIR_CGROUP_H__ */ -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Error while running event-test.c in Libvirt package
On Mon, Feb 24, 2014 at 05:33:31PM +0530, Avanti Ajay wrote: Hello, I am trying to run event-test.c code available in libvirt-0.10.2 package under the folder /examples/domain-events/events-c. I am getting the following error /usr/bin/ld: cannot find -lvirt collect2: ld returned 1 exit status Do you have libvirt-devel package installed? Martin Please help me to solve this issue. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] lxc: Add virCgroupSetOwner()
On Mon, Feb 24, 2014 at 01:25:04PM +0100, Richard Weinberger wrote: Am 24.02.2014 13:20, schrieb Daniel P. Berrange: On Fri, Feb 14, 2014 at 02:25:55PM +0100, Richard Weinberger wrote: diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index a6d60c5..4bef0db 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -3253,6 +3253,66 @@ cleanup: } +int virCgroupSetOwner(virCgroupPtr cgroup, + uid_t uid, + gid_t gid, + int controllers) +{ +size_t i; + +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { +char *base, *entry; +DIR *dh; +struct dirent *de; + +if (!((1 i) controllers)) +continue; + +if (!cgroup-controllers[i].mountPoint) +continue; + +if (virAsprintf(base, %s%s, cgroup-controllers[i].mountPoint, +cgroup-controllers[i].placement) 0) { +return -1; +} Indentation of 'return' is too deep Do you have something like a checkpatch.pl? ;=) Just my eyes in this case ;-P +dh = opendir(base); +if (!dh) { +VIR_ERROR(_(Unable to open %s: %s), base, strerror(errno)); +VIR_FREE(base); +return -1; +} This should use virReportSystemError. To avoid further confusion. When to use VIR_ERROR() and when virReportSystemError()? VIR_ERROR merely puts a message in the logs. It doesn't propagate anything back to the client making the API call. The virReport*Error functions actually send an error back to the client app. You basically always want virReport*Error - there's almost no cases where VIR_ERROR is the right thing todo. + +while ((de = readdir(dh)) != NULL) { +if (STREQ(de-d_name, .) || +STREQ(de-d_name, ..)) +continue; + +if (virAsprintf(entry, %s/%s, base, de-d_name) 0) { +VIR_FREE(base); +closedir(dh); +return -1; +} + +if (chown(entry, uid, gid) 0) +VIR_WARN(_(cannot chown '%s' to (%u, %u): %s), entry, uid, gid, +strerror(errno)); This should use virReportSystemError too, and propagate the error. Do you we really want to propagate this error? IMHO a failing chown() is not a fatal error. I don't see a valid reason why chown would fail in normal usage, so I think it should be fatal. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Entering freeze for libvirt-1.2.2
On Mon, Feb 24, 2014 at 06:03:58PM +0800, Daniel Veillard wrote: On Mon, Feb 24, 2014 at 09:46:55AM +0100, Stephan Sachse wrote: what about this patch: [PATCH] lxc: Add virCgroupSetOwner() http://thread.gmane.org/gmane.comp.emulators.libvirt/92811 without this patch lxc + user namespace does not works with systemd /stephan That's small enough and fixing an use case, so assuming that someone like Dan ACk in, then it could go in IMHO I've sent a further version of that patch since error reporting needed more work Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Compiling libvirt RPC client library for QNX
Hi Roman, Before I jump to the compilation of libvirt for QNX, I thought of compiling it on linux with my required options. So that I will be knowing what all files are of my use (from compilation log). For that I ran ./configure with below option and then tried 'make'. But 'make' complains there is no 'makefile' and I need to run './configure' before I run 'make'. Please see the log below. Am I missing any thing here ? blr-vxr-052~$ ./configure --enable-compile-warnings=error --without-xen --without-qemu--without-openvz --without-lxc --without-vbox --without-xenapi --without-esx --without-uml --without-sasl --without-avahi --without-polkit --without-python --without-libvirtd --without-phyp --without-hyperv --without-netcf --without-audit --without-dtrace checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to disable maintainer-specific portions of Makefiles... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking dependency style of gcc... (cached) gcc3 checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for Minix Amsterdam compiler... no checking for ar... ar checking for ranlib... ranlib checking whether gcc and cc understand -c and -o together... yes checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for _LARGEFILE_SOURCE value needed for large files... no checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... no checking for gcc option to accept ISO C99... -std=gnu99 checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99 checking for inline... inline checking sys/socket.h usability... yes checking sys/socket.h presence... yes checking for sys/socket.h... yes checking arpa/inet.h usability... yes checking arpa/inet.h presence... yes checking for arpa/inet.h... yes checking features.h usability... yes checking features.h presence... yes checking for features.h... yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking for unistd.h... (cached) yes checking wctype.h usability... yes checking wctype.h presence... yes checking for wctype.h... yes checking netdb.h usability... yes checking netdb.h presence... yes checking for netdb.h... yes checking netinet/in.h usability... yes checking netinet/in.h presence... yes checking for netinet/in.h... yes checking stdio_ext.h usability... yes checking stdio_ext.h presence... yes checking for stdio_ext.h... yes checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking sys/mman.h usability... yes checking sys/mman.h presence... yes checking for sys/mman.h... yes checking pty.h usability... yes checking pty.h presence... yes checking for pty.h... yes checking poll.h usability... yes checking poll.h presence... yes checking for poll.h... yes checking sys/ioctl.h usability... yes checking sys/ioctl.h presence... yes checking for sys/ioctl.h... yes checking sys/filio.h usability... no checking sys/filio.h presence... no checking for sys/filio.h... no checking pthread.h usability... yes checking pthread.h presence... yes checking for pthread.h... yes checking sched.h usability... yes checking sched.h presence... yes checking for sched.h... yes checking sys/select.h usability... yes checking sys/select.h presence... yes checking for sys/select.h... yes checking
Re: [libvirt] [PATCH v3] Ensure systemd cgroup ownership is delegated to container with userns
On Mon, Feb 24, 2014 at 12:25:28PM +, Daniel P. Berrange wrote: From: Richard Weinberger rich...@nod.at This function is needed for user namespaces, where we need to chmod() the cgroup to the initial uid/gid such that systemd is allowed to use the cgroup. Signed-off-by: Richard Weinberger rich...@nod.at Signed-off-by: Daniel P. Berrange berra...@redhat.com Changed in v3: - Centralized all error reporting - Use virReportSystemError not VIR_WARN/VIR_ERROR --- src/libvirt_private.syms | 1 + src/lxc/lxc_cgroup.c | 12 + src/util/vircgroup.c | 70 src/util/vircgroup.h | 5 4 files changed, 88 insertions(+) [...] diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index a6d60c5..18c891c 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -3253,6 +3253,76 @@ cleanup: } +int virCgroupSetOwner(virCgroupPtr cgroup, + uid_t uid, + gid_t gid, + int controllers) +{ +int ret = -1; +size_t i; +char *base = NULL, *entry = NULL; +DIR *dh = NULL; + +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { +struct dirent *de; + +if (!((1 i) controllers)) +continue; + +if (!cgroup-controllers[i].mountPoint) +continue; + +if (virAsprintf(base, %s%s, cgroup-controllers[i].mountPoint, +cgroup-controllers[i].placement) 0) Indentation's off here, ACK with that fixed. Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3] Ensure systemd cgroup ownership is delegated to container with userns
thanks, works for me. /stephan -- Software is like sex, it's better when it's free! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: Don't leak buffer if GetFDs fails in cmdCreate
Change the logic of the function to return false by default and move the freeing of the buffer to the cleanup section. https://bugzilla.redhat.com/show_bug.cgi?id=1067338 --- tools/virsh-domain.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 00ace11..59e843f 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6518,7 +6518,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd) { virDomainPtr dom; const char *from = NULL; -bool ret = true; +bool ret = false; char *buffer; #ifndef WIN32 bool console = vshCommandOptBool(cmd, console); @@ -6534,7 +6534,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd) return false; if (cmdStartGetFDs(ctl, cmd, nfds, fds) 0) -return false; +goto cleanup; if (vshCommandOptBool(cmd, paused)) flags |= VIR_DOMAIN_START_PAUSED; @@ -6545,20 +6545,23 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd) dom = virDomainCreateXMLWithFiles(ctl-conn, buffer, nfds, fds, flags); else dom = virDomainCreateXML(ctl-conn, buffer, flags); -VIR_FREE(buffer); -if (dom != NULL) { -vshPrint(ctl, _(Domain %s created from %s\n), - virDomainGetName(dom), from); -#ifndef WIN32 -if (console) -cmdRunConsole(ctl, dom, NULL, 0); -#endif -virDomainFree(dom); -} else { +if (!dom) { vshError(ctl, _(Failed to create domain from %s), from); -ret = false; +goto cleanup; } + +vshPrint(ctl, _(Domain %s created from %s\n), + virDomainGetName(dom), from); +#ifndef WIN32 +if (console) +cmdRunConsole(ctl, dom, NULL, 0); +#endif +virDomainFree(dom); +ret = true; + +cleanup: +VIR_FREE(buffer); VIR_FREE(fds); return ret; } -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/4] libxl: add dump dir to libxlDriverConfig object
On 21.02.2014 00:02, Jim Fehlig wrote: Signed-off-by: Jim Fehlig jfeh...@suse.com --- Without a libxl config file, I suppose the only thing needed here is the #define in libxl_conf.h. But I have a dusty series adding lockd support to the libxl driver, which I'll be cleaning off soon. That series introduces libxl.conf, and can be expanded to include an auto dump dir entry. src/libxl/libxl_conf.c | 3 +++ src/libxl/libxl_conf.h | 2 ++ src/libxl/libxl_driver.c | 7 +++ 3 files changed, 12 insertions(+) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 4cefadf..13eddd1 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -97,6 +97,7 @@ libxlDriverConfigDispose(void *obj) VIR_FREE(cfg-stateDir); VIR_FREE(cfg-libDir); VIR_FREE(cfg-saveDir); +VIR_FREE(cfg-autoDumpDir); } static int @@ -1078,6 +1079,8 @@ libxlDriverConfigNew(void) goto error; if (VIR_STRDUP(cfg-saveDir, LIBXL_SAVE_DIR) 0) goto error; +if (VIR_STRDUP(cfg-autoDumpDir, LIBXL_DUMP_DIR) 0) +goto error; if (virAsprintf(log_file, %s/libxl-driver.log, cfg-logDir) 0) goto error; diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index ca7bc7d..f089a92 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -48,6 +48,7 @@ # define LIBXL_LOG_DIR LOCALSTATEDIR /log/libvirt/libxl # define LIBXL_LIB_DIR LOCALSTATEDIR /lib/libvirt/libxl # define LIBXL_SAVE_DIR LIBXL_LIB_DIR /save +# define LIBXL_DUMP_DIR LIBXL_LIB_DIR /dump # define LIBXL_BOOTLOADER_PATH BINDIR /pygrub @@ -82,6 +83,7 @@ struct _libxlDriverConfig { char *stateDir; char *libDir; char *saveDir; +char *autoDumpDir; }; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index e600de7..e18fead 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -976,6 +976,13 @@ libxlStateInitialize(bool privileged, virStrerror(errno, ebuf, sizeof(ebuf))); goto error; } +if (virFileMakePath(cfg-autoDumpDir) 0) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _(failed to create dump dir '%s': %s), + cfg-autoDumpDir, + virStrerror(errno, ebuf, sizeof(ebuf))); +goto error; +} /* read the host sysinfo */ libxl_driver-hostsysinfo = virSysinfoRead(); ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] libxl: honor domain lifecycle event configuration
On 21.02.2014 00:02, Jim Fehlig wrote: The libxl driver was ignoring the on_* domain event configuration, causing e.g. a domain to be rebooted even when on_reboot is set to destroy. This patch honors the on_* configuration in the shutdown event handler. Signed-off-by: Jim Fehlig jfeh...@suse.com --- src/libxl/libxl_driver.c | 83 +--- 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index c7c7b4f..721577d 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -372,38 +372,69 @@ libxlDomainShutdownThread(void *opaque) virObjectLock(vm); -switch (xl_reason) { -case LIBXL_SHUTDOWN_REASON_POWEROFF: -case LIBXL_SHUTDOWN_REASON_CRASH: -if (xl_reason == LIBXL_SHUTDOWN_REASON_CRASH) { -dom_event = virDomainEventLifecycleNewFromObj(vm, +if (xl_reason == LIBXL_SHUTDOWN_REASON_POWEROFF) { +dom_event = virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); +switch (vm-def-onPoweroff) { +case VIR_DOMAIN_LIFECYCLE_DESTROY: +reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; +goto destroy; +case VIR_DOMAIN_LIFECYCLE_RESTART: +case VIR_DOMAIN_LIFECYCLE_RESTART_RENAME: +goto restart; +case VIR_DOMAIN_LIFECYCLE_PRESERVE: +goto cleanup; +} +} else if (xl_reason == LIBXL_SHUTDOWN_REASON_CRASH) { +dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); -reason = VIR_DOMAIN_SHUTOFF_CRASHED; -} else { -dom_event = virDomainEventLifecycleNewFromObj(vm, +switch (vm-def-onCrash) { +case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY: +reason = VIR_DOMAIN_SHUTOFF_CRASHED; +goto destroy; +case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART: +case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME: +goto restart; +case VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE: +goto cleanup; +} +} else if (xl_reason == LIBXL_SHUTDOWN_REASON_REBOOT) { +dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); -reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; -} -libxl_domain_destroy(ctx, vm-def-id, NULL); -if (libxlVmCleanupJob(driver, vm, reason)) { -if (!vm-persistent) { -virDomainObjListRemove(driver-domains, vm); -vm = NULL; -} -} -break; -case LIBXL_SHUTDOWN_REASON_REBOOT: -libxl_domain_destroy(ctx, vm-def-id, NULL); -libxlVmCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); -libxlVmStart(driver, vm, 0, -1); -break; -default: -VIR_INFO(Unhandled shutdown_reason %d, xl_reason); -break; +switch (vm-def-onReboot) { +case VIR_DOMAIN_LIFECYCLE_DESTROY: +reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; +goto destroy; +case VIR_DOMAIN_LIFECYCLE_RESTART: +case VIR_DOMAIN_LIFECYCLE_RESTART_RENAME: +goto restart; +case VIR_DOMAIN_LIFECYCLE_PRESERVE: +goto cleanup; +} +} else { +VIR_INFO(Unhandled shutdown_reason %d, xl_reason); +goto cleanup; } +destroy: +libxl_domain_destroy(ctx, vm-def-id, NULL); +if (libxlVmCleanupJob(driver, vm, reason)) { Funny, my gcc-4.8.2 warns me about @reason may be used uninitialized here. +if (!vm-persistent) { +virDomainObjListRemove(driver-domains, vm); +vm = NULL; +} +} +goto cleanup; + +restart: +libxl_domain_destroy(ctx, vm-def-id, NULL); +libxlVmCleanup(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); Right. You've already notice that needs to be libxlVmCleanupJob(). +libxlVmStart(driver, vm, 0, -1); + +cleanup: if (vm) virObjectUnlock(vm); if (dom_event) ACK with this squashed in: diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 721577d..0b9bf7d 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -368,7 +368,7 @@ libxlDomainShutdownThread(void *opaque) libxl_ctx *ctx = priv-ctx; virObjectEventPtr dom_event = NULL; libxl_shutdown_reason xl_reason = ev-u.domain_shutdown.shutdown_reason; -
Re: [libvirt] [PATCH 4/4] libxl: handle on_crash coredump actions
On 21.02.2014 00:02, Jim Fehlig wrote: Add support for coredump-{destroy,restart} actions of on_crash event. Signed-off-by: Jim Fehlig jfeh...@suse.com --- src/libxl/libxl_driver.c | 50 1 file changed, 50 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index e18fead..7640801 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -251,6 +251,50 @@ error: } /* + * Core dump domain to default dump path. + * + * virDomainObjPtr should be locked on invocation + */ +static int +libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver, +virDomainObjPtr vm) +{ +libxlDomainObjPrivatePtr priv = vm-privateData; +libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); +time_t curtime = time(NULL); +char timestr[100]; +struct tm time_info; +char *dumpfile = NULL; +int ret = -1; + +localtime_r(curtime, time_info); +strftime(timestr, sizeof(timestr), %Y-%m-%d-%H:%M:%S, time_info); + +if (virAsprintf(dumpfile, %s/%s-%s, +cfg-autoDumpDir, +vm-def-name, +timestr) 0) +goto cleanup; + +if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) 0) +goto cleanup; + +/* Unlock virDomainObj while dumping core */ +virObjectUnlock(vm); +libxl_domain_core_dump(priv-ctx, vm-def-id, dumpfile, NULL); +virObjectLock(vm); + +ignore_value(libxlDomainObjEndJob(driver, vm)); +ret = 0; + +cleanup: +VIR_FREE(dumpfile); +virObjectUnref(cfg); + +return ret; +} + +/* * Cleanup function for domain that has reached shutoff state. * * virDomainObjPtr should be locked on invocation @@ -403,6 +447,12 @@ libxlDomainShutdownThread(void *opaque) goto restart; case VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE: goto cleanup; +case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY: +libxlDomainAutoCoreDump(driver, vm); +goto destroy; +case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART: +libxlDomainAutoCoreDump(driver, vm); +goto restart; } } else if (xl_reason == LIBXL_SHUTDOWN_REASON_REBOOT) { dom_event = virDomainEventLifecycleNewFromObj(vm, ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/4] libxl: queue domain event earlier in shutdown handler
On 21.02.2014 00:02, Jim Fehlig wrote: The shutdown handler may restart a domain when handling a reboot event or when on_* is set to 'restart'. Restarting consists of calling libxlVmCleanup followed by libxlVmStart. libxlVmStart will emit a VIR_DOMAIN_EVENT_STARTED event, but the SHUTDOWN event is not emitted until exiting the shutdown handler, after the STARTED event. Queue the event immediately after creation to avoid emitting it after the start event. Signed-off-by: Jim Fehlig jfeh...@suse.com --- src/libxl/libxl_driver.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 721577d..e600de7 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -376,6 +376,8 @@ libxlDomainShutdownThread(void *opaque) dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); +if (dom_event) +libxlDomainEventQueue(driver, dom_event); switch (vm-def-onPoweroff) { case VIR_DOMAIN_LIFECYCLE_DESTROY: reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; @@ -390,6 +392,8 @@ libxlDomainShutdownThread(void *opaque) dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); +if (dom_event) +libxlDomainEventQueue(driver, dom_event); switch (vm-def-onCrash) { case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY: reason = VIR_DOMAIN_SHUTOFF_CRASHED; @@ -404,6 +408,8 @@ libxlDomainShutdownThread(void *opaque) dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); +if (dom_event) +libxlDomainEventQueue(driver, dom_event); switch (vm-def-onReboot) { case VIR_DOMAIN_LIFECYCLE_DESTROY: reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; @@ -437,8 +443,6 @@ restart: cleanup: if (vm) virObjectUnlock(vm); -if (dom_event) -libxlDomainEventQueue(driver, dom_event); libxl_event_free(ctx, ev); VIR_FREE(shutdown_info); } Wouldn't it be better to enqueue events at the beginning of 'destroy' and 'restart' labels? I'm thinking about something among these lines: diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0b9bf7d..c009407 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -425,6 +425,10 @@ libxlDomainShutdownThread(void *opaque) } destroy: +if (dom_event) { +libxlDomainEventQueue(driver, dom_event); +dom_event = NULL; +} libxl_domain_destroy(ctx, vm-def-id, NULL); if (libxlVmCleanupJob(driver, vm, reason)) { if (!vm-persistent) { @@ -435,6 +439,10 @@ destroy: goto cleanup; restart: +if (dom_event) { +libxlDomainEventQueue(driver, dom_event); +dom_event = NULL; +} libxl_domain_destroy(ctx, vm-def-id, NULL); libxlVmCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); libxlVmStart(driver, vm, 0, -1); Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] virSystemdCreateMachine: Set dependencies for slices
On 02/21/2014 07:32 AM, Michal Privoznik wrote: https://bugzilla.redhat.com/show_bug.cgi?id=1031696 When creating a new domain, we let systemd know about it by calling CreateMachine() function via dbus. Systemd then creates a scope and places domain into it. However, later when the host is shutting down, systemd computes the shutdown order to see what processes can be shut down in parallel. And since we were not setting dependencies at all, the slices (and thus domains) were most likely killed before libvirt-guests.service. So user domains that had to be saved, shut off, whatever were in fact killed. This problem can be solved by letting systemd know that scopes we're creating must not be killed before libvirt-guests.service. Signed-off-by: Michal Privoznik mpriv...@redhat.com --- src/util/virsystemd.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 503fff7..9247c92 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -243,8 +243,10 @@ int virSystemdCreateMachine(const char *name, iscontainer ? container : vm, (unsigned int)pidleader, rootdir ? rootdir : , - 1, Slice, s, - slicename) 0) + 3, + Slice, s, slicename, + After, as, 1, libvirtd.service, + Before, as, 1, libvirt-guests.service) 0) goto cleanup; ret = 0; Ahh, so this does indeed work all along and I just messed up the gvariant :/ ACK - Cole -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Question about building libvirt.so
Hey, On Fri, Feb 21, 2014 at 07:30:08AM -0800, Vikhyath Reddy wrote: Thanks for the reply Cedric, wrappers is a dir that I made similar to examples which wraps the libvirt c code. The reason why I am doing this is to simplify the usage of virConnectOpenAuth - it's arguments and callbacks from JavaScript. Using ffi, I am unable to create the right callbacks and have it pass the correct arguments. Depending on what parts of libvirt API you need to use from javascript, libvirt-glib may be an option as it already makes some parts of libvirt API accessible from javascript, see http://libvirt.org/git/?p=libvirt-glib.git;a=blob;f=examples/conn-test.js;h=7f9784b8fc55a2be6c7596cfd365d4273d057a2e;hb=HEAD for example. I don't know if this would be usable from nodejs? If this is a good fit for what you need, patches extending the libvirt API wrapped by libvirt-glib are very welcome ;) Christophe pgpesdjK7a13Q.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] make virDomainGetMaxVcpus work on inactive domains
On 19.02.2014 13:03, Claudio Bley wrote: Signed-off-by: Claudio Bley cb...@av-test.de --- OK, how about this patch? While at it, should I convert the VIR_DOMAIN_VCPU_* instances to VIR_DOMAIN_AFFECT_* instances for consistency? src/esx/esx_driver.c |2 +- src/openvz/openvz_driver.c |2 +- src/phyp/phyp_driver.c |2 +- src/qemu/qemu_driver.c |2 +- src/test/test_driver.c |2 +- src/vbox/vbox_tmpl.c |2 +- src/xen/xen_driver.c |2 +- src/xenapi/xenapi_driver.c |2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 886d984..6e05d78 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2646,7 +2646,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) static int esxDomainGetMaxVcpus(virDomainPtr domain) { -return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE | +return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } This won't work esxDomainGetVcpusFlags() requires flags to be exactly (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM). diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index b27ac4c..e1f9738 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1318,7 +1318,7 @@ openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED, static int openvzDomainGetMaxVcpus(virDomainPtr dom) { -return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE | +return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } Same here. diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 9adb6b0..4510b82 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1372,7 +1372,7 @@ phypDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) static int phypDomainGetMaxVcpus(virDomainPtr dom) { -return phypDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | +return phypDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } And here. diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6ea837e..2068ace 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4986,7 +4986,7 @@ cleanup: static int qemuDomainGetMaxVcpus(virDomainPtr dom) { -return qemuDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE | +return qemuDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } This bit is okay. diff --git a/src/test/test_driver.c b/src/test/test_driver.c index b724f82..a320241 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2620,7 +2620,7 @@ cleanup: static int testDomainGetMaxVcpus(virDomainPtr domain) { -return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE | +return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } And so is this. diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 382d7b4..fbae940 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -2208,7 +2208,7 @@ vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) static int vboxDomainGetMaxVcpus(virDomainPtr dom) { -return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE | +return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } This is not again. vboxDomainGetVcpusFlags() requires flags == (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM). diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 7506e8c..38bbce0 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -1539,7 +1539,7 @@ cleanup: static int xenUnifiedDomainGetMaxVcpus(virDomainPtr dom) { -return xenUnifiedDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | +return xenUnifiedDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } This good. diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index a547306..688d162 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -1347,7 +1347,7 @@ xenapiDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) static int xenapiDomainGetMaxVcpus(virDomainPtr dom) { -return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | +return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); } This is not. I haven't checked if all *DomainGetVcpusFlags() that require just _LIVE really needs it or if they can work on
Re: [libvirt] [PATCH 1/4] libxl: honor domain lifecycle event configuration
Michal Privoznik wrote: On 21.02.2014 00:02, Jim Fehlig wrote: The libxl driver was ignoring the on_* domain event configuration, causing e.g. a domain to be rebooted even when on_reboot is set to destroy. This patch honors the on_* configuration in the shutdown event handler. [...] ACK with this squashed in: Can this series be pushed for 1.2.2? If so, I'll squash in your changes and push later today. Thanks for the review! Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix memory leak when lookup pool list with invalid type option
- Original Message - | From: Martin Kletzander mklet...@redhat.com | To: shyu s...@redhat.com | Cc: libvir-list@redhat.com | Sent: Monday, February 24, 2014 4:48:01 PM | Subject: Re: [libvirt] [PATCH] Fix memory leak when lookup pool list with invalid type option | | On Mon, Feb 24, 2014 at 02:12:34PM +0800, shyu wrote: | There will be memory leak when lookup pool list with invalid type option | https://bugzilla.redhat.com/show_bug.cgi?id=1069068 | | ==23060== Memcheck, a memory error detector | ==23060== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. | ==23060== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info | ==23060== Command: virsh pool-list --type invalid | ==23060== | error: Invalid pool type | | ==23060== | ==23060== HEAP SUMMARY: | ==23060== in use at exit: 138,383 bytes in 1,559 blocks | ==23060== total heap usage: 4,199 allocs, 2,640 frees, 21,372,544 bytes | allocated | ==23060== | ==23060== LEAK SUMMARY: | ==23060==definitely lost: 8 bytes in 1 blocks | ==23060==indirectly lost: 0 bytes in 0 blocks | ==23060== possibly lost: 0 bytes in 0 blocks | ==23060==still reachable: 138,375 bytes in 1,558 blocks | ==23060== suppressed: 0 bytes in 0 blocks | ==23060== Rerun with --leak-check=full to see details of leaked memory | ==23060== | ==23060== For counts of detected and suppressed errors, rerun with: -v | ==23060== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 6) | | | This info is useless since there is no information about the leak. | You should've included this kind of info instead: | | ==2472== 5 bytes in 1 blocks are definitely lost in loss record 5 of 84 | ==2472==at 0x4A069EE: malloc (vg_replace_malloc.c:270) | ==2472==by 0x3B88281171: strdup (strdup.c:43) | ==2472==by 0x40EB40: _vshStrdup (virsh.c:129) | ==2472==by 0x40FC68: vshStringToArray (virsh.c:182) | ==2472==by 0x42A9F9: cmdPoolList (virsh-pool.c:857) | ==2472==by 0x40D240: vshCommandRun (virsh.c:1652) | ==2472==by 0x410B4A: main (virsh.c:3093) | | Signed-off-by: shyu s...@redhat.com | --- | tools/virsh-pool.c |1 + | 1 files changed, 1 insertions(+), 0 deletions(-) | | diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c | index 642b078..db4d3ae 100644 | --- a/tools/virsh-pool.c | +++ b/tools/virsh-pool.c | @@ -859,6 +859,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd | ATTRIBUTE_UNUSED) | for (i = 0; i npoolTypes; i++) { | if ((poolType = virStoragePoolTypeFromString(poolTypes[i])) | 0) { | vshError(ctl, %s, _(Invalid pool type)); | +VIR_FREE(*poolTypes); | | This does not properly free all the poolTypes in case this doesn't | fails with i 0. | | VIR_FREE(poolTypes); | | And judging by the code, this is not upstream at all, right? I guess | this is not applicable upstream for half a year already, at least. | Please submit patches that apply on top of current master when cloning | from git://libvirt.org/libvirt.git . | Hi Martin, I think I made an mistake. Since I found this bug with 0.10.2-29.el6_5.4 so I make this patch according v0.10.2-maint branch. I knew it was already be fixed on upstream. I thought there should be fixed on v0.10.2-maint. Now I know that. Thanks for your kind remind. | Thanks for your effort, but I believe this is already fixed within | commit d64af6ce as I already commented in the Bug you referenced. | | Martin | -- Regards shyu -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] bhyve: implement node information reporting
Daniel P. Berrange wrote: On Mon, Feb 24, 2014 at 12:30:38PM +0400, Roman Bogorodskiy wrote: - Implement nodeGetCPUStats using nodeGetCPUStats() - Implement nodeGetMemoryStats using nodeGetMemoryStats() --- src/bhyve/bhyve_driver.c | 29 + 1 file changed, 29 insertions(+) ACK Thanks! Pushed with a trivial whitespace fix for bhyveNodeGetMemoryStats() to properly align arguments offset. Roman Bogorodskiy -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] libxl: honor domain lifecycle event configuration
On 24.02.2014 15:56, Jim Fehlig wrote: Michal Privoznik wrote: On 21.02.2014 00:02, Jim Fehlig wrote: The libxl driver was ignoring the on_* domain event configuration, causing e.g. a domain to be rebooted even when on_reboot is set to destroy. This patch honors the on_* configuration in the shutdown event handler. [...] ACK with this squashed in: Can this series be pushed for 1.2.2? If so, I'll squash in your changes and push later today. Thanks for the review! Regards, Jim I think these patches are bugfix. Which allows us to push them even in freeze. Also note that I've not ACKed 2/4 as I think a different pattern is better. However, that does not stop you from pushing the rest. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3] gluster: Fix key attribute for gluster volumes
According to our documentation the key value has the following meaning: Providing an identifier for the volume which is globally unique. This cannot be set when creating a volume: it is always generated. The currently used keys for gluster volumes consist of the gluster volume name and file path. This can't be considered unique as a different storage server can serve a volume with the same name. Use the full URI as the key for the volume to avoid ambiguity problems. --- src/storage/storage_backend_gluster.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 202a441..bb13463 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -185,6 +185,7 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state, const char *name) { int ret = -1; +char *path = NULL; char *tmp; VIR_FREE(vol-key); @@ -199,12 +200,12 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state, goto cleanup; } -if (virAsprintf(vol-key, %s%s%s, state-volname, state-dir, +if (virAsprintf(path, %s%s%s, state-volname, state-dir, vol-name) 0) goto cleanup; tmp = state-uri-path; -if (virAsprintf(state-uri-path, /%s, vol-key) 0) { +if (virAsprintf(state-uri-path, /%s, path) 0) { state-uri-path = tmp; goto cleanup; } @@ -216,9 +217,14 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state, VIR_FREE(state-uri-path); state-uri-path = tmp; +/* the path is unique enough to serve as a volume key */ +if (VIR_STRDUP(vol-key, vol-target.path) 0) +goto cleanup; + ret = 0; cleanup: +VIR_FREE(path); return ret; } -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/3] Multiple fixes related to lookup of gluster volumes
Peter Krempa (3): storage: Don't lie about path used to look up in error message util: file: Don't sanitize URI protocol separator in virFileSanitizePath gluster: Fix key attribute for gluster volumes src/storage/storage_backend_gluster.c | 10 -- src/storage/storage_driver.c | 12 +--- src/util/virfile.c| 12 3 files changed, 29 insertions(+), 5 deletions(-) -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3] util: file: Don't sanitize URI protocol separator in virFileSanitizePath
The function removes multiple following slashes from paths. This is okay unless you try to sanitize a URI this way. Skip the protocol definition until :// and sanitize just the path part. The sanitization function is used in virStorageVolLookupByPath as the first step before passing the path to storage drivers. This breaks lookup of gluster volumes. --- src/util/virfile.c | 12 1 file changed, 12 insertions(+) diff --git a/src/util/virfile.c b/src/util/virfile.c index 96f078d..6a09609 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2587,6 +2587,8 @@ virFileSanitizePath(const char *path) const char *cur = path; char *cleanpath; int idx = 0; +const char *firstslash; +const char *uriseparator; if (VIR_STRDUP(cleanpath, path) 0) return NULL; @@ -2596,12 +2598,22 @@ virFileSanitizePath(const char *path) * /// - / * /../foo - /../foo * /foo///bar/ - /foo/bar + * Need to leave in place: + * :// - URIs */ +/* find positions of first colon and first slash */ +firstslash = strchr(path, '/'); + /* Starting with // is valid posix, but ///foo == /foo */ if (cur[0] == '/' cur[1] == '/' cur[2] != '/') { idx = 2; cur += 2; +} else if ((uriseparator = strstr(path, ://)) + uriseparator firstslash) { + +cur = uriseparator + 3; +idx = cur - path; } /* Sanitize path in place */ -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/3] storage: Don't lie about path used to look up in error message
In storageVolLookupByPath the provided path is sanitized at first. This removes some extra slashes and stuff. When the lookup of the volume fails the original path is used which makes it hard to trace errors in some cases. Improve the error message to print the sanitized path along with the user provided path if they are not equal. --- src/storage/storage_driver.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index e0ebdb0..42cb397 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1484,9 +1484,15 @@ storageVolLookupByPath(virConnectPtr conn, virStoragePoolObjUnlock(driver-pools.objs[i]); } -if (!ret) -virReportError(VIR_ERR_NO_STORAGE_VOL, - _(no storage vol with matching path %s), path); +if (!ret) { +if (STREQ(path, cleanpath)) { +virReportError(VIR_ERR_NO_STORAGE_VOL, + _(no storage vol with matching path '%s'), path); +} else { +virReportError(VIR_ERR_NO_STORAGE_VOL, + _(no storage vol with matching path '%s' (%s)), path, cleanpath); +} +} cleanup: VIR_FREE(cleanpath); -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] libxl: honor domain lifecycle event configuration
On Mon, Feb 24, 2014 at 04:17:52PM +0100, Michal Privoznik wrote: On 24.02.2014 15:56, Jim Fehlig wrote: Michal Privoznik wrote: On 21.02.2014 00:02, Jim Fehlig wrote: The libxl driver was ignoring the on_* domain event configuration, causing e.g. a domain to be rebooted even when on_reboot is set to destroy. This patch honors the on_* configuration in the shutdown event handler. [...] ACK with this squashed in: Can this series be pushed for 1.2.2? If so, I'll squash in your changes and push later today. Thanks for the review! Regards, Jim I think these patches are bugfix. Which allows us to push them even in freeze. Also note that I've not ACKed 2/4 as I think a different pattern is better. However, that does not stop you from pushing the rest. Agreed, it was posted before freeze too, so fine to commit IMO Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/3] util: file: Don't sanitize URI protocol separator in virFileSanitizePath
On Mon, Feb 24, 2014 at 04:21:47PM +0100, Peter Krempa wrote: The function removes multiple following slashes from paths. This is okay unless you try to sanitize a URI this way. Skip the protocol definition until :// and sanitize just the path part. The sanitization function is used in virStorageVolLookupByPath as the first step before passing the path to storage drivers. This breaks lookup of gluster volumes. --- src/util/virfile.c | 12 1 file changed, 12 insertions(+) This feels a rather dirty to me - we shouldn't be trying to second guess whether a filename might be a URI. I think we should not be passing URIs to the virFileSanitizePath in the first place. Based on what you say about usage, it sounds like the call to virFileSanitizePath needs to be pushed down into the storage backend drivers themselves. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] block pull/commit for non-local storage
On 02/20/14 15:37, Daniel P. Berrange wrote: On Thu, Feb 20, 2014 at 02:46:03PM +0100, Peter Krempa wrote: As you can see in the prototypes of these functions (and from the docs for them which I'm not going to copy here) the user can provide the disk specification in two possible options: 1) a full path if it's unambiguous - this is file centric and requires the file to be in the local filesystem 2) a disk name vda - this is selected automatically by libvirt but allows to specify only the top image. For systems that want to use remote storage without local representation such as gluster+libgfapi, this doesn't allow to use the APIs to start block jobs. To solve this issue we need a way to specify paths on remote storage in some way. Below are two options we've discussed on IRC. 1) Use URIs along with the file path to specify disk images. This option would add a new, possibly well documented URIs to specify paths for disk images. These would be libvirt defined URIs (but surprisingly similar to qemu URIS) so that hypervisors with different storage specification would need a conversion. This would allow to specify the targets as: vda - disk name /path/to/file - legacy way, path file:///path/to/file - new way of file paths block:///dev/blah - new way, block devs gluster://server/vol/img - new way, remote images ... Possible caveats: RBD for example allows to use multiple hosts and we'd need to introduce a possibility to specify it if we'd add support for this on rbd. Superficially this is appealing, however, what I dislike about it is that it has no correspondance to the way you specify the targets in the XML file. So apps would need to know two different formats for dealing with network disks. The RBD multiple hosts issues is another concern. 2) Export the image chain in the XML and allow to use indexed disk names This option would require to export the backing chain in the XML in some way, either the existing disk source specification in multiple elements (which I don't like as it is a bit convoluted), or possibly again via URIs. Then the user would be allowed to specify vda[2] for the second backing image of the vda disk. With this the internal representations of the backing chain would be used without the need for the user to specify path. To me this is more appealing because of its simplicity. I think I would rather like us to expose the backing store info explicitly in the XML if we go this route, so that the index values are explicitly visible to apps using the XML. Ok, for the block chain operations this seems to be the most viable idea here. One further thing we should discuss is the block copy job, where we need to specify a new path that is not part of the backing chain of the disk where the disk gets copied (and efectively becomes the new single element of the backing chain). The for this operation has a very similar interface which we need to figure out too sooner or later. Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/4] libxl: queue domain event earlier in shutdown handler
Michal Privoznik wrote: On 21.02.2014 00:02, Jim Fehlig wrote: The shutdown handler may restart a domain when handling a reboot event or when on_* is set to 'restart'. Restarting consists of calling libxlVmCleanup followed by libxlVmStart. libxlVmStart will emit a VIR_DOMAIN_EVENT_STARTED event, but the SHUTDOWN event is not emitted until exiting the shutdown handler, after the STARTED event. Queue the event immediately after creation to avoid emitting it after the start event. Signed-off-by: Jim Fehlig jfeh...@suse.com --- src/libxl/libxl_driver.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 721577d..e600de7 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -376,6 +376,8 @@ libxlDomainShutdownThread(void *opaque) dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); +if (dom_event) +libxlDomainEventQueue(driver, dom_event); switch (vm-def-onPoweroff) { case VIR_DOMAIN_LIFECYCLE_DESTROY: reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; @@ -390,6 +392,8 @@ libxlDomainShutdownThread(void *opaque) dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); +if (dom_event) +libxlDomainEventQueue(driver, dom_event); switch (vm-def-onCrash) { case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY: reason = VIR_DOMAIN_SHUTOFF_CRASHED; @@ -404,6 +408,8 @@ libxlDomainShutdownThread(void *opaque) dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); +if (dom_event) +libxlDomainEventQueue(driver, dom_event); switch (vm-def-onReboot) { case VIR_DOMAIN_LIFECYCLE_DESTROY: reason = VIR_DOMAIN_SHUTOFF_SHUTDOWN; @@ -437,8 +443,6 @@ restart: cleanup: if (vm) virObjectUnlock(vm); -if (dom_event) -libxlDomainEventQueue(driver, dom_event); libxl_event_free(ctx, ev); VIR_FREE(shutdown_info); } Wouldn't it be better to enqueue events at the beginning of 'destroy' and 'restart' labels? I'm thinking about something among these lines: Yes, agreed. As discussed on IRC, better to enqueue the event at the labels since it is one less call to libxlDomainEventQueue, and improves the code to handle any future on_foo action. Regards, Jim diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0b9bf7d..c009407 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -425,6 +425,10 @@ libxlDomainShutdownThread(void *opaque) } destroy: +if (dom_event) { +libxlDomainEventQueue(driver, dom_event); +dom_event = NULL; +} libxl_domain_destroy(ctx, vm-def-id, NULL); if (libxlVmCleanupJob(driver, vm, reason)) { if (!vm-persistent) { @@ -435,6 +439,10 @@ destroy: goto cleanup; restart: +if (dom_event) { +libxlDomainEventQueue(driver, dom_event); +dom_event = NULL; +} libxl_domain_destroy(ctx, vm-def-id, NULL); libxlVmCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); libxlVmStart(driver, vm, 0, -1); Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] cpu: break out when a right cpuCandidate found
On Thu, Feb 13, 2014 at 07:44:20 +, Wangyufei (James) wrote: From 8123c5d64f940fa0fb0de32fc5e68035980b6b01 Mon Sep 17 00:00:00 2001 From: WangYufei james.wangyu...@huawei.com Date: Thu, 13 Feb 2014 07:17:11 + Subject: [PATCH] cpu: break out when a right cpuCandidate found In function x86Decode there's a code segment in while cycle like this: if (cpuModel == NULL || cpuModel-nfeatures cpuCandidate-nfeatures) { virCPUDefFree(cpuModel); cpuModel = cpuCandidate; cpuData = candidate-data; } else { virCPUDefFree(cpuCandidate); } when it finds the right cpuCandidate, it doesn't break out the cycle, but continues run in it, and cpuModel will never get a new value, it's meaningless. It should break out when a right cpuCndidate found. That's mainly because we don't know we already have the right candidate. The next one may actually be better. On other words, the cpuCandidate we get in later iterations may satisfy the cpuModel-nfeatures cpuCandidate-nfeatures and thus it may be better than cpuModel stored in earlier iterations. What are you trying to fix here? Are you just trying to optimize the code or do you see a wrong CPU model to be selected in some situations? Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] RFE: Make saveDir/cacheDir/snapshotDir/dumpDir configurable and allow per-domain paths
Hi, I would like to separate all data of libvirt domains so that each domain can easily be deleted securely. However libvirt by default uses static directories to store data from domains such as snapshots, current states and dumps. Also a cache dir is used for reasons unknown to me. To separate the data, I would like to use different directories for each domain. For this these paths need to be configurable e.g. in qemu.conf and it needs to be possible to for example specify a placeholder in the path that is substituted by the domain's name, so that e.g.: /srv/{name}/save/ can be specified to use /srv/dom1/save/dom1.save as save path. This change should have low impact on regular users, because the defaults can be set to match the current behaviour. What is your opinion on this? Do you have any ideas about how to do the name substitution best? Kind regards Till P.S.: I am not subscribed to the list so please CC me. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Document the keyboard as a valid input type
On 02/24/2014 02:55 AM, Ján Tomko wrote: Commit bc18373 added a new input type, but didn't change the documentation. --- docs/formatdomain.html.in | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ea1a97b..400de07 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3847,15 +3847,16 @@ qemu-kvm -net nic,model=? /dev/null ... lt;devicesgt; lt;input type='mouse' bus='usb'/gt; +lt;input type='keyboard' bus='usb'/gt; lt;/devicesgt; .../pre dl dtcodeinput/code/dt ddThe codeinput/code element has one mandatory attribute, -the codetype/code whose value can be either 'mouse' or -'tablet'. The latter provides absolute -cursor movement, while the former uses relative movement. The optional +the codetype/code whose value can be 'mouse', 'tablet' or +'keyboard'. The tablet provides absolute cursor movement, ACK if you also add a span for a 'since 1.2.2' designation on keyboard. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 5/7] conf: new function virDomainActualNetDefContentsFormat
On 21.02.2014 17:37, Laine Stump wrote: This function is currently only called from one place, but in a subsequent patch will be called from a 2nd place. The new function exactly replicates the original behavior of the part of virDomainActualNetDefFormat() that it replaces, but takes a virDomainNetDefPtr instead of virDomainActualNetDefPtr, and uses the virDomainNetGetActual*() functions whenever possible, rather than reaching into def-data.network.actual - this is to be sure that we are reporting exactly what is being used internally, just in case there are any discrepancies (there shouldn't be). --- Change from V1: I noticed during testing that bandwidth from a portgroup wasn't properly displayed if the network was forward mode='nat|route'. Fixing this required changing the conditions for using virDomainActualNetDefContentsFormat() - it must be used for those types of network as well, and when that is the case, we need to be sure to output the source element, as it otherwise would be skipped. src/conf/domain_conf.c | 113 + 1 file changed, 76 insertions(+), 37 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 67fc372..8291b73 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15427,78 +15427,112 @@ virDomainHostdevDefFormatCaps(virBufferPtr buf, return 0; } +/* virDomainActualNetDefContentsFormat() - format just the subelements + * of interface that may be overridden by what is in the + * virDomainActualNetDef, but inside the current element, rather + * than enclosed in an actual subelement. + */ static int -virDomainActualNetDefFormat(virBufferPtr buf, -virDomainActualNetDefPtr def, -unsigned int flags) +virDomainActualNetDefContentsFormat(virBufferPtr buf, +virDomainNetDefPtr def, +const char *typeStr, +bool inSubelement, +unsigned int flags) { -const char *type; const char *mode; -if (!def) -return 0; - -type = virDomainNetTypeToString(def-type); -if (!type) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _(unexpected net type %d), def-type); -return -1; -} - -virBufferAsprintf(buf, actual type='%s', type); -if (def-type == VIR_DOMAIN_NET_TYPE_HOSTDEV -def-data.hostdev.def.managed) { -virBufferAddLit(buf, managed='yes'); -} -virBufferAddLit(buf, \n); - -virBufferAdjustIndent(buf, 2); -switch (def-type) { +switch (virDomainNetGetActualType(def)) { case VIR_DOMAIN_NET_TYPE_BRIDGE: virBufferEscapeString(buf, source bridge='%s'/\n, - def-data.bridge.brname); + virDomainNetGetActualBridgeName(def)); break; case VIR_DOMAIN_NET_TYPE_DIRECT: virBufferAddLit(buf, source); -if (def-data.direct.linkdev) -virBufferEscapeString(buf, dev='%s', - def-data.direct.linkdev); +virBufferEscapeString(buf, dev='%s', + virDomainNetGetActualDirectDev(def)); -mode = virNetDevMacVLanModeTypeToString(def-data.direct.mode); +mode = virNetDevMacVLanModeTypeToString(virDomainNetGetActualDirectMode(def)); if (!mode) { virReportError(VIR_ERR_INTERNAL_ERROR, _(unexpected source mode %d), - def-data.direct.mode); + virDomainNetGetActualDirectMode(def)); return -1; } virBufferAsprintf(buf, mode='%s'/\n, mode); break; case VIR_DOMAIN_NET_TYPE_HOSTDEV: -if (virDomainHostdevDefFormatSubsys(buf, def-data.hostdev.def, +if (virDomainHostdevDefFormatSubsys(buf, virDomainNetGetActualHostdev(def), flags, true) 0) { return -1; } break; case VIR_DOMAIN_NET_TYPE_NETWORK: -if (def-class_id) -virBufferAsprintf(buf, class id='%u'/, def-class_id); +if (!inSubelement) { +/* the source element isn't included in actual + * (i.e. when we're putting our output into a subelement + * rather than inline) because the main element has the + * same info already. If we're outputting inline, though, + * we *do* need to output source, because the caller + * won't have done it. + */ +virBufferEscapeString(buf, source network='%s'/\n, + def-data.network.name); +} +if (def-data.network.actual def-data.network.actual-class_id) +virBufferAsprintf(buf, class id='%u'/\n, +
Re: [libvirt] [PATCH 7/7] network: include plugged interface XML in plugged network hook
On 21.02.2014 14:58, Laine Stump wrote: The network hook script gets called whenever an interface is plugged into or unplugged from a network, but even though the full XML of both the network and the domain is included, there is no reasonable way to determine what exact resources the plugged interface is using: 1) Prior to a recent patch which modified the status XML of interfaces to include the information about actual hardware resources used, it would be possible to scan through the domain XML output sent to the hook, and from there find the correct interface, but that interface definition would not include any runtime info (e.g. bandwidth or vlan taken from a portgroup, or which physdev was used in case of a macvtap network). 2) After the patch modifying the status XML of interfaces, the network name would no longer be included in the domain XML, so it would be completely impossible to determine which interface was the one being plugged. To solve that problem, this patch includes a single interface element at the beginning of the XML sent to the network hook for plugged and unplugged (just inside hookData) that is the status XML of the interface being plugged. This XML will include all info gathered from the chosen network and portgroup. NB: due to hardcoded spaces in all of the device *Format() functions, the interface element inside the hookData will be indented by 6 spaces rather than 2. I had intended to fix this, but it turns out that to make virDomainNetDefFormat() indentation relative, I would have to do the same to virDomainDeviceInfoFormat(), and that function is called from 19 places - making that a prerequisite of this patch would cause too many merge difficulties if we needed to backport network hooks, so I chose to ignore the problem here and fix the problem for *all* devices in a followup later. --- src/network/bridge_driver.c | 48 ++--- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index a6c719d..152bd06 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -141,6 +141,7 @@ networkObjFromNetwork(virNetworkPtr net) static int networkRunHook(virNetworkObjPtr network, virDomainDefPtr dom, + virDomainNetDefPtr iface, int op, int sub_op) { @@ -158,6 +159,8 @@ networkRunHook(virNetworkObjPtr network, virBufferAddLit(buf, hookData\n); virBufferAdjustIndent(buf, 2); +if (iface virDomainNetDefFormat(buf, iface, 0) 0) +goto cleanup; if (virNetworkDefFormatBuf(buf, network-def, 0) 0) goto cleanup; if (dom virDomainDefFormatInternal(dom, 0, buf) 0) @@ -2067,7 +2070,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, /* Run an early hook to set-up missing devices. * If the script raised an error abort the launch. */ -if (networkRunHook(network, NULL, +if (networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_START, VIR_HOOK_SUBOP_BEGIN) 0) goto cleanup; @@ -2092,7 +2095,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, } /* finally we can call the 'started' hook script if any */ -if (networkRunHook(network, NULL, +if (networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_STARTED, VIR_HOOK_SUBOP_BEGIN) 0) goto cleanup; @@ -2158,7 +2161,7 @@ static int networkShutdownNetwork(virNetworkDriverStatePtr driver, } /* now that we know it's stopped call the hook if present */ -networkRunHook(network, NULL, VIR_HOOK_NETWORK_OP_STOPPED, +networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_STOPPED, VIR_HOOK_SUBOP_END); network-active = 0; @@ -3659,14 +3662,8 @@ validate: } } -/* finally we can call the 'plugged' hook script if any */ -if (networkRunHook(network, dom, - VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, - VIR_HOOK_SUBOP_BEGIN) 0) -goto error; - if (dev) { -/* we are now assured of success, so mark the allocation */ +/* mark the allocation */ dev-connections++; if (actualType != VIR_DOMAIN_NET_TYPE_HOSTDEV) { VIR_DEBUG(Using physical device %s, %d connections, @@ -3684,6 +3681,19 @@ validate: VIR_DEBUG(Using network %s, %d connections, netdef-name, netdef-connections); } + +/* finally we can call the 'plugged' hook script if any */ +if (networkRunHook(network, dom, iface, + VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, + VIR_HOOK_SUBOP_BEGIN) 0) { +
Re: [libvirt] [PATCH 3/7] conf: make virDomainNetDefFormat a public function
On 21.02.2014 14:58, Laine Stump wrote: We will need to call virDomainNetDefFormat() from the network hook (in the network driver). --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 4 src/libvirt_private.syms | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 755066c..b5b70cd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15504,7 +15504,7 @@ virDomainActualNetDefFormat(virBufferPtr buf, return 0; } -static int +int virDomainNetDefFormat(virBufferPtr buf, virDomainNetDefPtr def, unsigned int flags) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 97d6337..2467f65 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2402,6 +2402,10 @@ int virDomainDiskSourceDefFormatInternal(virBufferPtr buf, virDomainDiskSourcePoolDefPtr srcpool, unsigned int flags); +int virDomainNetDefFormat(virBufferPtr buf, + virDomainNetDefPtr def, + unsigned int flags); + int virDomainDefCompatibleDevice(virDomainDefPtr def, virDomainDeviceDefPtr dev); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0896287..bb7b6da 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -300,6 +300,7 @@ virDomainMemballoonModelTypeFromString; virDomainMemballoonModelTypeToString; virDomainMemDumpTypeFromString; virDomainMemDumpTypeToString; +virDomainNetDefFormat; virDomainNetDefFree; virDomainNetFind; virDomainNetFindIdx; ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Compiling libvirt RPC client library for QNX
On 02/24/2014 05:58 AM, Panday Ritesh Sharma (rpanday) wrote: [please don't top-post on technical lists] Hi Roman, Before I jump to the compilation of libvirt for QNX, I thought of compiling it on linux with my required options. So that I will be knowing what all files are of my use (from compilation log). For that I ran ./configure with below option and then tried 'make'. But 'make' complains there is no 'makefile' and I need to run './configure' before I run 'make'. Please see the log below. Am I missing any thing here ? checking whether to compile with virtual port support... yes checking for LIBNL... no configure: error: libnl-devel = 1.1 is required for macvtap support You missed reading this error message. You either need libnl-devel installed, or to pass additional --without-* options to configure that avoid whatever was assuming that libnl was required (based on the error message, you might have luck with './configure --without-macvtap' if you aren't in the mood to install things). It may also be worth patching libvirt to behave saner by automatically avoiding macvtap when libnl is not available; patches are welcome, but it's lower priority for most developers, since most of us tend to build on machines with all the prereqs installed rather than focusing on minimal builds. blr-vxr-052~$ make There seems to be no Makefile in this directory. You must run ./configure before running `make'. make: *** [abort-due-to-no-makefile] Error 1 blr-vxr-052~$ Therefore it is no surprise that there was no makefile created. Oftentimes, I recommend using './configure make' rather than './configure; make', so that 'make' is not attempted if configure fails. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/7] conf: handle null pointer in virNetDevVlanFormat
On 21.02.2014 14:58, Laine Stump wrote: Other *Format() functions (e.g. virNetDevBandwidthFormat()) return with no action when called with a NULL *Def pointer. This makes virNetDevVlanFormat() consistent with that behavior. --- src/conf/netdev_vlan_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c index f58b4b8..dbe203e 100644 --- a/src/conf/netdev_vlan_conf.c +++ b/src/conf/netdev_vlan_conf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 Red Hat, Inc. + * Copyright (C) 2009-2014 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 @@ -144,7 +144,7 @@ virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf) { size_t i; -if (def-nTags == 0) +if (!(def def-nTags)) return 0; if (!def-tag) { ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 6/7] conf: output actual netdev status in interface XML
On 21.02.2014 17:41, Laine Stump wrote: Until now, the live XML status of an interface type='network' device would always show the network information, rather than the exact hardware device that was used. It would also show the name any portgroup the interface belonged to, rather than providing the configuration that was derived from the portgroup. As an example, given the following network definition: [A] network nametestnet/name forward type='bridge' dev='p4p1_0' interface dev='p4p1_0'/ interface dev='p4p1_1'/ interface dev='p4p1_2'/ interface dev='p4p1_3'/ /forward portgroup name='admin' bandwidth inbound average='1000' peak='5000' burst='1024'/ outbound average='128' peak='256' burst='256'/ /bandwidth /portgroup /network and the following domain interface: [B] interface type='network' source network='testnet' portgroup='admin'/ /interface the output of virsh dumpxml $domain while the domain was running would yield something like this: [C] interface type='network' source network='testnet' portgroup='admin'/ target dev='macvtap0'/ alias name='net0'/ address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/ /interface In order to learn the exact bandwidth information of the interface, a management application would need to retrieve the XML for testnet, then search for the portgroup named admin. Even worse, there was no simple and standard way to learn which host physdev the macvtap0 device is attached to. Internally, libvirt has always kept this information in the virDomainDef that's held in memory, as well as storing it in the (libvirt-internal-only) domain status XML (in /etc/libvirt/qemu/$domain.xml). In order to not confuse the runtime I believe the status XMLs are kept under /var/run/libvirt/qemu/$domain.xml actual state with the config of the device, it's internally stored like this: [D] interface type='network' source network='testnet' portgroup='admin'/ actual type='direct' source dev='p4p1_0' mode='bridge'/ bandwidth inbound average='1000' peak='5000' burst='1024'/ outbound average='128' peak='256' burst='256'/ /bandwidth /actual target dev='macvtap0'/ alias name='net0'/ address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/ /interface This was never exposed outside of libvirt though, because I thought it would be too awkward for a management application to need to look in two places for the same information, but I also wasn't sure that it would be okay to overwrite the config info (in this case source network='testnet' portgroup='admin'/) with the actual runtime info (everything inside actual above). Now the time has come that this information must be made available to management applications (in particular, so that a network plugged hook will have full information about the device that is being plugged in), so it's time to take the leap and decide that it is acceptable for the config info to be replaced with actual runtime state (but *only* when reporting domain live status, *not* when saving state in /etc/libvirt/qemu/$domain.xml - that remains the same so that there is no loss of information). That is what this patch does. With this patch applied, the output of virsh dumpxml $domain when the domain is running will contain something like this: [E] interface type='direct' source dev='p4p1_0' mode='bridge'/ bandwidth inbound average='1000' peak='5000' burst='1024'/ outbound average='128' peak='256' burst='256'/ /bandwidth target dev='macvtap0'/ alias name='net0'/ address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/ /interface In effect, everything that is internally stored within actual is moved up a level to where a management application will expect it. This means that the management application will only look in a single place to learn - the type of interface in use, the name of the physdev (if relevant), the bandwidth, vlan, and virtualport settings in use. The potential downside is that a management app looking at this output will not see that the physdev 'p4p1_0' was actually allocated from the network named 'testnet', or that the bandwidth numbers were taken from the portgroup 'admin'. However, if they are interested in that info, they can always get the inactive XML for the domain. An example of where this could cause problems is in virt-manager's network device display, which shows the status of the device, but allows you to edit that status info and save it as the new config. Previously virt-manager would always display the information in example [C] above, and allow editing that. With this patch, it will instead display what is in [E] and allow editing it directly, which could lead to some confusion. I would suggest that virt-manager have an edit
Re: [libvirt] [PATCH 4/7] conf: re-situate bandwidth element in interface
On 21.02.2014 14:58, Laine Stump wrote: This moves the call to virNetDevBandwidthFormat() in virDomainNetDefFormat() to be called right after the call to virNetDevVPortProfileFormat(), so that a single chunk of that function can be placed inside an if that conditionally calls virDomainActualNetDefContentsFormat() instead (next patch). The re-ordering necessitates modifying a couple of test data files. --- src/conf/domain_conf.c | 6 +++--- .../qemuhotplug-console-compat-2+console-virtio.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml| 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b5b70cd..67fc372 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15599,6 +15599,9 @@ virDomainNetDefFormat(virBufferPtr buf, return -1; if (virNetDevVPortProfileFormat(def-virtPortProfile, buf) 0) return -1; +if (virNetDevBandwidthFormat(def-bandwidth, buf) 0) +return -1; + virBufferEscapeString(buf, script path='%s'/\n, def-script); if (def-ifname @@ -15651,9 +15654,6 @@ virDomainNetDefFormat(virBufferPtr buf, virDomainNetInterfaceLinkStateTypeToString(def-linkstate)); } -if (virNetDevBandwidthFormat(def-bandwidth, buf) 0) -return -1; - virBufferAdjustIndent(buf, -6); if (virDomainDeviceInfoFormat(buf, def-info, diff --git a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml index a484e82..25fc120 100644 --- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml +++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml @@ -59,12 +59,12 @@ interface type='network' mac address='52:54:00:ea:35:6f'/ source network='default'/ - target dev='vnet0'/ - model type='virtio'/ bandwidth inbound average='4000' peak='8000' floor='200' burst='1024'/ outbound average='4000' peak='8000' burst='1024'/ /bandwidth + target dev='vnet0'/ + model type='virtio'/ alias name='net0'/ address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/ /interface diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml index 065ef2d..e5c45a3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml @@ -59,12 +59,12 @@ interface type='network' mac address='52:54:00:ea:35:6f'/ source network='default'/ - target dev='vnet0'/ - model type='virtio'/ bandwidth inbound average='4000' peak='8000' floor='200' burst='1024'/ outbound average='4000' peak='8000' burst='1024'/ /bandwidth + target dev='vnet0'/ + model type='virtio'/ alias name='net0'/ address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/ /interface diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml index 064a05f..f70e20a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml @@ -45,11 +45,11 @@ interface type='network' mac address='52:54:00:24:a5:9f'/ source network='default'/ - model type='rtl8139'/ bandwidth inbound average='1000' peak='4000' burst='1024'/ outbound average='128' peak='256' burst='32768'/ /bandwidth + model type='rtl8139'/ address type='pci' domain='0x' bus='0x00' slot='0x07' function='0x0'/ /interface serial type='pty' Yup. since there can be only one bandwidth/ sub-element right now, the ordering should not matter. ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/7] conf: clarify what is returned for actual bandwidth and vlan
On 21.02.2014 14:58, Laine Stump wrote: In practice, if a virDomainNetDef has a virDomainActualNetDef allocated, the ActualNetDef will *always* contain the bandwidth and vlan data from the NetDef (unless there was also a portgroup involved - see networkAllocateActualDevice()). However, virDomainNetGetActual(Bandwidth|Vlan)() were coded to make it appear as if it might be possible to have a valid bandwidth/vlan in the NetDef, but a NULL in the ActualNetDef. Believing this un-truth could lead to writing unnecessarily defensive code when dealing with the virDomainGetActual*() functions, so this patch makes it more obvious: If there is an ActualNetDef, it will always have a copy of the various appropriate bits from its parent NetDef, and the virDomainGetActual* function will *always* return the data from the ActualNetDef, not from the NetDef. The reason for this effective-NOP patch is that a subsequent patch to change virDomainNetDefFormat will rely on the above rule. --- src/conf/domain_conf.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 064a40e..755066c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18638,8 +18638,11 @@ virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface) virNetDevBandwidthPtr virDomainNetGetActualBandwidth(virDomainNetDefPtr iface) { +/* if there is an ActualNetDef, *always* return + * its bandwidth rather than the NetDef's bandwidth. + */ if (iface-type == VIR_DOMAIN_NET_TYPE_NETWORK -iface-data.network.actual iface-data.network.actual-bandwidth) { +iface-data.network.actual) { return iface-data.network.actual-bandwidth; } return iface-bandwidth; @@ -18648,12 +18651,17 @@ virDomainNetGetActualBandwidth(virDomainNetDefPtr iface) virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface) { +virNetDevVlanPtr vlan = iface-vlan; + +/* if there is an ActualNetDef, *always* return + * its vlan rather than the NetDef's vlan. + */ if (iface-type == VIR_DOMAIN_NET_TYPE_NETWORK -iface-data.network.actual -iface-data.network.actual-vlan.nTags 0) -return iface-data.network.actual-vlan; -if (iface-vlan.nTags 0) -return iface-vlan; +iface-data.network.actual) +vlan = iface-data.network.actual-vlan; + +if (vlan-nTags 0) +return vlan; return 0; When you're at this, can you s/0/NULL/? We are returning a pointer after all. } ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Compiling libvirt RPC client library for QNX
On 02/22/2014 12:47 PM, Panday Ritesh Sharma (rpanday) wrote: HI Team, I have downloaded the libvirt source code from libvirt_0.9.8.orig.tar.gzhttps://launchpad.net/ubuntu/+archive/primary/+files/libvirt_0.9.8.orig.tar.gz . I just wanted libvirt RPC client library to be compiled for QNX. 0.9.8 is really old. I'd highly recommend trying a newer client, such as 1.2.1 (or wait a week for 1.2.2) - we have fixed bugs in the meantime where older packages did not build as well for non-Linux machines. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 0/8] Improve logging when QEMU caps fails
A followup to https://www.redhat.com/archives/libvir-list/2014-February/msg01395.html In v2: - Added several docs improvements - Fixed typos - Add missing translation Daniel P. Berrange (8): Send virLogMetadata fields onto the journal Fix journald PRIORITY values Fix heading level in logging docs Auto-generate the table of contents in logging doc Add docs about use of systemd journal for logging Include error domain and code in log messages from errors Add comments describing the different log sources Generate a unique journald log for QEMU capabilities failure docs/logging.html.in | 124 --- src/qemu/qemu_capabilities.c | 30 ++- src/util/virerror.c | 8 ++- src/util/virlog.c| 40 -- src/util/virlog.h| 10 ++-- 5 files changed, 170 insertions(+), 42 deletions(-) -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 1/8] Send virLogMetadata fields onto the journal
The systemd journal accepts arbitrary user specified log fields. These can be passed into virLogMessage via the virLogMetadata structure. Allow up to 5 custom fields to be reported by libvirt callers. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/util/virlog.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index 32714ce..b8f539e 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1153,7 +1153,7 @@ virLogOutputToJournald(virLogSource source, int linenr, const char *funcname, const char *timestamp ATTRIBUTE_UNUSED, - virLogMetadataPtr metadata ATTRIBUTE_UNUSED, + virLogMetadataPtr metadata, unsigned int flags, const char *rawstr, const char *str ATTRIBUTE_UNUSED, @@ -1172,8 +1172,11 @@ virLogOutputToJournald(virLogSource source, * be a tmpfs, and one that is available from early boot on * and where unprivileged users can create files. */ char path[] = /dev/shm/journal.XX; +size_t nmetadata = 0; -# define NUM_FIELDS 6 +# define NUM_FIELDS_CORE 6 +# define NUM_FIELDS_META 5 +# define NUM_FIELDS (NUM_FIELDS_CORE + NUM_FIELDS_META) struct iovec iov[NUM_FIELDS * 5]; char iov_bufs[NUM_FIELDS][JOURNAL_BUF_SIZE]; struct journalState state; @@ -1192,6 +1195,17 @@ virLogOutputToJournald(virLogSource source, journalAddInt(state, CODE_LINE, linenr); if (funcname) journalAddString(state, CODE_FUNC, funcname); +if (metadata != NULL) { +while (metadata-key != NULL + nmetadata NUM_FIELDS_META) { +if (metadata-s != NULL) +journalAddString(state, metadata-key, metadata-s); +else +journalAddInt(state, metadata-key, metadata-iv); +metadata++; +nmetadata++; +} +} memset(sa, 0, sizeof(sa)); sa.sun_family = AF_UNIX; -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 2/8] Fix journald PRIORITY values
The systemd journal expects log record PRIORITY values to be encoded using the syslog compatible numbering scheme, not libvirt's own native numbering scheme. We must therefore apply a conversion. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/util/virlog.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index b8f539e..68af0f3 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1000,7 +1000,22 @@ virLogAddOutputToFile(virLogPriority priority, } -#if HAVE_SYSLOG_H +#if HAVE_SYSLOG_H || USE_JOURNALD + +/* Compat in case we build with journald, but no syslog */ +# ifndef LOG_DEBUG +# define LOG_DEBUG 7 +# endif +# ifndef LOG_INFO +# define LOG_INFO 6 +# endif +# ifndef LOG_WARNING +# define LOG_WARNING 4 +# endif +# ifndef LOG_ERR +# define LOG_ERR 3 +# endif + static int virLogPrioritySyslog(virLogPriority priority) { @@ -1017,8 +1032,10 @@ virLogPrioritySyslog(virLogPriority priority) return LOG_ERR; } } +#endif /* HAVE_SYSLOG_H || USE_JOURNALD */ +#if HAVE_SYSLOG_H static void virLogOutputToSyslog(virLogSource source ATTRIBUTE_UNUSED, virLogPriority priority, @@ -1187,7 +1204,8 @@ virLogOutputToJournald(virLogSource source, state.bufs_end = iov_bufs + ARRAY_CARDINALITY(iov_bufs); journalAddString(state, MESSAGE, rawstr); -journalAddInt(state, PRIORITY, priority); +journalAddInt(state, PRIORITY, + virLogPrioritySyslog(priority)); journalAddString(state, LIBVIRT_SOURCE, virLogSourceTypeToString(source)); if (filename) -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 8/8] Generate a unique journald log for QEMU capabilities failure
When probing QEMU capabilities fails for a binary generate a log message with MESSAGE_ID==8ae2f3fb-2dbe-498e-8fbd-012d40afa361. This can be directly queried from journald based on the UUID instead of needing string grep. This lets tools like libguestfs' bug reporting tool trivially do automated sanity tests on the host they're running on. $ journalctl MESSAGE_ID=8ae2f3fb-2dbe-498e-8fbd-012d40afa361 Feb 21 17:11:01 localhost.localdomain lt-libvirtd[9196]: Failed to probe capabilities for /bin/qemu-system-alpha: internal error: Child process (LC_ALL=C LD_LIBRARY_PATH= /home/berrange/src/virt/libvirt/src/.libs PATH=/usr/lib64/ ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin: /usr/bin:/root/bin HOME=/root USER=root LOGNAME=root /bin/qemu-system-alpha -help) unexpected exit status 127: /bin/qemu-system-alpha: error while loading shared libraries: libglapi.so.0: cannot open shared object file: No such file or directory $ journalctl MESSAGE_ID=8ae2f3fb-2dbe-498e-8fbd-012d40afa361 --output=json { ...snip... LIBVIRT_SOURCE : file, PRIORITY : 3, CODE_FILE : qemu/qemu_capabilities.c, CODE_LINE : 2770, CODE_FUNC : virQEMUCapsLogProbeFailure, MESSAGE_ID : 8ae2f3fb-2dbe-498e-8fbd-012d40afa361, LIBVIRT_QEMU_BINARY : /bin/qemu-system-xtensa, MESSAGE : Failed to probe capabilities for /bin/qemu-system-xtensa: internal error: Child process (LC_ALL=C LD_LIBRARY_PATH=/home/berrange /src/virt/libvirt/src/.libs PATH=/usr/lib64/ccache:/usr/local/sbin: /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin HOME=/root USER=root LOGNAME=root /bin/qemu-system-xtensa -help) unexpected exit status 127: /bin/qemu-system-xtensa: error while loading shared libraries: libglapi.so.0: cannot open shared object file: No such file or directory\n } Signed-off-by: Daniel P. Berrange berra...@redhat.com --- docs/logging.html.in | 44 src/qemu/qemu_capabilities.c | 30 -- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/docs/logging.html.in b/docs/logging.html.in index f8c57f8..ed8e7e3 100644 --- a/docs/logging.html.in +++ b/docs/logging.html.in @@ -179,6 +179,50 @@ ddThe libvirt error code (values from virErrorCode enum), if LIBVIRT_SOURCE=error/dd /dl +h3a name=journaldidsWell known message ID values/a/h3 + +p + Certain areas of the code will emit log records tagged with well known + unique id values, which are guaranteed never to change in the future. + This allows applications to identify critical log events without doing + string matching on the codeMESSAGE/code field. +/p + +dl + dtcodeMESSAGE_ID=8ae2f3fb-2dbe-498e-8fbd-012d40afa361/code/dt + ddGenerated by the QEMU driver when it identifies a QEMU system +emulator binary, but is unable to extract information about its +capabilities. This is usually an indicator of a broken QEMU +build or installation. When this is emitted, the codeLIBVIRT_QEMU_BINARY/code +message field will provide the full path of the QEMU binary that failed. + /dd +/dl + +p + The codejournalctl/code commnd can be used to search the journal + matching on specific message ID values +/p + +pre + $ journalctl MESSAGE_ID=8ae2f3fb-2dbe-498e-8fbd-012d40afa361 --output=json + { ...snip... + LIBVIRT_SOURCE : file, + PRIORITY : 3, + CODE_FILE : qemu/qemu_capabilities.c, + CODE_LINE : 2770, + CODE_FUNC : virQEMUCapsLogProbeFailure, + MESSAGE_ID : 8ae2f3fb-2dbe-498e-8fbd-012d40afa361, + LIBVIRT_QEMU_BINARY : /bin/qemu-system-xtensa, + MESSAGE : Failed to probe capabilities for /bin/qemu-system-xtensa: \ + internal error: Child process (LC_ALL=C LD_LIBRARY_PATH=/home/berrange \ + /src/virt/libvirt/src/.libs PATH=/usr/lib64/ccache:/usr/local/sbin: \ + /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin HOME=/root \ + USER=root LOGNAME=root /bin/qemu-system-xtensa -help) unexpected \ + exit status 127: /bin/qemu-system-xtensa: error while loading shared \ + libraries: libglapi.so.0: cannot open shared object file: No such \ + file or directory\n } +/pre + h2 a name=log_examplesExamples/a /h2 diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d618b3f..76a8c73 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2754,6 +2754,28 @@ cleanup: } +#define MESSAGE_ID_CAPS_PROBE_FAILURE 8ae2f3fb-2dbe-498e-8fbd-012d40afa361 + +static void +virQEMUCapsLogProbeFailure(const char *binary) +{ +virLogMetadata meta[] = { +{ .key = MESSAGE_ID, .s = MESSAGE_ID_CAPS_PROBE_FAILURE, .iv = 0 }, +{ .key = LIBVIRT_QEMU_BINARY, .s = binary, .iv = 0 }, +{ .key = NULL }, +}; +virErrorPtr err = virGetLastError(); + +
[libvirt] [PATCH v2 6/8] Include error domain and code in log messages from errors
When a virError is raised, pass the error domain and code onto the systemd journald using metadata fields. This allows error messages to be queried by code eg $ journalctl LIBVIRT_CODE=43 Signed-off-by: Daniel P. Berrange berra...@redhat.com --- docs/logging.html.in | 4 src/util/virerror.c | 8 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/logging.html.in b/docs/logging.html.in index 08afa5c..f8c57f8 100644 --- a/docs/logging.html.in +++ b/docs/logging.html.in @@ -173,6 +173,10 @@ ddThe line number of the file emitting the log record/dd dtcodeCODE_FUNC/code/dt ddThe name of the function emitting the log record/dd + dtcodeLIBVIRT_DOMAIN/code/dt + ddThe libvirt error domain (values from virErrorDomain enum), if LIBVIRT_SOURCE=error/dd + dtcodeLIBVIRT_CODE/code/dt + ddThe libvirt error code (values from virErrorCode enum), if LIBVIRT_SOURCE=error/dd /dl h2 diff --git a/src/util/virerror.c b/src/util/virerror.c index 74c6807..820e1ad 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -649,6 +649,11 @@ virRaiseErrorFull(const char *filename ATTRIBUTE_UNUSED, virErrorPtr to; char *str; int priority; +virLogMetadata meta[] = { +{ .key = LIBVIRT_DOMAIN, .s = NULL, .iv = domain }, +{ .key = LIBVIRT_CODE, .s = NULL, .iv = code }, +{ .key = NULL }, +}; /* * All errors are recorded in thread local storage @@ -703,10 +708,11 @@ virRaiseErrorFull(const char *filename ATTRIBUTE_UNUSED, priority = virErrorLevelPriority(level); if (virErrorLogPriorityFilter) priority = virErrorLogPriorityFilter(to, priority); + virLogMessage(virErrorLogPriorityFilter ? VIR_LOG_FROM_FILE : VIR_LOG_FROM_ERROR, priority, filename, linenr, funcname, - NULL, %s, str); + meta, %s, str); errno = save_errno; } -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 4/8] Auto-generate the table of contents in logging doc
The logging doc had a hand-written table of contents instead of using the automatic XSL generated one. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- docs/logging.html.in | 21 - 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/docs/logging.html.in b/docs/logging.html.in index ac415f8..08bbd70 100644 --- a/docs/logging.html.in +++ b/docs/logging.html.in @@ -3,27 +3,14 @@ html xmlns=http://www.w3.org/1999/xhtml; body h1 Logging in the library and the daemon/h1 + pLibvirt includes logging facilities starting from version 0.6.0, this complements the a href=errors.htmlerror handling/a mechanism and APIs to allow tracing through the execution of the library as well as in the libvirtd daemon./p -ul - li -a href=#log_libraryLogging in the library/a - /li - li -a href=#log_configConfiguring logging in the library/a - /li - li -a href=#log_daemonLogging in the daemon/a - /li - li -a href=#log_syntaxSyntax for filters and output values/a - /li - li -a href=#log_examplesExamples/a - /li -/ul + +ul id=toc/ + h2 a name=log_libraryLogging in the library/a /h2 -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 5/8] Add docs about use of systemd journal for logging
Document the various fields that libvirt will emit for journal log records. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- docs/logging.html.in | 35 --- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/logging.html.in b/docs/logging.html.in index 08bbd70..08afa5c 100644 --- a/docs/logging.html.in +++ b/docs/logging.html.in @@ -85,9 +85,13 @@ pWhen starting the libvirt daemon, any logging environment variable settings will override settings in the config file. Command line options take precedence over all. If no outputs are defined for libvirtd, it - defaults to logging to /var/log/libvirt/libvirtd.log (before 0.9.0 - it was using syslog) when it is running as a daemon, or to - stderr when it is running in the foreground./p + will try to use/p +ul + li0.10.0 or later: systemd journal, if code/run/systemd/journal/socket/code exists/li + li0.9.0 or later: file code/var/log/libvirt/libvirtd.log/code if running as a daemon/li + libefore 0.9.0: syslog if running as a daemon/li + liall version: to stderr stream if running in the foreground/li +/ul pLibvirtd does not reload its logging configuration when issued a SIGHUP. If you want to reload the configuration, you must do a codeservice libvirtd restart/code or manually stop and restart the daemon @@ -133,6 +137,7 @@ given codename/code as the ident/li licodex:file:file_path/code output to a file, with the given filepath/li + licodex:journald/code output goes to systemd journal/li /ul pIn all cases the x prefix is the minimal level, acting as a filter:/p ul @@ -146,6 +151,30 @@ will log all warnings and errors to syslog under the libvirtd ident but also log all debug and information included in the file code/tmp/libvirt.log/code/p + +h2a name=journaldSystemd journal fields/a/h2 + +p + When logging to the systemd journal, the following fields + are defined, in addition to any automatically recorded + a href=http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html;standard fields/a: +/p + +dl + dtcodeMESSAGE/code/dt + ddThe log message string/dd + dtcodePRIORITY/code/dt + ddThe log priority value/dd + dtcodeLIBVIRT_SOURCE/code/dt + ddThe source type, one of file, error, audit, trace, library/dd + dtcodeCODE_FILE/code/dt + ddThe name of the file emitting the log record/dd + dtcodeCODE_LINE/code/dt + ddThe line number of the file emitting the log record/dd + dtcodeCODE_FUNC/code/dt + ddThe name of the function emitting the log record/dd +/dl + h2 a name=log_examplesExamples/a /h2 -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 3/8] Fix heading level in logging docs
The logging docs went straight from h1 to h3 header level, skipping out h2. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- docs/logging.html.in | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/logging.html.in b/docs/logging.html.in index 1cd15a1..ac415f8 100644 --- a/docs/logging.html.in +++ b/docs/logging.html.in @@ -24,9 +24,9 @@ a href=#log_examplesExamples/a /li /ul -h3 +h2 a name=log_libraryLogging in the library/a -/h3 +/h2 pThe logging functionalities in libvirt are based on 3 key concepts, similar to the one present in other generic logging facilities like log4j:/p @@ -58,9 +58,9 @@ default is 64 kB. This can be used when debugging the library (see the virLogBuffer variable content)./p -h3 +h2 a name=log_configConfiguring logging in the library/a -/h3 +/h2 pThe library configuration of logging is through 3 environment variables allowing to control the logging behaviour:/p ul @@ -79,9 +79,9 @@ you specify an invalid value, it will be ignored with a warning. If you have an error in a filter or output string, some of the settings may be applied up to the point at which libvirt encountered the error./p -h3 +h2 a name=log_daemonLogging in the daemon/a -/h3 +/h2 pSimilarly the daemon logging behaviour can be tuned using 3 config variables, stored in the configuration file:/p ul @@ -110,9 +110,9 @@ by default) in case of crash, this can also be activated explicitly for debugging purposes by sending the daemon a USR2 signal:/p prekillall -USR2 libvirtd/pre -h3 +h2 a name=log_syntaxSyntax for filters and output values/a -/h3 +/h2 pThe syntax for filters and outputs is the same for both types of variables./p pThe format for a filter is one of:/p @@ -159,9 +159,9 @@ will log all warnings and errors to syslog under the libvirtd ident but also log all debug and information included in the file code/tmp/libvirt.log/code/p -h3 +h2 a name=log_examplesExamples/a -/h3 +/h2 pFor example setting up the following:/p preexport LIBVIRT_DEBUG=1 export LIBVIRT_LOG_OUTPUTS=1:file:virsh.log/pre -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: Don't leak buffer if GetFDs fails in cmdCreate
On 02/24/2014 06:29 AM, Ján Tomko wrote: Change the logic of the function to return false by default and move the freeing of the buffer to the cleanup section. https://bugzilla.redhat.com/show_bug.cgi?id=1067338 --- tools/virsh-domain.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) ACK -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2 7/8] Add comments describing the different log sources
Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/util/virlog.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/virlog.h b/src/util/virlog.h index f400824..6ba2daa 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -45,11 +45,11 @@ typedef enum { } virLogDestination; typedef enum { -VIR_LOG_FROM_FILE, -VIR_LOG_FROM_ERROR, -VIR_LOG_FROM_AUDIT, -VIR_LOG_FROM_TRACE, -VIR_LOG_FROM_LIBRARY, +VIR_LOG_FROM_FILE,/* General debugging */ +VIR_LOG_FROM_ERROR, /* Errors reported */ +VIR_LOG_FROM_AUDIT, /* Audit operations */ +VIR_LOG_FROM_TRACE, /* DTrace probe pointers */ +VIR_LOG_FROM_LIBRARY, /* 3rd party libraries */ VIR_LOG_FROM_LAST, } virLogSource; -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] block pull/commit for non-local storage
On 02/24/2014 08:48 AM, Peter Krempa wrote: One further thing we should discuss is the block copy job, where we need to specify a new path that is not part of the backing chain of the disk where the disk gets copied (and efectively becomes the new single element of the backing chain). The for this operation has a very similar interface which we need to figure out too sooner or later. For that interface, I wonder if the best approach is to add a new flag. By default, when the flag is 0, the new disk string is treated as a path name in the local file system. But when the flag is set, the new disk string is treated as an XML document describing the full disk details, which gives us the full flexibility for a volume within a storage pool or the full details of a network device such as gluster, or even a network device that has multiple host subelements. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] block pull/commit for non-local storage
On 02/24/2014 09:53 AM, Eric Blake wrote: On 02/24/2014 08:48 AM, Peter Krempa wrote: One further thing we should discuss is the block copy job, where we need to specify a new path that is not part of the backing chain of the disk where the disk gets copied (and efectively becomes the new single element of the backing chain). The for this operation has a very similar interface which we need to figure out too sooner or later. For that interface, I wonder if the best approach is to add a new flag. By default, when the flag is 0, the new disk string is treated as a path name in the local file system. But when the flag is set, the new disk string is treated as an XML document describing the full disk details, which gives us the full flexibility for a volume within a storage pool or the full details of a network device such as gluster, or even a network device that has multiple host subelements. [I hit send too soon] That is, the shorthand of vda[1] or vda[2] for referring to elements already in the existing block chain works nicely for blockpull and blockcommit; and for blockcopy, reusing existing XML notations for specifying a network destination, the same way we just recently taught snapshots to reuse XML notations, seems like the best way for designating the new location. And since we were smart enough to have a flag argument, I'm fine with using the flag argument for the determination of whether a file string is a local filename vs. an XML disk designation. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] block pull/commit for non-local storage
On Mon, Feb 24, 2014 at 09:53:59AM -0700, Eric Blake wrote: On 02/24/2014 08:48 AM, Peter Krempa wrote: One further thing we should discuss is the block copy job, where we need to specify a new path that is not part of the backing chain of the disk where the disk gets copied (and efectively becomes the new single element of the backing chain). The for this operation has a very similar interface which we need to figure out too sooner or later. For that interface, I wonder if the best approach is to add a new flag. By default, when the flag is 0, the new disk string is treated as a path name in the local file system. But when the flag is set, the new disk string is treated as an XML document describing the full disk details, which gives us the full flexibility for a volume within a storage pool or the full details of a network device such as gluster, or even a network device that has multiple host subelements. If we want to allow XML instead of a path, then I'd suggest we really should create a new API instead of overloading the semantics of 'path'. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] make virDomainGetMaxVcpus work on inactive domains
On 02/19/2014 05:03 AM, Claudio Bley wrote: Signed-off-by: Claudio Bley cb...@av-test.de --- OK, how about this patch? While at it, should I convert the VIR_DOMAIN_VCPU_* instances to VIR_DOMAIN_AFFECT_* instances for consistency? Yes, making that conversion as a separate patch for consistency would be nice. { -return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE | +return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM)); VIR_DOMAIN_AFFECT_CURRENT == 0, so you could simplify this to just passing VIR_DOMAIN_VCPU_MAXIMUM instead of a bitwise-or. On the other hand, making the _CURRENT explicit may be a bit more self-documenting, so I'm not going to insist. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] virsh: kill over-engineered asprintf failure recovery
On 21.02.2014 23:59, Eric Blake wrote: I noticed this while shortning switch statements via VIR_ENUM. Basically, the only ways virAsprintf can fail are if we pass a bogus format string (but we're not THAT bad) or if we run out of memory (but it already warns on our behalf in that case). Throw away the cruft that tries too hard to diagnose a printf failure. * tools/virsh-volume.c (cmdVolList): Simplify. * tools/virsh-pool.c (cmdPoolList): Likewise. Signed-off-by: Eric Blake ebl...@redhat.com --- tools/virsh-pool.c | 73 +--- tools/virsh-volume.c | 66 ++- 2 files changed, 42 insertions(+), 97 deletions(-) ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] virsh: use more compact VIR_ENUM_IMPL
On 21.02.2014 23:59, Eric Blake wrote: Dan Berrange suggested that using VIR_ENUM_IMPL is more compact than open-coding switch statements, and still just as forceful at making us remember to update lists if we add enum values in the future. Make this change throughout virsh. Sure enough, doing this change caught that we missed at least VIR_STORAGE_VOL_NETDIR. * tools/virsh-domain-monitor.c (vshDomainIOErrorToString) (vshDomainControlStateToString, vshDomainStateToString) (vshDomainStateReasonToString): Change switch to enum lookup. (cmdDomControl, cmdDominfo): Update caller. * tools/virsh-domain.c (vshDomainVcpuStateToString) (vshDomainEventToString, vshDomainEventDetailToString): Change switch to enum lookup. (vshDomainBlockJobToString, vshDomainJobToString): New functions. (cmdVcpuinfo, cmdBlockJob, cmdDomjobinfo, cmdEvent): Update callers. * tools/virsh-network.c (vshNetworkEventToString): Change switch to enum lookup. * tools/virsh-pool.c (vshStoragePoolStateToString): New function. (cmdPoolList, cmdPoolInfo): Update callers. * tools/virsh-volume.c (vshVolumeTypeToString): Change switch to enum lookup. (cmdVolInfo, cmdVolList): Update callers. Signed-off-by: Eric Blake ebl...@redhat.com --- tools/virsh-domain-monitor.c | 280 +++--- tools/virsh-domain.c | 347 ++- tools/virsh-network.c| 36 ++--- tools/virsh-pool.c | 66 +++- tools/virsh-volume.c | 38 ++--- 5 files changed, 316 insertions(+), 451 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 6291ca5..c67b833 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1,7 +1,7 @@ /* * virsh-domain-monitor.c: Commands to monitor domain status * - * Copyright (C) 2005, 2007-2013 Red Hat, Inc. + * Copyright (C) 2005, 2007-2014 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 @@ -40,21 +40,18 @@ #include virxml.h #include virstring.h +VIR_ENUM_DECL(vshDomainIOError) +VIR_ENUM_IMPL(vshDomainIOError, + VIR_DOMAIN_DISK_ERROR_LAST, + N_(no error), + N_(unspecified error), + N_(no space)) + static const char * vshDomainIOErrorToString(int error) { -switch ((virDomainDiskErrorCode) error) { -case VIR_DOMAIN_DISK_ERROR_NONE: -return _(no error); -case VIR_DOMAIN_DISK_ERROR_UNSPEC: -return _(unspecified error); -case VIR_DOMAIN_DISK_ERROR_NO_SPACE: -return _(no space); -case VIR_DOMAIN_DISK_ERROR_LAST: -; -} - -return _(unknown error); +const char *str = vshDomainIOErrorTypeToString(error); +return str ? _(str) : _(unknown error); } Why _(str) if str itself already contains translated message? Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] virsh: use more compact VIR_ENUM_IMPL
On 02/24/2014 10:42 AM, Michal Privoznik wrote: +VIR_ENUM_DECL(vshDomainIOError) +VIR_ENUM_IMPL(vshDomainIOError, + VIR_DOMAIN_DISK_ERROR_LAST, + N_(no error), + N_(unspecified error), + N_(no space)) + -return _(unknown error); +const char *str = vshDomainIOErrorTypeToString(error); +return str ? _(str) : _(unknown error); } Why _(str) if str itself already contains translated message? str is NOT translated. C semantics forbid initializing something with a function call, and VIR_ENUM_IMPL is creating an initializer. N_() is a markup that is a no-op to the C compiler (so you aren't violating initializer rules) while still marking a string for translation for the purposes of xgettext scanning; we still have to actually translate the string at some point down the road. Hence, my call to _(str) - where we are translating a string, but where xgettext sees that it is a variable rather than a string literal and so has nothing it can stick in the .po file. You need both halves for translating strings that are stored in an initializer list. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] virsh: use more compact VIR_ENUM_IMPL
On 24.02.2014 18:49, Eric Blake wrote: On 02/24/2014 10:42 AM, Michal Privoznik wrote: +VIR_ENUM_DECL(vshDomainIOError) +VIR_ENUM_IMPL(vshDomainIOError, + VIR_DOMAIN_DISK_ERROR_LAST, + N_(no error), + N_(unspecified error), + N_(no space)) + -return _(unknown error); +const char *str = vshDomainIOErrorTypeToString(error); +return str ? _(str) : _(unknown error); } Why _(str) if str itself already contains translated message? str is NOT translated. C semantics forbid initializing something with a function call, and VIR_ENUM_IMPL is creating an initializer. N_() is a markup that is a no-op to the C compiler (so you aren't violating initializer rules) while still marking a string for translation for the purposes of xgettext scanning; we still have to actually translate the string at some point down the road. Hence, my call to _(str) - where we are translating a string, but where xgettext sees that it is a variable rather than a string literal and so has nothing it can stick in the .po file. You need both halves for translating strings that are stored in an initializer list. I see. ACK then. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix memory leak when lookup pool list with invalid type option
On 02/24/2014 08:04 AM, shyu wrote: | And judging by the code, this is not upstream at all, right? I guess | this is not applicable upstream for half a year already, at least. | Please submit patches that apply on top of current master when cloning | from git://libvirt.org/libvirt.git . | Hi Martin, I think I made an mistake. Since I found this bug with 0.10.2-29.el6_5.4 so I make this patch according v0.10.2-maint branch. I knew it was already be fixed on upstream. I thought there should be fixed on v0.10.2-maint. Now I know that. Thanks for your kind remind. | Thanks for your effort, but I believe this is already fixed within | commit d64af6ce as I already commented in the Bug you referenced. If something is already fixed upstream and you merely want it backported to the maintenance branch, then it's best to mention which commit id to be cherry-picked onto which branch, rather than trying to write a new patch from scratch. On this list, we assume that patches are against the master branch unless stated otherwise in the subject line, and patches to maint branches should generally be created with 'cherry-pick -x' so that we know which patch from the master branch they are based on. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] storage: Don't lie about path used to look up in error message
On 02/24/2014 08:21 AM, Peter Krempa wrote: In storageVolLookupByPath the provided path is sanitized at first. This removes some extra slashes and stuff. When the lookup of the volume fails the original path is used which makes it hard to trace errors in some cases. Improve the error message to print the sanitized path along with the user provided path if they are not equal. --- src/storage/storage_driver.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) + _(no storage vol with matching path '%s'), path); +} else { +virReportError(VIR_ERR_NO_STORAGE_VOL, + _(no storage vol with matching path '%s' (%s)), path, cleanpath); Long line; break after the first ',' ACK with that change; makes sense to me to give a bit more information in the error message. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/3] util: file: Don't sanitize URI protocol separator in virFileSanitizePath
On 02/24/2014 08:26 AM, Daniel P. Berrange wrote: On Mon, Feb 24, 2014 at 04:21:47PM +0100, Peter Krempa wrote: The function removes multiple following slashes from paths. This is okay unless you try to sanitize a URI this way. Skip the protocol definition until :// and sanitize just the path part. The sanitization function is used in virStorageVolLookupByPath as the first step before passing the path to storage drivers. This breaks lookup of gluster volumes. --- src/util/virfile.c | 12 1 file changed, 12 insertions(+) This feels a rather dirty to me - we shouldn't be trying to second guess whether a filename might be a URI. I think we should not be passing URIs to the virFileSanitizePath in the first place. Based on what you say about usage, it sounds like the call to virFileSanitizePath needs to be pushed down into the storage backend drivers themselves. I agree that this feels dirty; I think it would be better to fix util/virstoragefile to not attempt to sanitize remote names (since right now, all use of URIs are treated as remote names). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: Don't leak buffer if GetFDs fails in cmdCreate
On 02/24/2014 05:49 PM, Eric Blake wrote: On 02/24/2014 06:29 AM, Ján Tomko wrote: Change the logic of the function to return false by default and move the freeing of the buffer to the cleanup section. https://bugzilla.redhat.com/show_bug.cgi?id=1067338 --- tools/virsh-domain.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) ACK Thank you, now pushed. Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Document the keyboard as a valid input type
On 02/24/2014 05:39 PM, Eric Blake wrote: On 02/24/2014 02:55 AM, Ján Tomko wrote: Commit bc18373 added a new input type, but didn't change the documentation. --- docs/formatdomain.html.in | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ea1a97b..400de07 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3847,15 +3847,16 @@ qemu-kvm -net nic,model=? /dev/null ... lt;devicesgt; lt;input type='mouse' bus='usb'/gt; +lt;input type='keyboard' bus='usb'/gt; lt;/devicesgt; .../pre dl dtcodeinput/code/dt ddThe codeinput/code element has one mandatory attribute, -the codetype/code whose value can be either 'mouse' or -'tablet'. The latter provides absolute -cursor movement, while the former uses relative movement. The optional +the codetype/code whose value can be 'mouse', 'tablet' or +'keyboard'. The tablet provides absolute cursor movement, ACK if you also add a span for a 'since 1.2.2' designation on keyboard. Thanks, pushed now. Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH V2] libxl: queue domain event earlier in shutdown handler
The shutdown handler may restart a domain when handling a reboot event or when on_* is set to 'restart'. Restarting consists of calling libxlVmCleanup followed by libxlVmStart. libxlVmStart will emit a VIR_DOMAIN_EVENT_STARTED event, but the SHUTDOWN event is not emitted until exiting the shutdown handler, after the STARTED event. This patch changes the logic a bit to queue the event at the start of the shutdown action, ensuring it is queued before any subsequent events that may be generated while executing the shutdown action. Signed-off-by: Jim Fehlig jfeh...@suse.com --- V2: Enqueue any pending events at the beginning of the shutdown action labels, as suggested by Michal Privoznik https://www.redhat.com/archives/libvir-list/2014-February/msg01446.html src/libxl/libxl_driver.c | 8 1 file changed, 8 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index f7379b5..a79efcb 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -473,6 +473,10 @@ libxlDomainShutdownThread(void *opaque) } destroy: +if (dom_event) { +libxlDomainEventQueue(driver, dom_event); +dom_event = NULL; +} libxl_domain_destroy(ctx, vm-def-id, NULL); if (libxlVmCleanupJob(driver, vm, reason)) { if (!vm-persistent) { @@ -483,6 +487,10 @@ destroy: goto cleanup; restart: +if (dom_event) { +libxlDomainEventQueue(driver, dom_event); +dom_event = NULL; +} libxl_domain_destroy(ctx, vm-def-id, NULL); libxlVmCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); libxlVmStart(driver, vm, 0, -1); -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/3] Multiple fixes related to lookup of gluster volumes
On 02/24/2014 08:21 AM, Peter Krempa wrote: Peter Krempa (3): storage: Don't lie about path used to look up in error message util: file: Don't sanitize URI protocol separator in virFileSanitizePath gluster: Fix key attribute for gluster volumes I haven't seen this one in my inbox yet but did see it online (don't know where the delay is occurring). My gut reaction is that patch 3/3 is wrong, and that we should instead fix the documentation. We've already released code with 'key' being non-unique and it is likely that clients have already come to rely/deal with that. Changing what we stick in the key now without good justification may be worse than the notion of fixing it to make things globally unique. Global uniqueness is easy for files in the local file system, but a lot harder for distributed network filesystems. So merely documenting that key may not be unique may be the better approach. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: mark CPU usage field names as translatable
My commit ac75801 removed the translation markers when moving the field names into an array. --- tools/virsh-host.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 502203b..6a04f9d 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -352,12 +352,12 @@ VIR_ENUM_IMPL(vshCPUStats, VSH_CPU_LAST, VIR_NODE_CPU_STATS_UTILIZATION); const char *vshCPUOutput[] = { -user:, -system:, -idle:, -iowait:, -intr:, -usage: +N_(user:), +N_(system:), +N_(idle:), +N_(iowait:), +N_(intr:), +N_(usage:) }; static bool -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] libxl: honor domain lifecycle event configuration
Michal Privoznik wrote: On 24.02.2014 15:56, Jim Fehlig wrote: Can this series be pushed for 1.2.2? If so, I'll squash in your changes and push later today. Thanks for the review! Regards, Jim I think these patches are bugfix. Which allows us to push them even in freeze. Also note that I've not ACKed 2/4 as I think a different pattern is better. However, that does not stop you from pushing the rest. I pushed 1, 3, and 4 and resent 2 with your suggested change https://www.redhat.com/archives/libvir-list/2014-February/msg01500.html Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: mark CPU usage field names as translatable
On 02/24/2014 11:11 AM, Ján Tomko wrote: My commit ac75801 removed the translation markers when moving the field names into an array. --- tools/virsh-host.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) ACK. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] virsh: kill over-engineered asprintf failure recovery
On 02/24/2014 10:42 AM, Michal Privoznik wrote: On 21.02.2014 23:59, Eric Blake wrote: I noticed this while shortning switch statements via VIR_ENUM. Basically, the only ways virAsprintf can fail are if we pass a bogus format string (but we're not THAT bad) or if we run out of memory (but it already warns on our behalf in that case). Throw away the cruft that tries too hard to diagnose a printf failure. * tools/virsh-volume.c (cmdVolList): Simplify. * tools/virsh-pool.c (cmdPoolList): Likewise. Signed-off-by: Eric Blake ebl...@redhat.com --- tools/virsh-pool.c | 73 +--- tools/virsh-volume.c | 66 ++- 2 files changed, 42 insertions(+), 97 deletions(-) ACK Thanks; I pushed the series. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: cleanup tap devices on FreeBSD
We have to explicitly destroy TAP devices on FreeBSD because they're not freed after being closed, otherwise we end up with orphaned TAP devices after destroying a domain. --- src/qemu/qemu_process.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ffa939a..9181423 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -61,6 +61,7 @@ #include viruuid.h #include virprocess.h #include virtime.h +#include virnetdevbridge.h #include virnetdevtap.h #include virbitmap.h #include viratomic.h @@ -4381,6 +4382,12 @@ void qemuProcessStop(virQEMUDriverPtr driver, virDomainNetGetActualVirtPortProfile(net), cfg-stateDir)); VIR_FREE(net-ifname); +} else if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_BRIDGE) { +/* On some OSes, e.g. FreeBSD, tap devices are not cleaned up when released, + * so we have to handle that manually */ + ignore_value(virNetDevBridgeRemovePort(virDomainNetGetActualBridgeName(net), + net-ifname)); +ignore_value(virNetDevTapDelete(net-ifname)); } /* release the physical device (or any other resources used by * this interface in the network driver -- 1.8.4.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 7/7] network: include plugged interface XML in plugged network hook
On 02/24/2014 06:45 PM, Michal Privoznik wrote: On 21.02.2014 14:58, Laine Stump wrote: The network hook script gets called whenever an interface is plugged into or unplugged from a network, but even though the full XML of both the network and the domain is included, there is no reasonable way to determine what exact resources the plugged interface is using: 1) Prior to a recent patch which modified the status XML of interfaces to include the information about actual hardware resources used, it would be possible to scan through the domain XML output sent to the hook, and from there find the correct interface, but that interface definition would not include any runtime info (e.g. bandwidth or vlan taken from a portgroup, or which physdev was used in case of a macvtap network). 2) After the patch modifying the status XML of interfaces, the network name would no longer be included in the domain XML, so it would be completely impossible to determine which interface was the one being plugged. To solve that problem, this patch includes a single interface element at the beginning of the XML sent to the network hook for plugged and unplugged (just inside hookData) that is the status XML of the interface being plugged. This XML will include all info gathered from the chosen network and portgroup. NB: due to hardcoded spaces in all of the device *Format() functions, the interface element inside the hookData will be indented by 6 spaces rather than 2. I had intended to fix this, but it turns out that to make virDomainNetDefFormat() indentation relative, I would have to do the same to virDomainDeviceInfoFormat(), and that function is called from 19 places - making that a prerequisite of this patch would cause too many merge difficulties if we needed to backport network hooks, so I chose to ignore the problem here and fix the problem for *all* devices in a followup later. --- src/network/bridge_driver.c | 48 ++--- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index a6c719d..152bd06 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -141,6 +141,7 @@ networkObjFromNetwork(virNetworkPtr net) static int networkRunHook(virNetworkObjPtr network, virDomainDefPtr dom, + virDomainNetDefPtr iface, int op, int sub_op) { @@ -158,6 +159,8 @@ networkRunHook(virNetworkObjPtr network, virBufferAddLit(buf, hookData\n); virBufferAdjustIndent(buf, 2); +if (iface virDomainNetDefFormat(buf, iface, 0) 0) +goto cleanup; if (virNetworkDefFormatBuf(buf, network-def, 0) 0) goto cleanup; if (dom virDomainDefFormatInternal(dom, 0, buf) 0) @@ -2067,7 +2070,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, /* Run an early hook to set-up missing devices. * If the script raised an error abort the launch. */ -if (networkRunHook(network, NULL, +if (networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_START, VIR_HOOK_SUBOP_BEGIN) 0) goto cleanup; @@ -2092,7 +2095,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, } /* finally we can call the 'started' hook script if any */ -if (networkRunHook(network, NULL, +if (networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_STARTED, VIR_HOOK_SUBOP_BEGIN) 0) goto cleanup; @@ -2158,7 +2161,7 @@ static int networkShutdownNetwork(virNetworkDriverStatePtr driver, } /* now that we know it's stopped call the hook if present */ -networkRunHook(network, NULL, VIR_HOOK_NETWORK_OP_STOPPED, +networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_STOPPED, VIR_HOOK_SUBOP_END); network-active = 0; @@ -3659,14 +3662,8 @@ validate: } } -/* finally we can call the 'plugged' hook script if any */ -if (networkRunHook(network, dom, - VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, - VIR_HOOK_SUBOP_BEGIN) 0) -goto error; - if (dev) { -/* we are now assured of success, so mark the allocation */ +/* mark the allocation */ dev-connections++; if (actualType != VIR_DOMAIN_NET_TYPE_HOSTDEV) { VIR_DEBUG(Using physical device %s, %d connections, @@ -3684,6 +3681,19 @@ validate: VIR_DEBUG(Using network %s, %d connections, netdef-name, netdef-connections); } + +/* finally we can call the 'plugged' hook script if any */ +if (networkRunHook(network, dom, iface, + VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, +
Re: [libvirt] [PATCH 7/7] network: include plugged interface XML in plugged network hook
On 02/24/2014 12:27 PM, Laine Stump wrote: ACK although the indentation of XML we're passing to the hook script seems off: Right. That's what the last paragraph of the commit log message is about - fixing that indentation would require a much more invasive change that would touch all the other device parsing functions, which could turn any potential backport into a real headache, so I chose to not fix it in this series. Correct - whitespace cleanups in a separate commit, especially in order to ease backport efforts, is a good tradeoff to make. This is not a show stopper for me. I wonder if we should push these patches now, even during the freeze as this is very closely related to the network hooks - one of the main features in this release. In a way it is a bugfix for that feature (since the functionality of the plugged hook is severely limited without it). I would feel more comfortable about pushing it, though, if danpb took a look at the commit log message for patch 5/7 and gave his okay on the change in the XML. My opinion is that I should have done it this way to begin with, but Dan has much better insight than I do on what is and isn't good for management applications. I agree with getting Dan's opinion, but you have my ACK for including this in time for 1.2.2 as a bug fix of the hook feature. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] QEMU accepted for Google Summer of Code 2014
Great news: the organizations for Google Summer of Code 2014 have been announced and QEMU is participating again this year! If you are a student who is interested in a 12-week full-time project working on QEMU, KVM, or libvirt this summer, head over to our project ideas page: http://qemu-project.org/Google_Summer_of_Code_2014 Student applications are open from March 10th to March 21st. See the Google Summer of Code timeline for details: https://www.google-melange.com/gsoc/events/google/gsoc2014 Also be sure to read the FAQs on the Summer of Code website to find out about eligibility, time requirements, and how the process works: https://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2014/help_page Thanks to our mentors for posting their project ideas on time, thus helping us produce a good organization application. I will send a private email to mentors to kickstart the process for GSoC 2014. Stefan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] gluster: Fix key attribute for gluster volumes
On 02/24/2014 08:21 AM, Peter Krempa wrote: According to our documentation the key value has the following meaning: Providing an identifier for the volume which is globally unique. This cannot be set when creating a volume: it is always generated. The currently used keys for gluster volumes consist of the gluster volume name and file path. This can't be considered unique as a different storage server can serve a volume with the same name. Use the full URI as the key for the volume to avoid ambiguity problems. The full URI cannot be considered unique, either, as both gluster://hosta/volume/file and gluster://hostb/volume/file may resolve to the same file. I think we are better off documenting that a key is unique for some pools, but best effort for others, and not change what we have already been outputting. But if we DO keep this patch, you also need to change the documentation that gives examples of gluster keys. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: support remaining domain events
Earlier, I added 'virsh event' for lifecycle events, to get the concept approved; this patch finishes the support for all other events, although the user still has to register for one event type at a time. A future patch may add an --all parameter to make it possible to register for all events through a single call. * tools/virsh-domain.c (vshDomainEventWatchdogToString) (vshDomainEventIOErrorToString, vshGraphicsPhaseToString) (vshGraphicsAddressToString, vshDomainBlockJobStatusToString) (vshDomainEventDiskChangeToString) (vshDomainEventTrayChangeToString, vshEventGenericPrint) (vshEventRTCChangePrint, vshEventWatchdogPrint) (vshEventIOErrorPrint, vshEventGraphicsPrint) (vshEventIOErrorReasonPrint, vshEventBlockJobPrint) (vshEventDiskChangePrint, vshEventTrayChangePrint) (vshEventPMChangePrint, vshEventBalloonChangePrint) (vshEventDeviceRemovedPrint): New helper routines. (cmdEvent): Support full array of event callbacks. Signed-off-by: Eric Blake ebl...@redhat.com --- tools/virsh-domain.c | 392 +-- 1 file changed, 381 insertions(+), 11 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8e42300..3cffc9c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10434,18 +10434,135 @@ vshDomainEventDetailToString(int event, int detail) return str ? _(str) : _(unknown); } +VIR_ENUM_DECL(vshDomainEventWatchdog) +VIR_ENUM_IMPL(vshDomainEventWatchdog, + VIR_DOMAIN_EVENT_WATCHDOG_LAST, + N_(none), + N_(pause), + N_(reset), + N_(poweroff), + N_(shutdown), + N_(debug)) + +static const char * +vshDomainEventWatchdogToString(int action) +{ +const char *str = vshDomainEventWatchdogTypeToString(action); +return str ? _(str) : _(unknown); +} + +VIR_ENUM_DECL(vshDomainEventIOError) +VIR_ENUM_IMPL(vshDomainEventIOError, + VIR_DOMAIN_EVENT_IO_ERROR_LAST, + N_(none), + N_(pause), + N_(report)) + +static const char * +vshDomainEventIOErrorToString(int action) +{ +const char *str = vshDomainEventIOErrorTypeToString(action); +return str ? _(str) : _(unknown); +} + +VIR_ENUM_DECL(vshGraphicsPhase) +VIR_ENUM_IMPL(vshGraphicsPhase, + VIR_DOMAIN_EVENT_GRAPHICS_LAST, + N_(connect), + N_(initialize), + N_(disconnect)) + +static const char * +vshGraphicsPhaseToString(int phase) +{ +const char *str = vshGraphicsPhaseTypeToString(phase); +return str ? _(str) : _(unknown); +} + +VIR_ENUM_DECL(vshGraphicsAddress) +VIR_ENUM_IMPL(vshGraphicsAddress, + VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST, + N_(IPv4), + N_(IPv6), + N_(unix)) + +static const char * +vshGraphicsAddressToString(int family) +{ +const char *str = vshGraphicsAddressTypeToString(family); +return str ? _(str) : _(unknown); +} + +VIR_ENUM_DECL(vshDomainBlockJobStatus) +VIR_ENUM_IMPL(vshDomainBlockJobStatus, + VIR_DOMAIN_BLOCK_JOB_LAST, + N_(completed), + N_(failed), + N_(canceled), + N_(ready)) + +static const char * +vshDomainBlockJobStatusToString(int status) +{ +const char *str = vshDomainBlockJobStatusTypeToString(status); +return str ? _(str) : _(unknown); +} + +VIR_ENUM_DECL(vshDomainEventDiskChange) +VIR_ENUM_IMPL(vshDomainEventDiskChange, + VIR_DOMAIN_EVENT_DISK_CHANGE_LAST, + N_(changed), + N_(dropped)) + +static const char * +vshDomainEventDiskChangeToString(int reason) +{ +const char *str = vshDomainEventDiskChangeTypeToString(reason); +return str ? _(str) : _(unknown); +} + +VIR_ENUM_DECL(vshDomainEventTrayChange) +VIR_ENUM_IMPL(vshDomainEventTrayChange, + VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST, + N_(opened), + N_(closed)) + +static const char * +vshDomainEventTrayChangeToString(int reason) +{ +const char *str = vshDomainEventTrayChangeTypeToString(reason); +return str ? _(str) : _(unknown); +} + +struct vshEventCallback { +const char *name; +virConnectDomainEventGenericCallback cb; +}; +typedef struct vshEventCallback vshEventCallback; + struct vshDomEventData { vshControl *ctl; bool loop; int count; +vshEventCallback *cb; }; typedef struct vshDomEventData vshDomEventData; -/* FIXME: Support all callbacks, not just lifecycle */ -VIR_ENUM_DECL(vshDomainEventId) -VIR_ENUM_IMPL(vshDomainEventId, - /* VIR_DOMAIN_EVENT_ID_LAST, */ 1, - lifecycle) +static void +vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainPtr dom, + void *opaque) +{ +vshDomEventData *data = opaque; + +if (!data-loop data-count) +return; +vshPrint(data-ctl, _(event '%s' for domain %s\n), + data-cb-name, virDomainGetName(dom)); +
[libvirt] [PATCH 2/1] virsh: add --all flag to 'event' command
Similar to our event-test demo program, it's nice to be able to have a mode where we can sniff all events at once, rather than having to spawn multiple virsh in parallel with one for each event type. (Can I just say our RegisterAny design is lousy? The fact that the majority of our callback pointers have a function signature with the opaque data in a different position, and that we have to cast the function signature before registering it, makes it hard to write a generic callback function; we have to write one for every type of event id. Life would have been easier if we had designed the callback as a fixed signature with a void* and size parameter, and then allowed the caller to downcast the void* to a particular struct for data specific to their callback id, where we could have then had a single function with a switch statement for each event id, and register that one function for all types of events. It would also be nicer if the callback functions knew which callbackID was being used when invoking that callback, so that I could use a single data structure among all callbacks rather than having to create an array of data. But I really don't want to go add yet another event API design.) * tools/virsh-domain.c (cmdEvent): Add --all parameter; convert all callbacks to support shared counter. * tools/virsh.pod (event): Document it. Signed-off-by: Eric Blake ebl...@redhat.com --- tools/virsh-domain.c | 136 --- tools/virsh.pod | 8 +-- 2 files changed, 90 insertions(+), 54 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3cffc9c..7adab00 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10543,8 +10543,9 @@ typedef struct vshEventCallback vshEventCallback; struct vshDomEventData { vshControl *ctl; bool loop; -int count; +int *count; vshEventCallback *cb; +int id; }; typedef struct vshDomEventData vshDomEventData; @@ -10555,11 +10556,11 @@ vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_UNUSED, { vshDomEventData *data = opaque; -if (!data-loop data-count) +if (!data-loop *data-count) return; vshPrint(data-ctl, _(event '%s' for domain %s\n), data-cb-name, virDomainGetName(dom)); -data-count++; +(*data-count)++; if (!data-loop) vshEventDone(data-ctl); } @@ -10573,12 +10574,12 @@ vshEventLifecyclePrint(virConnectPtr conn ATTRIBUTE_UNUSED, { vshDomEventData *data = opaque; -if (!data-loop data-count) +if (!data-loop *data-count) return; vshPrint(data-ctl, _(event 'lifecycle' for domain %s: %s %s\n), virDomainGetName(dom), vshDomainEventToString(event), vshDomainEventDetailToString(event, detail)); -data-count++; +(*data-count)++; if (!data-loop) vshEventDone(data-ctl); } @@ -10591,11 +10592,11 @@ vshEventRTCChangePrint(virConnectPtr conn ATTRIBUTE_UNUSED, { vshDomEventData *data = opaque; -if (!data-loop data-count) +if (!data-loop *data-count) return; vshPrint(data-ctl, _(event 'rtc-change' for domain %s: %lld\n), virDomainGetName(dom), utcoffset); -data-count++; +(*data-count)++; if (!data-loop) vshEventDone(data-ctl); } @@ -10608,11 +10609,11 @@ vshEventWatchdogPrint(virConnectPtr conn ATTRIBUTE_UNUSED, { vshDomEventData *data = opaque; -if (!data-loop data-count) +if (!data-loop *data-count) return; vshPrint(data-ctl, _(event 'watchdog' for domain %s: %s\n), virDomainGetName(dom), vshDomainEventWatchdogToString(action)); -data-count++; +(*data-count)++; if (!data-loop) vshEventDone(data-ctl); } @@ -10627,12 +10628,12 @@ vshEventIOErrorPrint(virConnectPtr conn ATTRIBUTE_UNUSED, { vshDomEventData *data = opaque; -if (!data-loop data-count) +if (!data-loop *data-count) return; vshPrint(data-ctl, _(event 'io-error' for domain %s: %s (%s) %s\n), virDomainGetName(dom), srcPath, devAlias, vshDomainEventIOErrorToString(action)); -data-count++; +(*data-count)++; if (!data-loop) vshEventDone(data-ctl); } @@ -10650,7 +10651,7 @@ vshEventGraphicsPrint(virConnectPtr conn ATTRIBUTE_UNUSED, vshDomEventData *data = opaque; size_t i; -if (!data-loop data-count) +if (!data-loop *data-count) return; vshPrint(data-ctl, _(event 'graphics' for domain %s: %s local[%s %s %s] remote[%s %s %s] %s), @@ -10664,7 +10665,7 @@ vshEventGraphicsPrint(virConnectPtr conn ATTRIBUTE_UNUSED, vshPrint(data-ctl, %s=%s, subject-identities[i].type, subject-identities[i].name); vshPrint(data-ctl, \n); -data-count++; +(*data-count)++; if (!data-loop) vshEventDone(data-ctl); } @@ -10680,13 +10681,13 @@
Re: [libvirt] Question about building libvirt.so
Thanks for the replies guys, libvirt-glib sure sounds interesting. On the other hand I was able to leave libvirt.so alone and write my own wrapper (based on libvirt/examples) for easy calls from NodeJS. I can get to list VMs, their config etc. from node but not able to list the operating system running on the VM (ubuntu, win7, etc.). I can get the os_type though (hvm in my case) but that does not tell me whether it is running a windows or a linux distro. On Mon, Feb 24, 2014 at 5:00 AM, Christophe Fergeau cferg...@redhat.comwrote: Hey, On Fri, Feb 21, 2014 at 07:30:08AM -0800, Vikhyath Reddy wrote: Thanks for the reply Cedric, wrappers is a dir that I made similar to examples which wraps the libvirt c code. The reason why I am doing this is to simplify the usage of virConnectOpenAuth - it's arguments and callbacks from JavaScript. Using ffi, I am unable to create the right callbacks and have it pass the correct arguments. Depending on what parts of libvirt API you need to use from javascript, libvirt-glib may be an option as it already makes some parts of libvirt API accessible from javascript, see http://libvirt.org/git/?p=libvirt-glib.git;a=blob;f=examples/conn-test.js;h=7f9784b8fc55a2be6c7596cfd365d4273d057a2e;hb=HEAD for example. I don't know if this would be usable from nodejs? If this is a good fit for what you need, patches extending the libvirt API wrapped by libvirt-glib are very welcome ;) Christophe -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] make virDomainGetMaxVcpus work on inactive domains
Claudio Bley wrote: At Thu, 20 Feb 2014 12:19:35 -0700, Jim Fehlig wrote: Claudio Bley wrote: Signed-off-by: Claudio Bley cb...@av-test.de --- OK, how about this patch? While at it, should I convert the VIR_DOMAIN_VCPU_* instances to VIR_DOMAIN_AFFECT_* instances for consistency? src/esx/esx_driver.c |2 +- src/openvz/openvz_driver.c |2 +- src/phyp/phyp_driver.c |2 +- src/qemu/qemu_driver.c |2 +- src/test/test_driver.c |2 +- src/vbox/vbox_tmpl.c |2 +- src/xen/xen_driver.c |2 +- src/xenapi/xenapi_driver.c |2 +- I think the libxl driver should be included here too. Seems the libxl driver does not implement the virDomainGetMaxVcpus function. Opps, you are right. The libxl driver only has domainGetVcpus. Sorry for the noise. Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v1 1/2] make qemu dump memory in kdump-compressed format
On 02/24/2014 06:30 PM, Daniel P. Berrange wrote: On Thu, Feb 20, 2014 at 10:30:31AM +0800, Qiao Nuohan wrote: --memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory in kdump-compressed format. This patch is used to add --compress and [--compression-format]string to virsh dump --memory-only and send dump-guest-memory command to qemu with dump format specified to one of elf, kdump-zlib, kdump-lzo and kdump-snappy. Signed-off-by: Qiao Nuohanqiaonuo...@cn.fujitsu.com --- include/libvirt/libvirt.h.in | 19 ++- src/qemu/qemu_driver.c | 20 src/qemu/qemu_monitor.c | 6 +++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 42 ++ 8 files changed, 83 insertions(+), 16 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..df62918 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1173,11 +1173,20 @@ typedef virDomainMemoryStatStruct *virDomainMemoryStatPtr; /* Domain core dump flags. */ typedef enum { -VIR_DUMP_CRASH= (1 0), /* crash after dump */ -VIR_DUMP_LIVE = (1 1), /* live dump */ -VIR_DUMP_BYPASS_CACHE = (1 2), /* avoid file system cache pollution */ -VIR_DUMP_RESET= (1 3), /* reset domain after dump finishes */ -VIR_DUMP_MEMORY_ONLY = (1 4), /* use dump-guest-memory */ +VIR_DUMP_CRASH = (1 0), /* crash after dump */ +VIR_DUMP_LIVE= (1 1), /* live dump */ +VIR_DUMP_BYPASS_CACHE= (1 2), /* avoid file system cache pollution */ +VIR_DUMP_RESET = (1 3), /* reset domain after dump finishes */ +VIR_DUMP_MEMORY_ONLY = (1 4), /* use dump-guest-memory */ +VIR_DUMP_COMPRESS_ZLIB = (1 5), /* dump guest memory in +kdump-compressed format, with +zlib-compressed */ +VIR_DUMP_COMPRESS_LZO= (1 6), /* dump guest memory in +kdump-compressed format, with +lzo-compressed */ +VIR_DUMP_COMPRESS_SNAPPY = (1 7), /* dump guest memory in +kdump-compressed format, with +snappy-compressed */ } virDomainCoreDumpFlags; I'm not really a fan of using flags for this, since all these new flags are mutually exclusive. This is a strong indication that they should not be flags, and instead be a separate parametere. So IMHO if we wnat to be able to specify a dump format we should have an explicit 'int dumpformat' parameter for it. Yes, I know this would involve a new API. I thought flag would be better, but now I know adding new parameter is preferred. Thanks for point it out. Regards, Daniel -- Regards Qiao Nuohan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Question about building libvirt.so
On 02/24/2014 05:09 PM, vikhyath reddy wrote: [Please don't top-post on technical lists] Thanks for the replies guys, libvirt-glib sure sounds interesting. On the other hand I was able to leave libvirt.so alone and write my own wrapper (based on libvirt/examples) for easy calls from NodeJS. I can get to list VMs, their config etc. from node but not able to list the operating system running on the VM (ubuntu, win7, etc.). I can get the os_type though (hvm in my case) but that does not tell me whether it is running a windows or a linux distro. Libvirt can't tell you what the guest is running. For that, you need higher-level software, such as libguestfs. virt-manager is an example of a program that uses libguestfs to probe which OS is running in the guest. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] libvirt support to force convergence of live guest migration
Chegu Vinod wrote: Hello, 'am sending this updated patch as an attachment (as I was having some issues with my smtp server and git send-email setup). Thanks, Vinod Subject: [PATCH v2] libvirt support to force convergence of live guest migration Changes since RFC (i.e. v1) patch : - Incorporated feedback from Jiri Denemark Looks like you addressed all of Jiri's comments from V1, except for the name of the VIR_MIGRATE_AUTO_CONVERGE flag. But I don't have a better suggestion either. Busy enterprise workloads hosted on large sized VM's tend to dirty memory faster than the transfer rate achieved via live guest migration. Despite some good recent improvements ( using dedicated 10Gig NICs between hosts) the live migration may NOT converge. Recently support was added in qemu (version 1.6) to allow a user to choose if they wish to force convergence of their migration via a new migration capability : auto-converge. This feature allows for qemu to auto-detect lack of convergence and trigger a throttle-down of the VCPUs. This patch includes the libvirt support needed to trigger this feature. (Testing is in progress) Signed-off-by: Chegu Vinod chegu_vi...@hp.com --- include/libvirt/libvirt.h.in | 1 + src/qemu/qemu_migration.c| 40 src/qemu/qemu_migration.h| 3 ++- src/qemu/qemu_monitor.c | 2 +- src/qemu/qemu_monitor.h | 1 + tools/virsh-domain.c | 7 +++ As mentioned earlier, this needs documented in virsh.pod, similar to the virsh.pod changes Jiri made when introducing the VIR_MIGRATE_COMPRESSED flag in commit ecfff1da. Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: initialize str to NULL for solving a build issue
Fix a -Werror=maybe-uninitialized issue. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- tools/virsh-domain-monitor.c | 2 +- tools/virsh-domain.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index c67b833..1192565 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -218,7 +218,7 @@ VIR_ENUM_IMPL(vshDomainPMSuspendedReason, static const char * vshDomainStateReasonToString(int state, int reason) { -const char *str; +const char *str = NULL; switch ((virDomainState) state) { case VIR_DOMAIN_NOSTATE: str = vshDomainNostateReasonTypeToString(reason); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8e42300..3e73340 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10399,7 +10399,7 @@ VIR_ENUM_IMPL(vshDomainEventCrashed, static const char * vshDomainEventDetailToString(int event, int detail) { -const char *str; +const char *str = NULL; switch ((virDomainEventType) event) { case VIR_DOMAIN_EVENT_DEFINED: str = vshDomainEventDefinedTypeToString(detail); -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list