Re: [libvirt] [PATCH libvirt-java] spec: Only install unversioned jar file
At Tue, 17 Dec 2013 16:34:11 -0500, Cole Robinson wrote: As intended by Fedora's java packaging guidelines: https://bugzilla.redhat.com/show_bug.cgi?id=1022139 --- libvirt-java.spec.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Looks OK to me, ACK. / Claudio -- AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany Phone: +49 341 265 310 19 Web:http://www.av-test.org Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: add support for error messages greater than 1024 characters
Guys, as for this patch, is it ACKable? are there suggested modifications? Michele On 16/12/2013 16:00, Daniel P. Berrange wrote: On Mon, Dec 16, 2013 at 09:50:30AM -0500, Cole Robinson wrote: On 12/16/2013 04:27 AM, Laine Stump wrote: On 12/14/2013 07:15 PM, Cole Robinson wrote: On 12/11/2013 03:33 PM, Michele Paolino wrote: In libvirt, the default error message length is 1024 bytes. This is not enough for qemu to print long error messages such as the list of supported ARM machine models (more than 1700 chars). This is raised when the machine entry in the XML file is wrong, but there may be now or in future other verbose error messages. The above patch enables libvirt to print error messages 1024 for qemu. Signed-off-by: Michele Paolinom.paol...@virtualopensystems.com --- src/qemu/qemu_process.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bd9546e..c2e2136 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1904,10 +1904,25 @@ cleanup: * a possible read of the fd in the monitor code doesn't influence this * error delivery option */ ignore_value(lseek(logfd, pos, SEEK_SET)); -qemuProcessReadLog(logfd, buf + len, buf_size - len - 1, 0, true); -virReportError(VIR_ERR_INTERNAL_ERROR, - _(process exited while connecting to monitor: %s), - buf); +len = qemuProcessReadLog(logfd, buf + len, buf_size - len - 1, 0, true); + +/* virReportError error buffer is limited to 1024 byte*/ +if (len 1024){ +virReportError(VIR_ERR_INTERNAL_ERROR, +_(process exited while connecting to monitor: %s), +buf); +} else { + if (STRPREFIX(buf, Supported machines are:)) + virReportError(VIR_ERR_INTERNAL_ERROR, + _(process exited while connecting to monitor: + please check machine model)); + else + virReportError(VIR_ERR_INTERNAL_ERROR, + _(process exited while connecting to monitor)); + + VIR_ERROR(%s, buf); +} + ret = -1; } This kind of error scraping is a slipper slop IMO, and for this particular case I don't think it's even that interesting. I definitely agree with that. Libvirt already parses the machine types for each qemu emulator and reports it in virsh capabilities XML. Seems reasonable that we could validate the XML machine type at define time and catch an invalid machine type error long before we even try and start the VM. Do we really want to refuse to define a particular guest just because the host where we're defining it doesn't currently support the given machine type? That's yet another slippery slope - for example, should we also be validating all the devices in hostdev at definition time? I think the proper time to do that validation is at domain start time when we should have the proper qemu binary (and necessary drivers/hardware) available. My suggestion for define time was because IIRC that's where we do the capabilities arch + os type + domain type validation as well. Doing validation at that level is nice because we don't need to duplicate it in each driver, but it also sucks when qemu is accidentally uninstalled and libvirt is restarted, it now refuses to parse all those pre-existing qemu/kvm configs, and virsh list --all is empty to the great confusion of users. Yeah, that is actually quite a big problem I'd like us to fix one day by moving that validation out of the define stage into the start stage Daniel -- *Michele Paolino*, Virtualization RD Engineer Virtual Open Systems /Open Source KVM Virtualization Developments/ /Multicore Systems Virtualization Porting Services/ Web/:/www.virtualopensystems. http://www.virtualopensystems.com/com http://www.virtualopensystems.com/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] lxc: simplify command when connecting lxc multi console
From: Chen Hanxiao chenhanx...@cn.fujitsu.com If we config more than one consoles for container, we always named them as consoleN. We had to type a complex option --devname consoleN. This patch enables option --devname N to be equal to --devname consoleN. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_driver.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 61a90ca..13213a5 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2439,6 +2439,7 @@ lxcDomainOpenConsole(virDomainPtr dom, int ret = -1; virDomainChrDefPtr chr = NULL; size_t i; +char *tmp_name = NULL; virCheckFlags(0, -1); @@ -2455,9 +2456,17 @@ lxcDomainOpenConsole(virDomainPtr dom, } if (dev_name) { +if (STRPREFIX(dev_name, console)) { +if (VIR_STRDUP(tmp_name, dev_name) 0) +goto cleanup; +} else { +if (virAsprintf(tmp_name, console%s, dev_name) 0) +goto cleanup; +} + for (i = 0; i vm-def-nconsoles; i++) { if (vm-def-consoles[i]-info.alias -STREQ(vm-def-consoles[i]-info.alias, dev_name)) { +STREQ(vm-def-consoles[i]-info.alias, tmp_name)) { chr = vm-def-consoles[i]; break; } @@ -2490,6 +2499,7 @@ lxcDomainOpenConsole(virDomainPtr dom, cleanup: if (vm) virObjectUnlock(vm); +VIR_FREE(tmp_name); return ret; } -- 1.8.2.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] lxc: simplify command when connecting lxc multi console
On 12/18/2013 04:54 PM, Chen Hanxiao wrote: From: Chen Hanxiao chenhanx...@cn.fujitsu.com If we config more than one consoles for container, we always named them as consoleN. We had to type a complex option --devname consoleN. This patch enables option --devname N to be equal to --devname consoleN. Do we really need this? Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_driver.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 61a90ca..13213a5 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2439,6 +2439,7 @@ lxcDomainOpenConsole(virDomainPtr dom, int ret = -1; virDomainChrDefPtr chr = NULL; size_t i; +char *tmp_name = NULL; virCheckFlags(0, -1); @@ -2455,9 +2456,17 @@ lxcDomainOpenConsole(virDomainPtr dom, } if (dev_name) { +if (STRPREFIX(dev_name, console)) { +if (VIR_STRDUP(tmp_name, dev_name) 0) +goto cleanup; +} else { +if (virAsprintf(tmp_name, console%s, dev_name) 0) +goto cleanup; +} + for (i = 0; i vm-def-nconsoles; i++) { if (vm-def-consoles[i]-info.alias -STREQ(vm-def-consoles[i]-info.alias, dev_name)) { +STREQ(vm-def-consoles[i]-info.alias, tmp_name)) { chr = vm-def-consoles[i]; break; } @@ -2490,6 +2499,7 @@ lxcDomainOpenConsole(virDomainPtr dom, cleanup: if (vm) virObjectUnlock(vm); +VIR_FREE(tmp_name); return ret; } -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] build: fix building with '--enable-test-locking'
When test-locking is enabled, CFLAGS have -Dbool=char, which makes pipefd[bool] fail (obviously). Forcing the subscript to be bool by double negation fixes the build breaker. Signed-off-by: Martin Kletzander mklet...@redhat.com --- Notes: I still can't build with '--enable-test-locking' and I'm not sure this is the proper way to fix it. Also, the code wasn't touched for months, so I'm not pushing it as a build-breaker. src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 631cd06..88674ec 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -262,7 +262,7 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags) } VIR_FORCE_CLOSE(*fd); -*fd = pipefd[output]; +*fd = pipefd[!!output]; return ret; error: -- 1.8.5.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: fix typo PCi = PCI
On 16.12.2013 17:31, Martin Kletzander wrote: Signed-off-by: Martin Kletzander mklet...@redhat.com --- src/qemu/qemu_process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bd9546e..d0fde54 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3829,7 +3829,7 @@ int qemuProcessStart(virConnectPtr conn, * Normally PCI addresses are assigned in the virDomainCreate * or virDomainDefine methods. We might still need to assign * some here to cope with the question of upgrades. Regardless - * we also need to populate the PCi address set cache for later + * we also need to populate the PCI address set cache for later * use in hotplug */ if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_DEVICE)) { @@ -4560,7 +4560,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, * Normally PCI addresses are assigned in the virDomainCreate * or virDomainDefine methods. We might still need to assign * some here to cope with the question of upgrades. Regardless - * we also need to populate the PCi address set cache for later + * we also need to populate the PCI address set cache for later * use in hotplug */ if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_DEVICE)) { ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libxl: libxl_get_max_cpus returning a libxl error from 4.4 onward
On mer, 2013-12-18 at 07:39 +0100, Martin Kletzander wrote: On Tue, Dec 17, 2013 at 06:43:25PM +0100, Dario Faggioli wrote: diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 692c3b7..a31b094 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1101,9 +1101,11 @@ libxlConnectGetMaxVcpus(virConnectPtr conn, const char *type ATTRIBUTE_UNUSED) cfg = libxlDriverConfigGet(driver); ret = libxl_get_max_cpus(cfg-ctx); -/* libxl_get_max_cpus() will return 0 if there were any failures, - e.g. xc_physinfo() failing */ -if (ret == 0) +/* On failure, libxl_get_max_cpus() will return ERROR_FAIL from Xen 4.4 + * onward, but it ever returning 0 is obviously wrong too (and it is + * what happens, on failure, on Xen 4.3 and earlier). Therefore, a 'less + * or equal' is the catchall we want. */ +if (ret = 0) ret = -1; virObjectUnref(cfg); Good to change that, thanks, but the call to: virBitmapNew(libxl_get_max_nodes(priv-ctx)) // in the same file should be fixed as well, especially since virBitmapNew takes an unsigned argument. Could you modify that bit as well? Right! I checkd for other uses of *_max_cpus() and forgot to do the same for *_max_nodes()! :-/ I'll do that, thanks for looking at the patch. Regards, Dario -- This happens because I choose it to happen! (Raistlin Majere) - Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems RD Ltd., Cambridge (UK) signature.asc Description: This is a digitally signed message part -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] lxc: simplify command when connecting lxc multi console
On Wed, Dec 18, 2013 at 04:54:27PM +0800, Chen Hanxiao wrote: From: Chen Hanxiao chenhanx...@cn.fujitsu.com If we config more than one consoles for container, we always named them as consoleN. We had to type a complex option --devname consoleN. This patch enables option --devname N to be equal to --devname consoleN. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_driver.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) NACK, I don't see any compelling reason todo this. 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] lxc: simplify command when connecting lxc multi console
On Wed, Dec 18, 2013 at 09:52:05AM +, Daniel P. Berrange wrote: On Wed, Dec 18, 2013 at 04:54:27PM +0800, Chen Hanxiao wrote: From: Chen Hanxiao chenhanx...@cn.fujitsu.com If we config more than one consoles for container, we always named them as consoleN. We had to type a complex option --devname consoleN. This patch enables option --devname N to be equal to --devname consoleN. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_driver.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) NACK, I don't see any compelling reason todo this. I should say though if we want simplification in virsh code that would be acceptablee virsh console -n 2 myguestname would say connect to the 2nd console in the XML. virsh would get the XML description and find the 2nd console and extract the alias string from it, and then call the libvirt API with that string. 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
[libvirt] libvirt live modify
Hi Can we modify a Virtual machine while its running, I want to update the discription and title Br. Umar -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3] qemu: ask for -enable-fips when FIPS is required
On 12/17/13 19:36, Eric Blake wrote: On a system that is enforcing FIPS, most libraries honor the current mode by default. Qemu, on the other hand, refused to honor FIPS mode unless you add the '-enable-fips' command line option; worse, this option is not discoverable via QMP, and is only present on binaries built for Linux. So, if we detect FIPS mode, then we unconditionally ask for FIPS; either qemu is new enough to have the option and then correctly cripple insecure VNC passwords, or it is so old that we are correctly avoiding a FIPS violation by preventing qemu from starting. Meanwhile, if we don't detect FIPS mode, then omitting the argument is safe whether the qemu has the option (but it would do nothing because FIPS is disabled) or whether qemu lacks the option (including in the case where we are not running on Linux). The testsuite was a bit interesting: we don't want our test to depend on whether it is being run in FIPS mode, so I had to tweak things to set the capability bit outside of our normal interaction with capability parsing. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1035474 * src/qemu/qemu_capabilities.h (QEMU_CAPS_ENABLE_FIPS): New bit. * src/qemu/qemu_capabilities.c (virQEMUCapsInitQMP): Conditionally set capability according to detection of FIPS mode. * src/qemu/qemu_command.c (qemuBuildCommandLine): Use it. * tests/qemucapabilitiestest.c (testQemuCaps): Conditionally set capability to test expected output. * tests/qemucapabilitiesdata/caps_1.2.2-1.caps: Update list. * tests/qemucapabilitiesdata/caps_1.6.0-1.caps: Likewise. Signed-off-by: Eric Blake ebl...@redhat.com --- v3: use virFileReadAll correctly src/qemu/qemu_capabilities.c | 27 ++- src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 2 ++ tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 + tests/qemucapabilitiestest.c | 20 +++- 6 files changed, 46 insertions(+), 6 deletions(-) ACK. I verified that the detection works correctly when the file is present and contains the expected data. 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] libvirt live modify
On 12/18/13 11:41, Umar Draz wrote: Hi Can we modify a Virtual machine while its running, I want to update the discription and title You can use the virDomainSetMetadata and virDomainGetMetadata APIs. http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Or the virsh desc command from the commandline. Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix crash in virsystemdtest with dbus 1.7.6
D-bus introduced some changes in its locking code. Overriding the init function skips the new locking init and thus crashes later in libvirt test. Removing the function makes the test pass again. --- tests/virsystemdmock.c | 5 - 1 file changed, 5 deletions(-) diff --git a/tests/virsystemdmock.c b/tests/virsystemdmock.c index b8fc031..b3b82b4 100644 --- a/tests/virsystemdmock.c +++ b/tests/virsystemdmock.c @@ -31,11 +31,6 @@ void dbus_connection_set_change_sigpipe(dbus_bool_t will_modify_sigpipe ATTRIBUT { } -dbus_bool_t dbus_threads_init_default(void) -{ -return 1; -} - DBusConnection *dbus_bus_get(DBusBusType type ATTRIBUTE_UNUSED, DBusError *error ATTRIBUTE_UNUSED) { -- 1.8.4.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar On Wed, Dec 18, 2013 at 4:11 PM, Peter Krempa pkre...@redhat.com wrote: On 12/18/13 11:41, Umar Draz wrote: Hi Can we modify a Virtual machine while its running, I want to update the discription and title You can use the virDomainSetMetadata and virDomainGetMetadata APIs. http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Or the virsh desc command from the commandline. Peter -- Umar Draz Network Architect -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Block info query: Add flag to allow failure if not active
Currently the qemuDomainGetBlockInfo will return allocation == physical for most backing stores. For a qcow2 block backed device it's possible to return the highest lv extent allocated from qemu for an active guest. That is a value where allocation != physical and one would hope be less. However, if the guest is not running, then the code falls back to returning allocation == physical. This turns out to be problematic for rhev which monitors the size of the backing store. During a migration, before the VM has been started on the target and while it is deemed inactive on the source, allocation is returned as physical triggering the code to extend the file unnecessarily. Thus, this patch will check a new flag to the call to determine whether a failure should be returned to indicate to the caller that the code is unable to fetch the allocation value. This will allow the caller to decide how to proceed. Note that I chose not to return a failure as a more general rule mostly because of backwards compatability and current expectations reasons. Changing a default return action could be an unexpected action. Although returning allocation == physical perhaps is incorrect, it is how the code has been functioning. Having a 'virsh domblkinfo' return a failure for some inactive domains while succeeding for others could be confusing. A flag forces the caller to decide how to operate. As it turns out, there seems to be quite a bit of history regarding this. Details can be found in the BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1040507 Signed-off-by: John Ferlan jfer...@redhat.com --- NOTE: Trying to keep this as simple as possible since it needs to be backported. If someone has a better idea for a flag name - I'm open to suggestions... include/libvirt/libvirt.h.in | 23 --- src/libvirt.c| 11 ++- src/qemu/qemu_driver.c | 33 +++-- 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 6f79c49..420642b 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -2095,7 +2095,8 @@ int virDomainBlockResize (virDomainPtr dom, /** virDomainBlockInfo: * - * This struct provides information about the size of a block device backing store + * This struct provides information about the size of a block device + * backing store * * Examples: * @@ -2108,13 +2109,29 @@ int virDomainBlockResize (virDomainPtr dom, * * - qcow2 file in filesystem * * capacity: logical size from qcow2 header - * * allocation, physical: logical size of the file / highest qcow extent (identical) + * * allocation, physical: logical size of the file / + * highest qcow extent (identical) * * - qcow2 file in a block device * * capacity: logical size from qcow2 header - * * allocation: highest qcow extent written + * * allocation: highest qcow extent written for an active domain * * physical: size of the block device container */ + +/** + * virDomainGetBlockInfoFlags: + * + * Flags available for virDomainGetBlockInfo(). + */ +typedef enum { +VIR_DOMAIN_BLOCK_CHECK_ACTIVE = 1 0, /* If not active, then return + * failure when attempting to + * fetch data from an inactive + * domain, such as allocation + * from a qcow2 block device + */ +} virDomainGetBlockInfoFlags; + typedef struct _virDomainBlockInfo virDomainBlockInfo; typedef virDomainBlockInfo *virDomainBlockInfoPtr; struct _virDomainBlockInfo { diff --git a/src/libvirt.c b/src/libvirt.c index d15d617..2159eaf 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -9027,7 +9027,7 @@ error: * @domain: a domain object * @disk: path to the block device, or device shorthand * @info: pointer to a virDomainBlockInfo structure allocated by the user - * @flags: extra flags; not used yet, so callers should always pass 0 + * @flags: bitwise-OR of supported virDomainGetBlockInfoFlags * * Extract information about a domain's block device. * @@ -9038,6 +9038,15 @@ error: * can be found by calling virDomainGetXMLDesc() and inspecting * elements within //domain/devices/disk. * + * If the VIR_DOMAIN_BLOCK_CHECK_ACTIVE flag is set, then for any block + * information data that could differ depending on whether the domain was + * active or not, the hypervisor will return a failure when the domain + * is deemed to be inactive or unable to provide the data, such as may be + * the case during a migration. For example, the 'allocation' value for + * a qcow2 block device backed storage can return the highest extent written. + * However, this can only be determined if the
Re: [libvirt] libvirt live modify
On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- Umar Draz Network Architect -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix race leading to crash when setting up dbus watches
Currently the virDBusAddWatch does virEventAddHandle(fd, flags, virDBusWatchCallback, watch, NULL); dbus_watch_set_data(watch, info, virDBusWatchFree); Unfortunately this is racy - since the event loop is in a different thread, the virDBusWatchCallback method may be run before we get to calling dbus_watch_set_data. We must reverse the order of these calls See https://bugzilla.redhat.com/show_bug.cgi?id=885445 Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/util/virdbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virdbus.c b/src/util/virdbus.c index 4e4c267..a0cbbfe 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -238,15 +238,15 @@ static dbus_bool_t virDBusAddWatch(DBusWatch *watch, # else fd = dbus_watch_get_fd(watch); # endif +dbus_watch_set_data(watch, info, virDBusWatchFree); info-bus = (DBusConnection *)data; info-watch = virEventAddHandle(fd, flags, virDBusWatchCallback, watch, NULL); if (info-watch 0) { -VIR_FREE(info); +dbus_watch_set_data(watch, NULL, NULL); return 0; } -dbus_watch_set_data(watch, info, virDBusWatchFree); return 1; } -- 1.8.4.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Rename virDomainGetRootFilesystem to virDomainGetFilesystemForTarget
The virDomainGetRootFilesystem method can be generalized to allow any filesystem path to be obtained. While doing this, start a new test case for purpose of testing various helper methods in the domain_conf.{c,h} files, such as this one. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- .gitignore | 1 + src/conf/domain_conf.c | 5 +- src/conf/domain_conf.h | 3 +- src/libvirt_private.syms | 2 +- src/lxc/lxc_container.c| 2 +- src/lxc/lxc_process.c | 2 +- tests/Makefile.am | 6 ++ tests/domainconfdata/getfilesystem.xml | 28 tests/domainconftest.c | 120 + tests/testutils.c | 57 tests/testutils.h | 5 ++ 11 files changed, 225 insertions(+), 6 deletions(-) create mode 100644 tests/domainconfdata/getfilesystem.xml create mode 100644 tests/domainconftest.c diff --git a/.gitignore b/.gitignore index d5a6cf5..cbb3e8a 100644 --- a/.gitignore +++ b/.gitignore @@ -147,6 +147,7 @@ /tests/commandtest /tests/conftest /tests/cputest +/tests/domainconftest /tests/domainsnapshotxml2xmltest /tests/esxutilstest /tests/eventtest diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0079234..dd36026 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17827,12 +17827,13 @@ virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk, } virDomainFSDefPtr -virDomainGetRootFilesystem(virDomainDefPtr def) +virDomainGetFilesystemForTarget(virDomainDefPtr def, +const char *path) { size_t i; for (i = 0; i def-nfss; i++) { -if (STREQ(def-fss[i]-dst, /)) +if (STREQ(def-fss[i]-dst, path)) return def-fss[i]; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 647d115..ea7f1a1 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2541,7 +2541,8 @@ int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk, int *busIdx, int *devIdx); -virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def); +virDomainFSDefPtr virDomainGetFilesystemForTarget(virDomainDefPtr def, + const char *path); int virDomainFSIndexByName(virDomainDefPtr def, const char *name); int virDomainVideoDefaultType(const virDomainDef *def); int virDomainVideoDefaultRAM(const virDomainDef *def, int type); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2dbb8f8..a870e9c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -225,7 +225,7 @@ virDomainFSTypeFromString; virDomainFSTypeToString; virDomainFSWrpolicyTypeFromString; virDomainFSWrpolicyTypeToString; -virDomainGetRootFilesystem; +virDomainGetFilesystemForTarget; virDomainGraphicsAuthConnectedTypeFromString; virDomainGraphicsAuthConnectedTypeToString; virDomainGraphicsDefFree; diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index c6bdc8c..c32b085 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1823,7 +1823,7 @@ static int lxcContainerChild(void *data) if (lxcContainerSetID(vmDef) 0) goto cleanup; -root = virDomainGetRootFilesystem(vmDef); +root = virDomainGetFilesystemForTarget(vmDef, /); if (argv-nttyPaths) { const char *tty = argv-ttyPaths[0]; diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index cc9c1a2..f0190a0 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -934,7 +934,7 @@ virLXCProcessReadLogOutput(virDomainObjPtr vm, static int virLXCProcessEnsureRootFS(virDomainObjPtr vm) { -virDomainFSDefPtr root = virDomainGetRootFilesystem(vm-def); +virDomainFSDefPtr root = virDomainGetFilesystemForTarget(vm-def, /); if (root) return 0; diff --git a/tests/Makefile.am b/tests/Makefile.am index 568b7a0..90fb3a0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -65,6 +65,7 @@ EXTRA_DIST = \ commanddata \ confdata \ cputestdata \ + domainconfdata \ domainschemadata \ domainschematest \ domainsnapshotschematest \ @@ -141,6 +142,7 @@ test_programs = virshtest sockettest \ virportallocatortest \ sysinfotest \ virstoragetest \ + domainconftest \ $(NULL) if WITH_REMOTE @@ -893,6 +895,10 @@ sysinfotest_SOURCES = \ sysinfotest.c testutils.h testutils.c sysinfotest_LDADD = $(LDADDS) +domainconftest_SOURCES = \ + domainconftest.c testutils.h testutils.c +domainconftest_LDADD = $(LDADDS) + fdstreamtest_SOURCES = \ fdstreamtest.c testutils.h testutils.c fdstreamtest_LDADD = $(LDADDS) diff --git a/tests/domainconfdata/getfilesystem.xml b/tests/domainconfdata/getfilesystem.xml new
Re: [libvirt] [Xen-devel] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver
On Tue, 2013-12-17 at 18:32 +0100, Stefan Bader wrote: Might this libxl fix be relevant: commit 5420f26507fc5c9853eb1076401a8658d72669da Author: Jim Fehlig jfeh...@suse.com Date: Fri Jan 11 12:22:26 2013 + libxl: Set vfb and vkb devid if not done so by the caller Other devices set a sensible devid if the caller has not done so. Do the same for vfb and vkb. While at it, factor out the common code used to determine a sensible devid, so it can be used by other libxl__device_*_add functions. Signed-off-by: Jim Fehlig jfeh...@suse.com Acked-by: Ian Campbell ian.campb...@citrix.com Committed-by: Ian Campbell ian.campb...@citrix.com and a follow up in dfeccbeaa. Although the comment implies that nic's were already correctly assigning a devid if the caller specified -1, so I don't know why it doesn't work for you :-( Ok, yes, the commit above indeed changes libxl__device_nic_add to call libxl__device_nextid for the devid... Just how is this actually called. Maybe not sufficient but git grep libxl__device_nic_add in the xen code only shows the definition and a declaration in libxl_internal.h to me... I have a feeling a macro might be involved... Here we go, look for DEFINE_DEVICE_REMOVE in libxl.c. We should really add the eventual function names in comments to provide grep fodder Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- Umar Draz Network Architect -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] lxc: simplify command when connecting lxc multi console
-Original Message- From: Daniel P. Berrange [mailto:berra...@redhat.com] Sent: Wednesday, December 18, 2013 5:55 PM To: Chen Hanxiao Cc: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH] lxc: simplify command when connecting lxc multi console On Wed, Dec 18, 2013 at 09:52:05AM +, Daniel P. Berrange wrote: On Wed, Dec 18, 2013 at 04:54:27PM +0800, Chen Hanxiao wrote: From: Chen Hanxiao chenhanx...@cn.fujitsu.com If we config more than one consoles for container, we always named them as consoleN. We had to type a complex option --devname consoleN. This patch enables option --devname N to be equal to --devname consoleN. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_driver.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) NACK, I don't see any compelling reason todo this. I should say though if we want simplification in virsh code that would be acceptablee virsh console -n 2 myguestname would say connect to the 2nd console in the XML. virsh would get the XML description and find the 2nd console and extract the alias string from it, and then call the libvirt API with that string. Thanks, I see. 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
[libvirt] python pypi package - backport older version?
Hello, First off, thanks for the wonderful project, and thanks even more for all of the excellent work on the Python bindings lately. I'm working on a small project to collect data on kvm hosts/guests via a python collector client and display the data in a web interface. It works beautifully when using my various distros' OS packages for libvirt-python, but I've hit a bit of a snag when trying to do automated testing. I'm quite happy to see libvirt-python packaged as a python package and on pypi, but the version there is 1.2.0, which requires libvirt = 0.9.11. Unfortunately, I was planning to test my python app on travis-ci, which runs Ubuntu Precise (12.04 LTS), and the latest version of libvirt for that is 0.9.8 (package python-libvirt 0.9.8-2ubuntu17.13). If I were to submit a patch, would there be any interest in me backporting the setup.py/packaging work to an older version of the python bindings - say 0.9.8 - and getting it published on pypi? Thanks, Jason Antman CMGdigital Atlanta, GA -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] configure: make --with-test-suite work
On 12/18/2013 12:03 AM, Martin Kletzander wrote: Our option '--with-test-suite' could have never worked since it was defined as AC_ARG_ENABLE([with-test-suite], ...), thus working only as '--enable-with-test-suite', but documented in configure.ac as AC_HELP_STRING([--with-test-suite], ...). In my optinion, the help string is as it should be, but the option is s/optinion/opinion/ wrong. Signed-off-by: Martin Kletzander mklet...@redhat.com --- configure.ac | 16 1 file changed, 8 insertions(+), 8 deletions(-) Indeed, you could use './configure --disable-with-test-suite' to change the behavior, but that just looks wrong. It's been broken since the introduction in commit 3a2fc27. 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] build: fix building with '--enable-test-locking'
On 12/18/2013 02:35 AM, Martin Kletzander wrote: When test-locking is enabled, CFLAGS have -Dbool=char, which makes Huh? bool should never be defined to char in CFLAGS; it should only be replaced if gnulib thinks the compiler is too old. pipefd[bool] fail (obviously). Forcing the subscript to be bool by double negation fixes the build breaker. I don't get how this could possibly make a difference. The 'output' variable is declared bool, and then only ever assigned 'false' or 'true', which if bool is replaced by gnulib are still guaranteed to be 0 and 1, so using it directly as an array index is still safe. Signed-off-by: Martin Kletzander mklet...@redhat.com --- Notes: I still can't build with '--enable-test-locking' and I'm not sure this is the proper way to fix it. Also, the code wasn't touched for months, so I'm not pushing it as a build-breaker. NACK. I need more details about the actual failure you are seeing, but this is not the right patch. -- 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] [Xen-devel] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver
On 18.12.2013 13:27, Ian Campbell wrote: On Tue, 2013-12-17 at 18:32 +0100, Stefan Bader wrote: Might this libxl fix be relevant: commit 5420f26507fc5c9853eb1076401a8658d72669da Author: Jim Fehlig jfeh...@suse.com Date: Fri Jan 11 12:22:26 2013 + libxl: Set vfb and vkb devid if not done so by the caller Other devices set a sensible devid if the caller has not done so. Do the same for vfb and vkb. While at it, factor out the common code used to determine a sensible devid, so it can be used by other libxl__device_*_add functions. Signed-off-by: Jim Fehlig jfeh...@suse.com Acked-by: Ian Campbell ian.campb...@citrix.com Committed-by: Ian Campbell ian.campb...@citrix.com and a follow up in dfeccbeaa. Although the comment implies that nic's were already correctly assigning a devid if the caller specified -1, so I don't know why it doesn't work for you :-( Ok, yes, the commit above indeed changes libxl__device_nic_add to call libxl__device_nextid for the devid... Just how is this actually called. Maybe not sufficient but git grep libxl__device_nic_add in the xen code only shows the definition and a declaration in libxl_internal.h to me... I have a feeling a macro might be involved... Here we go, look for DEFINE_DEVICE_REMOVE in libxl.c. We should really add the eventual function names in comments to provide grep fodder Oh duh, yeah. So in DEFINE_DEVICE_ADD a libxl_device_nic_add is created which calls to libxl__device_nic_add. When I look for the single _ version I find a call from xl_cmdimpl.c and its public declaration in libxl.h. So I guess the bug is that libvirt in the libxl driver never seems to do so. Ok, thanks a lot for digging the out the DEFINE. As nice those are to create similar functions from template, grep and tags fail to be helpful with them. -Stefan Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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] configure: make --with-test-suite work
On Wed, Dec 18, 2013 at 06:05:15AM -0700, Eric Blake wrote: On 12/18/2013 12:03 AM, Martin Kletzander wrote: Our option '--with-test-suite' could have never worked since it was defined as AC_ARG_ENABLE([with-test-suite], ...), thus working only as '--enable-with-test-suite', but documented in configure.ac as AC_HELP_STRING([--with-test-suite], ...). In my optinion, the help string is as it should be, but the option is s/optinion/opinion/ wrong. Signed-off-by: Martin Kletzander mklet...@redhat.com --- configure.ac | 16 1 file changed, 8 insertions(+), 8 deletions(-) Indeed, you could use './configure --disable-with-test-suite' to change the behavior, but that just looks wrong. It's been broken since the introduction in commit 3a2fc27. ACK. I fixed the typo, added the commit info and pushed, thanks. 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] build: fix building with '--enable-test-locking'
On 12/18/2013 06:09 AM, Eric Blake wrote: On 12/18/2013 02:35 AM, Martin Kletzander wrote: When test-locking is enabled, CFLAGS have -Dbool=char, which makes Huh? bool should never be defined to char in CFLAGS; it should only be replaced if gnulib thinks the compiler is too old. I actually looked at configure.ac, and wow, we really ARE doing -Dbool=char when trying to use CIL. Yuck. I think --with-test-locking has bit-rotted for some time now, and is going to need a LOT of work before it can be considered usable. That option was added in commit 6962a2d, in 2009, which predates my time on libvirt, and I don't ever recall using it myself. I'm not familiar enough with CIL to speculate why it doesn't work with C99 bool (or maybe that was a limitation back in 2009 but has since been fixed). Dan? -- 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] Fix crash in virsystemdtest with dbus 1.7.6
On 12/18/2013 04:14 AM, Cédric Bosdonnat wrote: D-bus introduced some changes in its locking code. Overriding the init function skips the new locking init and thus crashes later in libvirt test. Removing the function makes the test pass again. --- tests/virsystemdmock.c | 5 - 1 file changed, 5 deletions(-) Ouch. We added the override because it was needed on older platforms. Have you tested that this doesn't break the test on RHEL 5? diff --git a/tests/virsystemdmock.c b/tests/virsystemdmock.c index b8fc031..b3b82b4 100644 --- a/tests/virsystemdmock.c +++ b/tests/virsystemdmock.c @@ -31,11 +31,6 @@ void dbus_connection_set_change_sigpipe(dbus_bool_t will_modify_sigpipe ATTRIBUT { } -dbus_bool_t dbus_threads_init_default(void) -{ -return 1; -} - DBusConnection *dbus_bus_get(DBusBusType type ATTRIBUTE_UNUSED, DBusError *error ATTRIBUTE_UNUSED) { -- 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] build: fix building with '--enable-test-locking'
On Wed, Dec 18, 2013 at 06:09:40AM -0700, Eric Blake wrote: On 12/18/2013 02:35 AM, Martin Kletzander wrote: When test-locking is enabled, CFLAGS have -Dbool=char, which makes Huh? bool should never be defined to char in CFLAGS; it should only be replaced if gnulib thinks the compiler is too old. Gnulib doesn't do that, it's our configure.ac thing (but I must say I don't know whether that's copied from somewhere or not) introduced in 6962a2dd7e: AC_ARG_ENABLE([test-locking], [AS_HELP_STRING([--enable-test-locking], [thread locking tests using CIL @:@default=no@:@])], [case ${enableval} in yes|no) ;; *) AC_MSG_ERROR([bad value ${enableval} for test-locking option]) ;; esac], [enableval=no]) enable_locking=$enableval if test $enable_locking = yes; then LOCK_CHECKING_CFLAGS=-Dbool=char -D_Bool=char -save-temps AC_SUBST([LOCK_CHECKING_CFLAGS]) fi AM_CONDITIONAL([WITH_CIL],[test $enable_locking = yes]) pipefd[bool] fail (obviously). Forcing the subscript to be bool by double negation fixes the build breaker. I don't get how this could possibly make a difference. The 'output' variable is declared bool, and then only ever assigned 'false' or 'true', which if bool is replaced by gnulib are still guaranteed to be 0 and 1, so using it directly as an array index is still safe. But the thing is that due to -Dbool=char the variable is declared char, not bool. Signed-off-by: Martin Kletzander mklet...@redhat.com --- Notes: I still can't build with '--enable-test-locking' and I'm not sure this is the proper way to fix it. Also, the code wasn't touched for months, so I'm not pushing it as a build-breaker. NACK. I need more details about the actual failure you are seeing, but this is not the right patch. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix race leading to crash when setting up dbus watches
On 12/18/2013 05:21 AM, Daniel P. Berrange wrote: Currently the virDBusAddWatch does virEventAddHandle(fd, flags, virDBusWatchCallback, watch, NULL); dbus_watch_set_data(watch, info, virDBusWatchFree); Unfortunately this is racy - since the event loop is in a different thread, the virDBusWatchCallback method may be run before we get to calling dbus_watch_set_data. We must reverse the order of these calls See https://bugzilla.redhat.com/show_bug.cgi?id=885445 Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/util/virdbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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] [Xen-devel] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver
On Wed, 2013-12-18 at 14:12 +0100, Stefan Bader wrote: On 18.12.2013 13:27, Ian Campbell wrote: On Tue, 2013-12-17 at 18:32 +0100, Stefan Bader wrote: Might this libxl fix be relevant: commit 5420f26507fc5c9853eb1076401a8658d72669da Author: Jim Fehlig jfeh...@suse.com Date: Fri Jan 11 12:22:26 2013 + libxl: Set vfb and vkb devid if not done so by the caller Other devices set a sensible devid if the caller has not done so. Do the same for vfb and vkb. While at it, factor out the common code used to determine a sensible devid, so it can be used by other libxl__device_*_add functions. Signed-off-by: Jim Fehlig jfeh...@suse.com Acked-by: Ian Campbell ian.campb...@citrix.com Committed-by: Ian Campbell ian.campb...@citrix.com and a follow up in dfeccbeaa. Although the comment implies that nic's were already correctly assigning a devid if the caller specified -1, so I don't know why it doesn't work for you :-( Ok, yes, the commit above indeed changes libxl__device_nic_add to call libxl__device_nextid for the devid... Just how is this actually called. Maybe not sufficient but git grep libxl__device_nic_add in the xen code only shows the definition and a declaration in libxl_internal.h to me... I have a feeling a macro might be involved... Here we go, look for DEFINE_DEVICE_REMOVE in libxl.c. We should really add the eventual function names in comments to provide grep fodder Oh duh, yeah. So in DEFINE_DEVICE_ADD a libxl_device_nic_add is created which calls to libxl__device_nic_add. When I look for the single _ version I find a call from xl_cmdimpl.c and its public declaration in libxl.h. So I guess the bug is that libvirt in the libxl driver never seems to do so The macro creates libxl__add_nics which adds the nics from the libxl_domain_config-nics array. I don't think libvirt needs to call libxl_device_nic_add manually unless it is hotplugging a new nic at runtime. . Ok, thanks a lot for digging the out the DEFINE. As nice those are to create similar functions from template, grep and tags fail to be helpful with them. -Stefan Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] build: fix building with '--enable-test-locking'
On 12/18/2013 06:25 AM, Martin Kletzander wrote: pipefd[bool] fail (obviously). Forcing the subscript to be bool by double negation fixes the build breaker. I don't get how this could possibly make a difference. The 'output' variable is declared bool, and then only ever assigned 'false' or 'true', which if bool is replaced by gnulib are still guaranteed to be 0 and 1, so using it directly as an array index is still safe. But the thing is that due to -Dbool=char the variable is declared char, not bool. But if the variable contains exactly 0 or 1, it still makes no difference as an array index whether it was typed bool or char. -- 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] python pypi package - backport older version?
On Wed, Dec 18, 2013 at 07:51:00AM -0500, Jason Antman wrote: Hello, First off, thanks for the wonderful project, and thanks even more for all of the excellent work on the Python bindings lately. I'm working on a small project to collect data on kvm hosts/guests via a python collector client and display the data in a web interface. It works beautifully when using my various distros' OS packages for libvirt-python, but I've hit a bit of a snag when trying to do automated testing. I'm quite happy to see libvirt-python packaged as a python package and on pypi, but the version there is 1.2.0, which requires libvirt = 0.9.11. Unfortunately, I was planning to test my python app on travis-ci, which runs Ubuntu Precise (12.04 LTS), and the latest version of libvirt for that is 0.9.8 (package python-libvirt 0.9.8-2ubuntu17.13). If I were to submit a patch, would there be any interest in me backporting the setup.py/packaging work to an older version of the python bindings - say 0.9.8 - and getting it published on pypi? It is not practical to support any version older than 0.9.11. The code generator requires that the API XML description files be installed by libvirt and it did not do that prior to the 0.9.11 release For older distros just use the libvirt-python APIs that were bundled with that distros' version fo libvirt. 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] [Xen-devel] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver
On 18.12.2013 14:28, Ian Campbell wrote: On Wed, 2013-12-18 at 14:12 +0100, Stefan Bader wrote: On 18.12.2013 13:27, Ian Campbell wrote: On Tue, 2013-12-17 at 18:32 +0100, Stefan Bader wrote: Might this libxl fix be relevant: commit 5420f26507fc5c9853eb1076401a8658d72669da Author: Jim Fehlig jfeh...@suse.com Date: Fri Jan 11 12:22:26 2013 + libxl: Set vfb and vkb devid if not done so by the caller Other devices set a sensible devid if the caller has not done so. Do the same for vfb and vkb. While at it, factor out the common code used to determine a sensible devid, so it can be used by other libxl__device_*_add functions. Signed-off-by: Jim Fehlig jfeh...@suse.com Acked-by: Ian Campbell ian.campb...@citrix.com Committed-by: Ian Campbell ian.campb...@citrix.com and a follow up in dfeccbeaa. Although the comment implies that nic's were already correctly assigning a devid if the caller specified -1, so I don't know why it doesn't work for you :-( Ok, yes, the commit above indeed changes libxl__device_nic_add to call libxl__device_nextid for the devid... Just how is this actually called. Maybe not sufficient but git grep libxl__device_nic_add in the xen code only shows the definition and a declaration in libxl_internal.h to me... I have a feeling a macro might be involved... Here we go, look for DEFINE_DEVICE_REMOVE in libxl.c. We should really add the eventual function names in comments to provide grep fodder Oh duh, yeah. So in DEFINE_DEVICE_ADD a libxl_device_nic_add is created which calls to libxl__device_nic_add. When I look for the single _ version I find a call from xl_cmdimpl.c and its public declaration in libxl.h. So I guess the bug is that libvirt in the libxl driver never seems to do so The macro creates libxl__add_nics which adds the nics from the libxl_domain_config-nics array. I don't think libvirt needs to call libxl_device_nic_add manually unless it is hotplugging a new nic at runtime. Bah, this is another one, DEFINE_DEVICES_ADD in libxl_devices.c, that does that. That seems to be used from a few places. That needs more research to understand the call paths. Probably simpler starting from the entry which looks to be libxl_domain_create_new from libvirt's side. . Ok, thanks a lot for digging the out the DEFINE. As nice those are to create similar functions from template, grep and tags fail to be helpful with them. -Stefan Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] virsh: man: Mention that volumes need to be in storage pool for undefine
https://bugzilla.redhat.com/show_bug.cgi?id=105 When undefining a VM with storage the man page doesn't explicitly mention that the volumes need to be a part of the storage pool otherwise it won't work. --- tools/virsh.pod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 677931f..59213c6 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1794,7 +1794,8 @@ on inactive domains. Volume deletion is only attempted after the domain is undefined; if not all of the requested volumes could be deleted, the error message indicates what still remains behind. If a volume path is not found in the domain definition, it's treated as if the volume was successfully -deleted. +deleted. Only volumes managed by libvirt in storage pools can be removed this +way. (See Bdomblklist for list of target names associated to a domain). Example: --storage vda,/path/to/storage.img -- 1.8.5.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] undefine with storage fixes
Two fixes related to the virsh undefine --storage command. Peter Krempa (2): virsh: man: Mention that volumes need to be in storage pool for undefine virsh: domain: Fix undefine with storage of 'volume' disks tools/virsh-domain.c | 36 ++-- tools/virsh.pod | 3 ++- 2 files changed, 36 insertions(+), 3 deletions(-) -- 1.8.5.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] virsh: domain: Fix undefine with storage of 'volume' disks
The undefine code that removes the storage along with the VM didn't take into acount the existence of 'volume' type disks. Add the functionality. --- tools/virsh-domain.c | 36 ++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8b80e1e..760dca5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2939,6 +2939,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) int nvol_nodes; char *source = NULL; char *target = NULL; +char *pool = NULL; size_t i; size_t j; @@ -3048,6 +3049,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) vshUndefineVolume vol; VIR_FREE(source); VIR_FREE(target); +VIR_FREE(pool); /* get volume source and target paths */ if (!(target = virXPathString(string(./target/@dev), ctxt))) @@ -3057,9 +3059,12 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ./source/@file| ./source/@dir| ./source/@name| - ./source/@dev), ctxt))) + ./source/@dev| + ./source/@volume), ctxt))) continue; +pool = virXPathString(string(./source/@pool), ctxt); + /* lookup if volume was selected by user */ if (vol_list) { bool found = false; @@ -3075,7 +3080,33 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) continue; } -if (!(vol.vol = virStorageVolLookupByPath(ctl-conn, source))) { +if (pool) { +virStoragePoolPtr storagepool = NULL; + +if (!source) { +vshPrint(ctl, + _(Missing storage volume name for disk '%s'), + target); +continue; +} + +if (!(storagepool = virStoragePoolLookupByName(ctl-conn, + pool))) { +vshPrint(ctl, + _(Storage pool '%s' for volume '%s' not found.), + pool, target); +vshResetLibvirtError(); +continue; +} + +vol.vol = virStorageVolLookupByName(storagepool, source); +virStoragePoolFree(storagepool); + +} else { + vol.vol = virStorageVolLookupByPath(ctl-conn, source); +} + +if (!vol.vol) { vshPrint(ctl, _(Storage volume '%s'(%s) is not managed by libvirt. Remove it manually.\n), target, source); @@ -3190,6 +3221,7 @@ out: cleanup: VIR_FREE(source); VIR_FREE(target); +VIR_FREE(pool); for (i = 0; i nvols; i++) { VIR_FREE(vols[i].source); VIR_FREE(vols[i].target); -- 1.8.5.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] python pypi package - backport older version?
On Wed, Dec 18, 2013 at 01:56:46PM +, Daniel P. Berrange wrote: On Wed, Dec 18, 2013 at 07:51:00AM -0500, Jason Antman wrote: Hello, First off, thanks for the wonderful project, and thanks even more for all of the excellent work on the Python bindings lately. I'm working on a small project to collect data on kvm hosts/guests via a python collector client and display the data in a web interface. It works beautifully when using my various distros' OS packages for libvirt-python, but I've hit a bit of a snag when trying to do automated testing. I'm quite happy to see libvirt-python packaged as a python package and on pypi, but the version there is 1.2.0, which requires libvirt = 0.9.11. Unfortunately, I was planning to test my python app on travis-ci, which runs Ubuntu Precise (12.04 LTS), and the latest version of libvirt for that is 0.9.8 (package python-libvirt 0.9.8-2ubuntu17.13). If I were to submit a patch, would there be any interest in me backporting the setup.py/packaging work to an older version of the python bindings - say 0.9.8 - and getting it published on pypi? It is not practical to support any version older than 0.9.11. The code generator requires that the API XML description files be installed by libvirt and it did not do that prior to the 0.9.11 release For older distros just use the libvirt-python APIs that were bundled with that distros' version fo libvirt. BTW Canonical provide an add-on Cloud Archive repository for the LTS release which includes updated versions of OpenStack, QEMU/KVM and libvirt. So if you need the updated libvirt it might be an option to use that repo. 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] Fix crash in virsystemdtest with dbus 1.7.6
On Wed, Dec 18, 2013 at 06:25:07AM -0700, Eric Blake wrote: On 12/18/2013 04:14 AM, Cédric Bosdonnat wrote: D-bus introduced some changes in its locking code. Overriding the init function skips the new locking init and thus crashes later in libvirt test. Removing the function makes the test pass again. --- tests/virsystemdmock.c | 5 - 1 file changed, 5 deletions(-) Ouch. We added the override because it was needed on older platforms. Have you tested that this doesn't break the test on RHEL 5? Did we ? I saw this method was added right at the first commit of this code. 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] add --nocow option to vol-create and vol-clone
On Thu, Dec 05, 2013 at 11:16:42AM +, Daniel P. Berrange wrote: On Thu, Dec 05, 2013 at 06:35:12PM +0800, Chunyan Liu wrote: Btrfs has terrible performance when hosting VM images, even more when the guest in those VM are also using btrfs as file system. One way to mitigate this bad performance is to turn off COW attributes on VM files (since having copy on write for this kind of data is not useful). According to 'chattr' manpage, NOCOW could be set to new or empty file only on btrfs, so this patch tries to add a --nocow option to vol-create functions and vol-clone function, so that users could have a chance to set NOCOW to a new volume if that happens to create on a btrfs like file system. What effect / impact does setting this flag have from a functional POV ? Why would we not just unconditonally enable it on btrfs so it was fast out of the box ? I'm loathe to add a btrfs-specific flag to our public API. Quoting from the qemu-devel thread on the same subject: When the NOCOW attribute is set on a file, reflink copying (aka file-level snapshots) do not work: $ cp --reflink test.img test-snapshot.img This produces EINVAL. It is a regression if qemu-img create suddenly starts breaking this standard btrfs feature for existing users. So as with QEMU, I don't think libvirt can do something which could break existing users of brtfs in this way. So this would have to be an opt-in of some kind. We already have a way to express features for storage volumes in the XML description. We could use this to express a 'nocow' feature. This is preferrable to an API flag, since this would let a user query XML for an existing volume to discover if it had 'nocow' or not. 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 live modify
Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Block info query: Add flag to allow failure if not active
On Wed, Dec 18, 2013 at 06:58:10AM -0500, John Ferlan wrote: Currently the qemuDomainGetBlockInfo will return allocation == physical for most backing stores. For a qcow2 block backed device it's possible to return the highest lv extent allocated from qemu for an active guest. That is a value where allocation != physical and one would hope be less. However, if the guest is not running, then the code falls back to returning allocation == physical. This turns out to be problematic for rhev which monitors the size of the backing store. During a migration, before the VM has been started on the target and while it is deemed inactive on the source, allocation is returned as physical triggering the code to extend the file unnecessarily. Thus, this patch will check a new flag to the call to determine whether a failure should be returned to indicate to the caller that the code is unable to fetch the allocation value. This will allow the caller to decide how to proceed. Note that I chose not to return a failure as a more general rule mostly because of backwards compatability and current expectations reasons. Changing a default return action could be an unexpected action. Although returning allocation == physical perhaps is incorrect, it is how the code has been functioning. Having a 'virsh domblkinfo' return a failure for some inactive domains while succeeding for others could be confusing. A flag forces the caller to decide how to operate. As it turns out, there seems to be quite a bit of history regarding this. Details can be found in the BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1040507 Signed-off-by: John Ferlan jfer...@redhat.com --- NOTE: Trying to keep this as simple as possible since it needs to be backported. If someone has a better idea for a flag name - I'm open to suggestions... include/libvirt/libvirt.h.in | 23 --- src/libvirt.c| 11 ++- src/qemu/qemu_driver.c | 33 +++-- 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 6f79c49..420642b 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -2095,7 +2095,8 @@ int virDomainBlockResize (virDomainPtr dom, /** virDomainBlockInfo: * - * This struct provides information about the size of a block device backing store + * This struct provides information about the size of a block device + * backing store * * Examples: * @@ -2108,13 +2109,29 @@ int virDomainBlockResize (virDomainPtr dom, * * - qcow2 file in filesystem * * capacity: logical size from qcow2 header - * * allocation, physical: logical size of the file / highest qcow extent (identical) + * * allocation, physical: logical size of the file / + * highest qcow extent (identical) * * - qcow2 file in a block device * * capacity: logical size from qcow2 header - * * allocation: highest qcow extent written + * * allocation: highest qcow extent written for an active domain * * physical: size of the block device container */ + +/** + * virDomainGetBlockInfoFlags: + * + * Flags available for virDomainGetBlockInfo(). + */ +typedef enum { +VIR_DOMAIN_BLOCK_CHECK_ACTIVE = 1 0, /* If not active, then return + * failure when attempting to + * fetch data from an inactive + * domain, such as allocation + * from a qcow2 block device + */ +} virDomainGetBlockInfoFlags; I'm not convinced this flag is desirable. Can't apps just check whether the guest is running themselves, or indeed something like RHEV surely knows what its own VM is doing already. 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
[libvirt] Implementation deficiency in virInitctlSetRunLevel
Hello, list. I was pointed here by maintainer of libvirt package in Debian, Guido Günther. For the sake of completeness, the original bug report can be viewed at this link: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394 To sum up the bug report, current implementation of virInitctlSetRunLevel function (src/util/virinitctl.c) lacks any sanity checks before writing to container's /dev/initctl. In the absence of such checks, libvirtd can be easily tricked to write runlevel check request to an arbitrary main hosts' file (including hosts' /run/initctl, as described in the bug report). All it takes is one symlink in place of containers' /dev/initctl. I've checked current libvirtd's git, and it seems to me that the problem is still here. Attached to this letter is a patch which tries to mitigate the issue by checking whenever container's /dev/initctl is a pipe actually. Sincerely yours, Reco PS I'm not subscribed to this list, in case of further questions please CC me. --- a/src/util/virinitctl.c 2013-12-18 11:13:10.078432196 +0400 +++ b/src/util/virinitctl.c 2013-12-18 11:26:50.0 +0400 @@ -24,7 +24,10 @@ #include config.h #include sys/param.h +#include sys/types.h +#include sys/stat.h #include fcntl.h +#include unistd.h #include internal.h #include virinitctl.h @@ -122,6 +125,7 @@ int fd = -1; char *path = NULL; int ret = -1; +struct stat attrs; memset(req, 0, sizeof(req)); @@ -139,7 +143,10 @@ return -1; } -if ((fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY)) 0) { +if (lstat(path, attrs) == -1) +goto cleanup; + +if ((attrs.st_mode S_IFIFO) (fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY)) 0) { if (errno == ENOENT) { ret = 0; goto cleanup -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2] libxl: libxl_get_max_cpus returning a libxl error from 4.4 onward
Starting from commit 2e82c18c in Xen (will be included in Xen 4.4) both libxl_get_max_cpus() and libxl_get_max_ndoes() start returning a proper libxl error code, in case of failure. This patch fixes this in the libxl driver. Note that, although it is now basically impossible for them to return 0, that would, theoretically, still be wrong. Also, checking that the returned value is '= 0' makes the code correct for both Xen 4.4 and Xen 4.3 (and 4.2), and that is why we go for it (rather than just ' 0'). Signed-off-by: Dario Faggioli dario.faggi...@citrix.com Cc: Jim Fehlig jfeh...@suse.com Cc: Ian Jackson ian.jack...@eu.citrix.com Cc: Martin Kletzander mklet...@redhat.com --- Changes from v1: * taking care of libxl_get_max_nodes() too --- src/libxl/libxl_driver.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 692c3b7..29aa6c7 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1101,9 +1101,11 @@ libxlConnectGetMaxVcpus(virConnectPtr conn, const char *type ATTRIBUTE_UNUSED) cfg = libxlDriverConfigGet(driver); ret = libxl_get_max_cpus(cfg-ctx); -/* libxl_get_max_cpus() will return 0 if there were any failures, - e.g. xc_physinfo() failing */ -if (ret == 0) +/* On failure, libxl_get_max_cpus() will return ERROR_FAIL from Xen 4.4 + * onward, but it ever returning 0 is obviously wrong too (and it is + * what happens, on failure, on Xen 4.3 and earlier). Therefore, a 'less + * or equal' is the catchall we want. */ +if (ret = 0) ret = -1; virObjectUnref(cfg); @@ -3980,6 +3982,7 @@ libxlDomainGetNumaParameters(virDomainPtr dom, for (i = 0; i LIBXL_NUMA_NPARAM i *nparams; i++) { virMemoryParameterPtr param = params[i]; +int numnodes; switch (i) { case 0: @@ -3998,8 +4001,12 @@ libxlDomainGetNumaParameters(virDomainPtr dom, /* Node affinity */ /* Let's allocate both libxl and libvirt bitmaps */ +numnodes = libxl_get_max_nodes(priv-ctx); +if (numnodes = 0) +goto cleanup; + if (libxl_node_bitmap_alloc(priv-ctx, nodemap, 0) || -!(nodes = virBitmapNew(libxl_get_max_nodes(priv-ctx { +!(nodes = virBitmapNew(numnodes))) { virReportOOMError(); goto cleanup; } -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.chttp://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php.http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- Umar Draz Network Architect -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libxl: cannot connect to PV console
Jim Fehlig writes (Re: libxl: cannot connect to PV console): Dario Faggioli wrote: Hey Jim, I'm on libvirt.git's trunk and I see the following: [xen@ghoul3 libvirt.git]$ sudo ./tools/virsh list IdName State 3 debian_32 running 4 fedora20_64running [xen@ghoul3 libvirt.git]$ sudo ./tools/virsh console debian_32 Connected to domain debian_32 Escape character is ^] error: internal error: cannot find character device (null) [xen@ghoul3 libvirt.git]$ sudo ./tools/virsh console fedora20_64 Connected to domain fedora20_64 Escape character is ^] error: internal error: cannot find character device (null) Looking at libxlDomainOpenConsole() in src/libxl/libxl_driver.c, it currently only supports a serial console. Do you have one defined in these domains? E.g. If this is the root cause, it's a pretty bad error message. Should I or Dario take a look at the libvirt code to see if we can improve it ? Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Block info query: Add flag to allow failure if not active
On 12/18/2013 09:35 AM, Daniel P. Berrange wrote: On Wed, Dec 18, 2013 at 06:58:10AM -0500, John Ferlan wrote: I'm not convinced this flag is desirable. Can't apps just check whether the guest is running themselves, or indeed something like RHEV surely knows what its own VM is doing already. I do agree with you and that's been my argument in the referenced BZ; however, as I understand it - they have a thread that continually polls for blockInfo information and a separate thread that handles the migration. The blockInfo thread doesn't have the state information. I contend it's just as simple to add a check about the domain state and to get/check the reason value as well. That is - I think the blockInfo thread should be more aware of state. Of course, the return argument is that libvirt shouldn't return different answers on consecutive fetches where the first fetch is when the guest is active and the second is when it's not. To be honest this feels a bit hackish and it requires a deliberate change to their code to not only provide the flag, but handle the error. Since they'd already be changing their code to handle this, then why not change to check state. There is a downside to their checking state though and that's a timing condition where their check could indicate the guest was active, but the next clock tick it becomes inactive. Thus, their code would be in the same position of getting what is felt is the wrong answer. I figure opening it up to community discussion will help decide one way or another the best approach. I'm all for adjusting the documentation and leaving the code the way it is now as well. John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Umar, you have to clone it from git repository and compile it and install. You can simply do it by: git clone git://libvirt.org/libvirt-php.git ./autogen.sh make sudo make install And then you have to restart your Apache webserver. For example how to use it, see the test in test-domain-create-get-metadata.phpt file (it's normal PHP script, however I use phpt extension as PHP test but it's standard PHP code). Michal On 12/18/2013 03:45 PM, Umar Draz wrote: Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.c http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php. http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org http://php-virt-control.org http://php-virt-control.org
Re: [libvirt] [PATCH] Block info query: Add flag to allow failure if not active
On Wed, Dec 18, 2013 at 09:49:46AM -0500, John Ferlan wrote: On 12/18/2013 09:35 AM, Daniel P. Berrange wrote: On Wed, Dec 18, 2013 at 06:58:10AM -0500, John Ferlan wrote: I'm not convinced this flag is desirable. Can't apps just check whether the guest is running themselves, or indeed something like RHEV surely knows what its own VM is doing already. I do agree with you and that's been my argument in the referenced BZ; however, as I understand it - they have a thread that continually polls for blockInfo information and a separate thread that handles the migration. The blockInfo thread doesn't have the state information. But it must have a virDomainPtr instance, so it can use virDomainGetState() or virDomainIsActive() if it cares about this. I contend it's just as simple to add a check about the domain state and to get/check the reason value as well. That is - I think the blockInfo thread should be more aware of state. Of course, the return argument is that libvirt shouldn't return different answers on consecutive fetches where the first fetch is when the guest is active and the second is when it's not. Sure, I agree that libvirt isn't ideal here - our hands are tied by the fact that QEMU doesn't make this data available to us offline. If we changed anything on the libvirt side, then I'd want to see us do a proper fix to get the data but that'd require qemu help; To be honest this feels a bit hackish and it requires a deliberate change to their code to not only provide the flag, but handle the error. Since they'd already be changing their code to handle this, then why not change to check state. There is a downside to their checking state though and that's a timing condition where their check could indicate the guest was active, but the next clock tick it becomes inactive. Thus, their code would be in the same position of getting what is felt is the wrong answer. If they check the state after querying the data, then yes they could get bogus data. If they check the state before querying the info, then the race condition scenario does not lead to bad behaviour - they would be simply be discarding the allocation value unncessarily which is exactly the same situation they'd be in if the libvirt API itself checked this too, and the guest shutoff after libvirt checked its state. So I don't see a need for this libvirt change here. I figure opening it up to community discussion will help decide one way or another the best approach. I'm all for adjusting the documentation and leaving the code the way it is now as well. Updating docs would be my recommendation. 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] [Xen-devel] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver
On 18.12.2013 14:28, Ian Campbell wrote: On Wed, 2013-12-18 at 14:12 +0100, Stefan Bader wrote: On 18.12.2013 13:27, Ian Campbell wrote: On Tue, 2013-12-17 at 18:32 +0100, Stefan Bader wrote: Might this libxl fix be relevant: commit 5420f26507fc5c9853eb1076401a8658d72669da Author: Jim Fehlig jfeh...@suse.com Date: Fri Jan 11 12:22:26 2013 + libxl: Set vfb and vkb devid if not done so by the caller Other devices set a sensible devid if the caller has not done so. Do the same for vfb and vkb. While at it, factor out the common code used to determine a sensible devid, so it can be used by other libxl__device_*_add functions. Signed-off-by: Jim Fehlig jfeh...@suse.com Acked-by: Ian Campbell ian.campb...@citrix.com Committed-by: Ian Campbell ian.campb...@citrix.com and a follow up in dfeccbeaa. Although the comment implies that nic's were already correctly assigning a devid if the caller specified -1, so I don't know why it doesn't work for you :-( Ok, yes, the commit above indeed changes libxl__device_nic_add to call libxl__device_nextid for the devid... Just how is this actually called. Maybe not sufficient but git grep libxl__device_nic_add in the xen code only shows the definition and a declaration in libxl_internal.h to me... I have a feeling a macro might be involved... Here we go, look for DEFINE_DEVICE_REMOVE in libxl.c. We should really add the eventual function names in comments to provide grep fodder Oh duh, yeah. So in DEFINE_DEVICE_ADD a libxl_device_nic_add is created which calls to libxl__device_nic_add. When I look for the single _ version I find a call from xl_cmdimpl.c and its public declaration in libxl.h. So I guess the bug is that libvirt in the libxl driver never seems to do so The macro creates libxl__add_nics which adds the nics from the libxl_domain_config-nics array. I don't think libvirt needs to call libxl_device_nic_add manually unless it is hotplugging a new nic at runtime. Hm, so I think this is the path: libxl_domain_create_new - do_domain_create - initiate_domain_create - libxl__bootloader_run (HVM domain, skipping bootloader) - domcreate_bootloader_done - domcreate_rebuild_done - domcreate_launch_dm - libxl__spawn_local_dm - domcreate_devmodel_started In libxl__spawn_local_dm, there is the following loop: for (i = 0; i d_config-num_nics; i++) { /* We have to init the nic here, because we still haven't * called libxl_device_nic_add at this point, but qemu needs * the nic information to be complete. */ ret = libxl__device_nic_setdefault(gc, d_config-nics[i], domid); if (ret) goto error_out; } So I think when starting the dm, the devid just is not set as setdefault does not seem to do so. I would be done in the later domcreate_devmodel_started callback but that is too late for the generated qemu arguments. -Stefan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3] qemu: ask for -enable-fips when FIPS is required
On 12/18/2013 03:59 AM, Peter Krempa wrote: On 12/17/13 19:36, Eric Blake wrote: On a system that is enforcing FIPS, most libraries honor the current mode by default. Qemu, on the other hand, refused to honor FIPS mode unless you add the '-enable-fips' command line option; worse, this option is not discoverable via QMP, and is only present on binaries built for Linux. So, if we detect FIPS mode, then we unconditionally ask for FIPS; either qemu is new enough to have the option and then correctly cripple insecure VNC passwords, or it is so old that we are correctly avoiding a FIPS violation by preventing qemu from starting. Meanwhile, if we don't detect FIPS mode, then omitting the argument is safe whether the qemu has the option (but it would do nothing because FIPS is disabled) or whether qemu lacks the option (including in the case where we are not running on Linux). The testsuite was a bit interesting: we don't want our test to depend on whether it is being run in FIPS mode, so I had to tweak things to set the capability bit outside of our normal interaction with capability parsing. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1035474 ACK. I verified that the detection works correctly when the file is present and contains the expected data. Thanks; pushed. -- 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: man: Mention that volumes need to be in storage pool for undefine
On 12/18/2013 07:10 AM, Peter Krempa wrote: https://bugzilla.redhat.com/show_bug.cgi?id=105 When undefining a VM with storage the man page doesn't explicitly mention that the volumes need to be a part of the storage pool otherwise it won't work. --- tools/virsh.pod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ACK. (Although this is yet another place where libvirt auto-creating temporary storage pools for any disk referenced by a domain might be nice...) diff --git a/tools/virsh.pod b/tools/virsh.pod index 677931f..59213c6 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1794,7 +1794,8 @@ on inactive domains. Volume deletion is only attempted after the domain is undefined; if not all of the requested volumes could be deleted, the error message indicates what still remains behind. If a volume path is not found in the domain definition, it's treated as if the volume was successfully -deleted. +deleted. Only volumes managed by libvirt in storage pools can be removed this +way. (See Bdomblklist for list of target names associated to a domain). Example: --storage vda,/path/to/storage.img -- 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: domain: Fix undefine with storage of 'volume' disks
On 12/18/2013 07:10 AM, Peter Krempa wrote: The undefine code that removes the storage along with the VM didn't take into acount the existence of 'volume' type disks. Add the functionality. s/acount/account/ --- tools/virsh-domain.c | 36 ++-- 1 file changed, 34 insertions(+), 2 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] libvirt live modify
Hi Michal I tried but on autogen.sh is failed automake: error: global options already processed automake: Please contact bug-autom...@gnu.org. at /usr/share/automake-1.14/Automake/Channels.pm line 662, GEN0 line 77. Automake::Channels::msg('automake', '', 'global options already processed') called at /usr/share/automake-1.14/Automake/ChannelDefs.pm line 212 Automake::ChannelDefs::prog_error('global options already processed') called at /usr/share/automake-1.14/Automake/Options.pm line 421 Automake::Options::process_global_option_list('HASH(0x246df60)') called at /usr/bin/automake line 5331 Automake::scan_autoconf_traces('configure.ac') called at /usr/bin/automake line 5431 Automake::scan_autoconf_files() called at /usr/bin/automake line 8259 autoreconf: automake failed with exit status: 29 Br. Umar On Wed, Dec 18, 2013 at 7:50 PM, Michal Novotny minov...@redhat.com wrote: Hi Umar, you have to clone it from git repository and compile it and install. You can simply do it by: git clone git://libvirt.org/libvirt-php.git ./autogen.sh make sudo make install And then you have to restart your Apache webserver. For example how to use it, see the test in test-domain-create-get-metadata.phpt file (it's normal PHP script, however I use phpt extension as PHP test but it's standard PHP code). Michal On 12/18/2013 03:45 PM, Umar Draz wrote: Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.c http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php. http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote:
Re: [libvirt] libvirt live modify
Hi Umar, then you don't have working automake setup. Please google how to solve it, I apologize but I don't really have much time to solve it right now. Thanks for understanding, Michal On 12/18/2013 04:21 PM, Umar Draz wrote: Hi Michal I tried but on autogen.sh is failed automake: error: global options already processed automake: Please contact bug-autom...@gnu.org mailto:bug-autom...@gnu.org. at /usr/share/automake-1.14/Automake/Channels.pm line 662, GEN0 line 77. Automake::Channels::msg('automake', '', 'global options already processed') called at /usr/share/automake-1.14/Automake/ChannelDefs.pm line 212 Automake::ChannelDefs::prog_error('global options already processed') called at /usr/share/automake-1.14/Automake/Options.pm line 421 Automake::Options::process_global_option_list('HASH(0x246df60)') called at /usr/bin/automake line 5331 Automake::scan_autoconf_traces('configure.ac http://configure.ac') called at /usr/bin/automake line 5431 Automake::scan_autoconf_files() called at /usr/bin/automake line 8259 autoreconf: automake failed with exit status: 29 Br. Umar On Wed, Dec 18, 2013 at 7:50 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, you have to clone it from git repository and compile it and install. You can simply do it by: git clone git://libvirt.org/libvirt-php.git http://libvirt.org/libvirt-php.git ./autogen.sh make sudo make install And then you have to restart your Apache webserver. For example how to use it, see the test in test-domain-create-get-metadata.phpt file (it's normal PHP script, however I use phpt extension as PHP test but it's standard PHP code). Michal On 12/18/2013 03:45 PM, Umar Draz wrote: Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.c http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php. http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com
Re: [libvirt] libvirt live modify
Hi Michal, No worries, I will But again Thanks Br. Umar On Wed, Dec 18, 2013 at 8:25 PM, Michal Novotny minov...@redhat.com wrote: Hi Umar, then you don't have working automake setup. Please google how to solve it, I apologize but I don't really have much time to solve it right now. Thanks for understanding, Michal On 12/18/2013 04:21 PM, Umar Draz wrote: Hi Michal I tried but on autogen.sh is failed automake: error: global options already processed automake: Please contact bug-autom...@gnu.org mailto:bug-autom...@gnu.org. at /usr/share/automake-1.14/Automake/Channels.pm line 662, GEN0 line 77. Automake::Channels::msg('automake', '', 'global options already processed') called at /usr/share/automake-1.14/Automake/ChannelDefs.pm line 212 Automake::ChannelDefs::prog_error('global options already processed') called at /usr/share/automake-1.14/Automake/Options.pm line 421 Automake::Options::process_global_option_list('HASH(0x246df60)') called at /usr/bin/automake line 5331 Automake::scan_autoconf_traces('configure.ac http://configure.ac') called at /usr/bin/automake line 5431 Automake::scan_autoconf_files() called at /usr/bin/automake line 8259 autoreconf: automake failed with exit status: 29 Br. Umar On Wed, Dec 18, 2013 at 7:50 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, you have to clone it from git repository and compile it and install. You can simply do it by: git clone git://libvirt.org/libvirt-php.git http://libvirt.org/libvirt-php.git ./autogen.sh make sudo make install And then you have to restart your Apache webserver. For example how to use it, see the test in test-domain-create-get-metadata.phpt file (it's normal PHP script, however I use phpt extension as PHP test but it's standard PHP code). Michal On 12/18/2013 03:45 PM, Umar Draz wrote: Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.c http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php. http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com
Re: [libvirt] [PATCH] build: fix building with '--enable-test-locking'
On Wed, Dec 18, 2013 at 06:09:40AM -0700, Eric Blake wrote: On 12/18/2013 02:35 AM, Martin Kletzander wrote: When test-locking is enabled, CFLAGS have -Dbool=char, which makes Huh? bool should never be defined to char in CFLAGS; it should only be replaced if gnulib thinks the compiler is too old. pipefd[bool] fail (obviously). Forcing the subscript to be bool by double negation fixes the build breaker. I don't get how this could possibly make a difference. The 'output' variable is declared bool, and then only ever assigned 'false' or 'true', which if bool is replaced by gnulib are still guaranteed to be 0 and 1, so using it directly as an array index is still safe. Signed-off-by: Martin Kletzander mklet...@redhat.com --- Notes: I still can't build with '--enable-test-locking' and I'm not sure this is the proper way to fix it. Also, the code wasn't touched for months, so I'm not pushing it as a build-breaker. NACK. I need more details about the actual failure you are seeing, but this is not the right patch. The reason for this is that CIL didn't understand the bool type. GNULIB's automagic detection didn't help here because the build is still done by gcc which supports it just fine. We use -save-temps and then CIL analyses those intermediate files and threw up. I'll see if it is still a problem on F20 CIL. 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/2] virsh: domain: Fix undefine with storage of 'volume' disks
On 12/18/13 16:18, Eric Blake wrote: On 12/18/2013 07:10 AM, Peter Krempa wrote: The undefine code that removes the storage along with the VM didn't take into acount the existence of 'volume' type disks. Add the functionality. s/acount/account/ --- tools/virsh-domain.c | 36 ++-- 1 file changed, 34 insertions(+), 2 deletions(-) ACK. Pushed; Thanks. 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] build: fix building with '--enable-test-locking'
On Wed, Dec 18, 2013 at 06:34:43AM -0700, Eric Blake wrote: On 12/18/2013 06:25 AM, Martin Kletzander wrote: pipefd[bool] fail (obviously). Forcing the subscript to be bool by double negation fixes the build breaker. I don't get how this could possibly make a difference. The 'output' variable is declared bool, and then only ever assigned 'false' or 'true', which if bool is replaced by gnulib are still guaranteed to be 0 and 1, so using it directly as an array index is still safe. But the thing is that due to -Dbool=char the variable is declared char, not bool. But if the variable contains exactly 0 or 1, it still makes no difference as an array index whether it was typed bool or char. Yep, but '--enable-werror' is sad aboot it. Anyways, the code for test-locking is way too old and I don't need it in for anything right now, so I'm ok with keeping everything as-is. Thanks for having a look at it and sorry for wasting your time. Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Remove redefinition of bool type when --enable-test-locking
Old versions of CIL did not understand the 'bool' data type, but at least 1.7.3 does now cope. We can remove the old hack which redefined bool and no longer compiles successfully. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5446634..675f1fc 100644 --- a/configure.ac +++ b/configure.ac @@ -2129,7 +2129,7 @@ AC_ARG_ENABLE([test-locking], enable_locking=$enableval if test $enable_locking = yes; then - LOCK_CHECKING_CFLAGS=-Dbool=char -D_Bool=char -save-temps + LOCK_CHECKING_CFLAGS=-save-temps AC_SUBST([LOCK_CHECKING_CFLAGS]) fi AM_CONDITIONAL([WITH_CIL],[test $enable_locking = yes]) -- 1.8.4.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Remove stray semicolon after pragma macros
The VIR_WARNINGS_NO_CAST_ALIGN / VIR_WARNINGS_RESET should not have any trailing ';' since they are pragmas. The use of a ';' results in an empty statement which confuses CIL. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/nwfilter/nwfilter_dhcpsnoop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index e8fcfef..a96a790 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -981,9 +981,9 @@ virNWFilterSnoopDHCPDecode(virNWFilterSnoopReqPtr req, /* go through the protocol headers */ switch (ntohs(pep-eh_type)) { case ETHERTYPE_IP: -VIR_WARNINGS_NO_CAST_ALIGN; +VIR_WARNINGS_NO_CAST_ALIGN pip = (struct iphdr *) pep-eh_data; -VIR_WARNINGS_RESET; +VIR_WARNINGS_RESET len -= offsetof(virNWFilterSnoopEthHdr, eh_data); break; default: -- 1.8.4.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libxl: cannot connect to PV console
On mer, 2013-12-18 at 14:45 +, Ian Jackson wrote: Jim Fehlig writes (Re: libxl: cannot connect to PV console): Dario Faggioli wrote: [xen@ghoul3 libvirt.git]$ sudo ./tools/virsh console fedora20_64 Connected to domain fedora20_64 Escape character is ^] error: internal error: cannot find character device (null) Looking at libxlDomainOpenConsole() in src/libxl/libxl_driver.c, it currently only supports a serial console. Do you have one defined in these domains? E.g. If this is the root cause, it's a pretty bad error message. Indeed. Should I or Dario take a look at the libvirt code to see if we can improve it ? Looks like it's this piece of code, in src/libxl/libxl_driver.c: libxlDomainOpenConsole(..) ... if (vm-def-nserials) chr = vm-def-serials[0]; if (!chr) { virReportError(VIR_ERR_INTERNAL_ERROR, _(cannot find character device %s), NULLSTR(dev_name)); goto cleanup; } ... } I guess I can send a patch to turn that message into something like cannot find any serial console define for the domain, either always or in the specific case where vm-def-serials[0] is NULL, as I feel like the character device (null) part is the worst and most misleading. At the same time, I'd be interested in figuring out why this does not work / stopped working. I'll investigate more. Regards, Dario -- This happens because I choose it to happen! (Raistlin Majere) - Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems RD Ltd., Cambridge (UK) signature.asc Description: This is a digitally signed message part -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] libxl: libxl_get_max_cpus returning a libxl error from 4.4 onward
On Wed, Dec 18, 2013 at 03:39:12PM +0100, Dario Faggioli wrote: Starting from commit 2e82c18c in Xen (will be included in Xen 4.4) both libxl_get_max_cpus() and libxl_get_max_ndoes() start returning s/ndoes/nodes/ a proper libxl error code, in case of failure. This patch fixes this in the libxl driver. Note that, although it is now basically impossible for them to return 0, that would, theoretically, still be wrong. Also, checking that the returned value is '= 0' makes the code correct for both Xen 4.4 and Xen 4.3 (and 4.2), and that is why we go for it (rather than just ' 0'). Signed-off-by: Dario Faggioli dario.faggi...@citrix.com Cc: Jim Fehlig jfeh...@suse.com Cc: Ian Jackson ian.jack...@eu.citrix.com Cc: Martin Kletzander mklet...@redhat.com --- Changes from v1: * taking care of libxl_get_max_nodes() too --- src/libxl/libxl_driver.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) ACK, fixed pushed. Thanks, 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 v2] libxl: libxl_get_max_cpus returning a libxl error from 4.4 onward
On mer, 2013-12-18 at 17:40 +0100, Martin Kletzander wrote: On Wed, Dec 18, 2013 at 03:39:12PM +0100, Dario Faggioli wrote: Starting from commit 2e82c18c in Xen (will be included in Xen 4.4) both libxl_get_max_cpus() and libxl_get_max_ndoes() start returning s/ndoes/nodes/ Ouch! :-( --- Changes from v1: * taking care of libxl_get_max_nodes() too --- src/libxl/libxl_driver.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) ACK, fixed pushed. Cool. Thanks, Dario -- This happens because I choose it to happen! (Raistlin Majere) - Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems RD Ltd., Cambridge (UK) signature.asc Description: This is a digitally signed message part -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Remove redefinition of bool type when --enable-test-locking
On Wed, Dec 18, 2013 at 04:16:17PM +, Daniel P. Berrange wrote: Old versions of CIL did not understand the 'bool' data type, but at least 1.7.3 does now cope. We can remove the old hack which redefined bool and no longer compiles successfully. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5446634..675f1fc 100644 --- a/configure.ac +++ b/configure.ac @@ -2129,7 +2129,7 @@ AC_ARG_ENABLE([test-locking], enable_locking=$enableval if test $enable_locking = yes; then - LOCK_CHECKING_CFLAGS=-Dbool=char -D_Bool=char -save-temps + LOCK_CHECKING_CFLAGS=-save-temps AC_SUBST([LOCK_CHECKING_CFLAGS]) fi AM_CONDITIONAL([WITH_CIL],[test $enable_locking = yes]) -- 1.8.4.2 ACK, Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] python pypi package - backport older version?
On 12/18/2013 09:15 AM, Daniel P. Berrange wrote: On Wed, Dec 18, 2013 at 01:56:46PM +, Daniel P. Berrange wrote: On Wed, Dec 18, 2013 at 07:51:00AM -0500, Jason Antman wrote: Hello, First off, thanks for the wonderful project, and thanks even more for all of the excellent work on the Python bindings lately. I'm working on a small project to collect data on kvm hosts/guests via a python collector client and display the data in a web interface. It works beautifully when using my various distros' OS packages for libvirt-python, but I've hit a bit of a snag when trying to do automated testing. I'm quite happy to see libvirt-python packaged as a python package and on pypi, but the version there is 1.2.0, which requires libvirt = 0.9.11. Unfortunately, I was planning to test my python app on travis-ci, which runs Ubuntu Precise (12.04 LTS), and the latest version of libvirt for that is 0.9.8 (package python-libvirt 0.9.8-2ubuntu17.13). If I were to submit a patch, would there be any interest in me backporting the setup.py/packaging work to an older version of the python bindings - say 0.9.8 - and getting it published on pypi? It is not practical to support any version older than 0.9.11. The code generator requires that the API XML description files be installed by libvirt and it did not do that prior to the 0.9.11 release For older distros just use the libvirt-python APIs that were bundled with that distros' version fo libvirt. BTW Canonical provide an add-on Cloud Archive repository for the LTS release which includes updated versions of OpenStack, QEMU/KVM and libvirt. So if you need the updated libvirt it might be an option to use that repo. Daniel Daniel, Ok, thanks for the heads-up and info. I'll see if I can get that working on travis-ci sometime this week, thanks for the tip. I guess in the interim I'll just roll a VM of a more recent distro to test on. -Jason -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/3] libxl: improve vcpu pinning
Basically, by making it possible to both query and change the vcpu to pcpu pinning of a (persistent) domain, even when it is not running. That happens by providing the implementation of virDomainGetVcpuPinInfo() and virDomainPinVcpuFlags() within he libxl driver, which is what happens in the first two patches. The third patch is something that can also be seen as a bugfix, and that's why I kept it separated from the second one, for easier review (although, the 'bug' does not really manifests, until virDomainPinVcpuFlags is implemented in patch 2). The logic is a lot similar to what happens in the QEMU driver. The patches are available in the following git branch: git://xenbits.xen.org/people/dariof/libvirt.git libxl/VcpuPinX Thanks and Regards, Dario --- Dario Faggioli (3): libxl: implement virDomainGetVcpuPinInfo libxl: implement virDomainPinVcpuFlags libxl: correctly handle affinity reset in virDomainPinVcpu[Flags] src/libxl/libxl_driver.c | 171 -- 1 file changed, 150 insertions(+), 21 deletions(-) -- This happens because I choose it to happen! (Raistlin Majere) - Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems RD Ltd., Cambridge (UK) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3] libxl: correctly handle affinity reset in virDomainPinVcpu[Flags]
By actually removing the vcpupin element (from within the cputune section) from the XML, rather than jus update it with a fully set vcpu affinity mask. Signed-off-by: Dario Faggioli dario.faggi...@citrix.com Cc: Jim Fehlig jfeh...@suse.com Cc: Ian Jackson ian.jack...@eu.citrix.com --- src/libxl/libxl_driver.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 4079434..9a0898a 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2363,6 +2363,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, libxlDriverPrivatePtr driver = dom-conn-privateData; libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); virDomainDefPtr targetDef = NULL; +virBitmapPtr pcpumap = NULL; virDomainObjPtr vm; int ret = -1; @@ -2391,6 +2392,10 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, sa_assert(targetDef); +pcpumap = virBitmapNewData(cpumap, maplen); +if (!pcpumap) +goto cleanup; + if (flags VIR_DOMAIN_AFFECT_LIVE) { libxl_bitmap map = { .size = maplen, .map = cpumap }; libxlDomainObjPrivatePtr priv; @@ -2404,6 +2409,17 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, } } +/* full bitmap means reset the settings (if any). */ +if (virBitmapIsAllSet(pcpumap)) { +if (virDomainVcpuPinDel(targetDef, vcpu) 0) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _(Failed to delete vcpupin xml for vcpu '%d'), + vcpu); +goto cleanup; +} +goto out; +} + if (!targetDef-cputune.vcpupin) { if (VIR_ALLOC(targetDef-cputune.vcpupin) 0) goto cleanup; @@ -2419,6 +2435,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, goto cleanup; } +out: ret = 0; if (flags VIR_DOMAIN_AFFECT_LIVE) { @@ -2430,6 +2447,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, cleanup: if (vm) virObjectUnlock(vm); +virBitmapFree(pcpumap); virObjectUnref(cfg); return ret; } -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/3] libxl: implement virDomainGetVcpuPinInfo
So that it is possible to query vcpu related information of a persistent but not running domain, like it is for the QEMU driver. In fact, before this patch, we have: # virsh list --all IdName State 5 debian_32 running - fedora20_64shut off # virsh vcpuinfo fedora20_64 error: this function is not supported by the connection driver: virDomainGetVcpuPinInfo After (same situation as above, i.e., fedora20_64 not running): # virsh vcpuinfo fedora20_64 VCPU: 0 CPU:N/A State: N/A CPU timeN/A CPU Affinity: VCPU: 1 CPU:N/A State: N/A CPU timeN/A CPU Affinity: Signed-off-by: Dario Faggioli dario.faggi...@citrix.com Cc: Jim Fehlig jfeh...@suse.com Cc: Ian Jackson ian.jack...@eu.citrix.com --- src/libxl/libxl_driver.c | 83 ++ 1 file changed, 83 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 692c3b7..750d4ec 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2415,6 +2415,88 @@ cleanup: return ret; } +static int +libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps, + unsigned char *cpumaps, int maplen, + unsigned int flags) +{ +libxlDriverPrivatePtr driver = dom-conn-privateData; +libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); +virDomainObjPtr vm = NULL; +virDomainDefPtr targetDef = NULL; +virDomainVcpuPinDefPtr *vcpupin_list; +virBitmapPtr cpumask = NULL; +int maxcpu, hostcpus, vcpu, pcpu, n, ret = -1; +unsigned char *cpumap; +bool pinned; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + +if (!(vm = libxlDomObjFromDomain(dom))) +goto cleanup; + +if (virDomainGetVcpuPinInfoEnsureACL(dom-conn, vm-def) 0) +goto cleanup; + +if (virDomainLiveConfigHelperMethod(cfg-caps, driver-xmlopt, vm, +flags, targetDef) 0) +goto cleanup; + +if (flags VIR_DOMAIN_AFFECT_LIVE) { +targetDef = vm-def; +} + +sa_assert(targetDef); + +/* Clamp to actual number of vcpus */ +if (ncpumaps targetDef-vcpus) +ncpumaps = targetDef-vcpus; + +if (!cpumaps || ncpumaps 1) { +virReportError(VIR_ERR_INVALID_ARG, %s, + _(cannot return affinity via a NULL pointer)); +goto cleanup; +} + +/* we use cfg-ctx, as vm-privateData-ctx may be NULL if VM is down */ +if ((hostcpus = libxl_get_max_cpus(cfg-ctx)) 0) +goto cleanup; + +maxcpu = maplen * 8; +if (maxcpu hostcpus) +maxcpu = hostcpus; + +/* initialize cpumaps */ +memset(cpumaps, 0xff, maplen * ncpumaps); +if (maxcpu % 8) { +for (vcpu = 0; vcpu ncpumaps; vcpu++) { +cpumap = VIR_GET_CPUMAP(cpumaps, maplen, vcpu); +cpumap[maplen - 1] = (1 maxcpu % 8) - 1; +} +} + +/* if vcpupin setting exists, there may be unused pcpus */ +for (n = 0; n targetDef-cputune.nvcpupin; n++) { +vcpupin_list = targetDef-cputune.vcpupin; +vcpu = vcpupin_list[n]-vcpuid; +cpumask = vcpupin_list[n]-cpumask; +cpumap = VIR_GET_CPUMAP(cpumaps, maplen, vcpu); +for (pcpu = 0; pcpu maxcpu; pcpu++) { +if (virBitmapGetBit(cpumask, pcpu, pinned) 0) +goto cleanup; +if (!pinned) +VIR_UNUSE_CPU(cpumap, pcpu); +} +} +ret = ncpumaps; + +cleanup: +if (vm) +virObjectUnlock(vm); +virObjectUnref(cfg); +return ret; +} static int libxlDomainGetVcpus(virDomainPtr dom, virVcpuInfoPtr info, int maxinfo, @@ -4237,6 +4319,7 @@ static virDriver libxlDriver = { .domainGetVcpusFlags = libxlDomainGetVcpusFlags, /* 0.9.0 */ .domainPinVcpu = libxlDomainPinVcpu, /* 0.9.0 */ .domainGetVcpus = libxlDomainGetVcpus, /* 0.9.0 */ +.domainGetVcpuPinInfo = libxlDomainGetVcpuPinInfo, /* 1.2.1 */ .domainGetXMLDesc = libxlDomainGetXMLDesc, /* 0.9.0 */ .connectDomainXMLFromNative = libxlConnectDomainXMLFromNative, /* 0.9.0 */ .connectDomainXMLToNative = libxlConnectDomainXMLToNative, /* 0.9.0 */ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3] libxl: implement virDomainPinVcpuFlags
And use it to implement libxlDomainPinVcpu(), similarly to what happens in the QEMU driver. This way, it is possible to both query and change the vcpu affinity of a persistent but not running domain. In face, before this patch, we have: # virsh list --all IdName State 5 debian_32 running - fedora20_64shut off # virsh vcpupin fedora20_64 0 2-4 --current error: this function is not supported by the connection driver: virDomainPinVcpuFlags After (same situation as above): # virsh vcpupin fedora20_64 0 2-4 --current # virsh vcpupin fedora20_64 0 VCPU: CPU Affinity -- 0: 2-4 Signed-off-by: Dario Faggioli dario.faggi...@citrix.com Cc: Jim Fehlig jfeh...@suse.com Cc: Ian Jackson ian.jack...@eu.citrix.com --- src/libxl/libxl_driver.c | 72 -- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 750d4ec..4079434 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2356,45 +2356,61 @@ cleanup: } static int -libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap, - int maplen) +libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu, +unsigned char *cpumap, int maplen, +unsigned int flags) { libxlDriverPrivatePtr driver = dom-conn-privateData; libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); -libxlDomainObjPrivatePtr priv; +virDomainDefPtr targetDef = NULL; virDomainObjPtr vm; int ret = -1; -libxl_bitmap map; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); if (!(vm = libxlDomObjFromDomain(dom))) goto cleanup; -if (virDomainPinVcpuEnsureACL(dom-conn, vm-def) 0) +if (virDomainPinVcpuFlagsEnsureACL(dom-conn, vm-def, flags) 0) goto cleanup; -if (!virDomainObjIsActive(vm)) { +if ((flags VIR_DOMAIN_AFFECT_LIVE) !virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_INVALID, %s, - _(cannot pin vcpus on an inactive domain)); + _(domain is inactive)); goto cleanup; } -priv = vm-privateData; - -map.size = maplen; -map.map = cpumap; -if (libxl_set_vcpuaffinity(priv-ctx, dom-id, vcpu, map) != 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _(Failed to pin vcpu '%d' with libxenlight), vcpu); +if (virDomainLiveConfigHelperMethod(cfg-caps, driver-xmlopt, vm, +flags, targetDef) 0) goto cleanup; + +if (flags VIR_DOMAIN_AFFECT_LIVE) { +targetDef = vm-def; } -if (!vm-def-cputune.vcpupin) { -if (VIR_ALLOC(vm-def-cputune.vcpupin) 0) +sa_assert(targetDef); + +if (flags VIR_DOMAIN_AFFECT_LIVE) { +libxl_bitmap map = { .size = maplen, .map = cpumap }; +libxlDomainObjPrivatePtr priv; + +priv = vm-privateData; +if (libxl_set_vcpuaffinity(priv-ctx, dom-id, vcpu, map) != 0) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _(Failed to pin vcpu '%d' with libxenlight), + vcpu); goto cleanup; -vm-def-cputune.nvcpupin = 0; +} } -if (virDomainVcpuPinAdd(vm-def-cputune.vcpupin, -vm-def-cputune.nvcpupin, + +if (!targetDef-cputune.vcpupin) { +if (VIR_ALLOC(targetDef-cputune.vcpupin) 0) +goto cleanup; +targetDef-cputune.nvcpupin = 0; +} +if (virDomainVcpuPinAdd(targetDef-cputune.vcpupin, +targetDef-cputune.nvcpupin, cpumap, maplen, vcpu) 0) { @@ -2403,11 +2419,14 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap, goto cleanup; } -if (virDomainSaveStatus(driver-xmlopt, cfg-stateDir, vm) 0) -goto cleanup; - ret = 0; +if (flags VIR_DOMAIN_AFFECT_LIVE) { +ret = virDomainSaveStatus(driver-xmlopt, cfg-stateDir, vm); +} else if (flags VIR_DOMAIN_AFFECT_CONFIG) { +ret = virDomainSaveConfig(cfg-configDir, targetDef); +} + cleanup: if (vm) virObjectUnlock(vm); @@ -2416,6 +2435,14 @@ cleanup: } static int +libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap, + int maplen) +{ +return libxlDomainPinVcpuFlags(dom, vcpu, cpumap, maplen, + VIR_DOMAIN_AFFECT_LIVE); +} + +static int libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps, unsigned char *cpumaps, int maplen,
Re: [libvirt] Implementation deficiency in virInitctlSetRunLevel
On 18.12.2013 15:33, Reco wrote: Hello, list. I was pointed here by maintainer of libvirt package in Debian, Guido Günther. For the sake of completeness, the original bug report can be viewed at this link: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394 To sum up the bug report, current implementation of virInitctlSetRunLevel function (src/util/virinitctl.c) lacks any sanity checks before writing to container's /dev/initctl. In the absence of such checks, libvirtd can be easily tricked to write runlevel check request to an arbitrary main hosts' file (including hosts' /run/initctl, as described in the bug report). All it takes is one symlink in place of containers' /dev/initctl. I've checked current libvirtd's git, and it seems to me that the problem is still here. Attached to this letter is a patch which tries to mitigate the issue by checking whenever container's /dev/initctl is a pipe actually. Sincerely yours, Reco PS I'm not subscribed to this list, in case of further questions please CC me. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list [Pasting the patch here] --- a/src/util/virinitctl.c 2013-12-18 11:13:10.078432196 +0400 +++ b/src/util/virinitctl.c 2013-12-18 11:26:50.0 +0400 @@ -24,7 +24,10 @@ #include config.h #include sys/param.h +#include sys/types.h +#include sys/stat.h #include fcntl.h +#include unistd.h #include internal.h #include virinitctl.h @@ -122,6 +125,7 @@ int fd = -1; char *path = NULL; int ret = -1; +struct stat attrs; memset(req, 0, sizeof(req)); @@ -139,7 +143,10 @@ return -1; } -if ((fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY)) 0) { +if (lstat(path, attrs) == -1) +goto cleanup; While the part above looks okay, I think we should report error if the /dev/initctl is not a pipe. Moreover, with your approach, if it's really not a pipe, we don't call open() and proceed to safewrite(-1, ...) at line 153 which will report EBADF error. + +if ((attrs.st_mode S_IFIFO) (fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY)) 0) { if (errno == ENOENT) { ret = 0; goto cleanup Missing ';' at EOL ^^^ - I guess you missed that during copy-paste. Looking forward to v2. BTW: consider using git when sending patches. I couldn't really apply this patch via 'git am'. http://libvirt.org/hacking.html#patches Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Implementation deficiency in virInitctlSetRunLevel
On Wed, Dec 18, 2013 at 06:33:21PM +0400, Reco wrote: Hello, list. I was pointed here by maintainer of libvirt package in Debian, Guido Günther. For the sake of completeness, the original bug report can be viewed at this link: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394 To sum up the bug report, current implementation of virInitctlSetRunLevel function (src/util/virinitctl.c) lacks any sanity checks before writing to container's /dev/initctl. In the absence of such checks, libvirtd can be easily tricked to write runlevel check request to an arbitrary main hosts' file (including hosts' /run/initctl, as described in the bug report). All it takes is one symlink in place of containers' /dev/initctl. I've checked current libvirtd's git, and it seems to me that the problem is still here. Attached to this letter is a patch which tries to mitigate the issue by checking whenever container's /dev/initctl is a pipe actually. Sincerely yours, Reco PS I'm not subscribed to this list, in case of further questions please CC me. --- a/src/util/virinitctl.c 2013-12-18 11:13:10.078432196 +0400 +++ b/src/util/virinitctl.c 2013-12-18 11:26:50.0 +0400 @@ -24,7 +24,10 @@ #include config.h #include sys/param.h +#include sys/types.h +#include sys/stat.h #include fcntl.h +#include unistd.h #include internal.h #include virinitctl.h @@ -122,6 +125,7 @@ int fd = -1; char *path = NULL; int ret = -1; +struct stat attrs; memset(req, 0, sizeof(req)); @@ -139,7 +143,10 @@ return -1; } -if ((fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY)) 0) { +if (lstat(path, attrs) == -1) +goto cleanup; + +if ((attrs.st_mode S_IFIFO) (fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY)) 0) { if (errno == ENOENT) { ret = 0; goto cleanup Hmm, using lstat sets up a race condition though. I would suggest we use O_NOFOLLOW with open() but that only works for the final component of the path - so if /dev is a symlink in the guest it'll still cause problems. There are also a few other places where we use /proc/$PID/root/dev for hotplug where we mknod. If the guest setup a bad /dev symlink it could cause us problems. I think we may actually have to instead rely on forking a child which does setns(/proc/$PID/ns/mnt) to make the changes safely in the container namespace. 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] Fix crash in virsystemdtest with dbus 1.7.6
On Wed, Dec 18, 2013 at 06:25:07AM -0700, Eric Blake wrote: On 12/18/2013 04:14 AM, Cédric Bosdonnat wrote: D-bus introduced some changes in its locking code. Overriding the init function skips the new locking init and thus crashes later in libvirt test. Removing the function makes the test pass again. --- tests/virsystemdmock.c | 5 - 1 file changed, 5 deletions(-) Ouch. We added the override because it was needed on older platforms. Have you tested that this doesn't break the test on RHEL 5? I tested RHEL5.10 and it had no negative impact on the test 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 1/2] virsh: man: Mention that volumes need to be in storage pool for undefine
On 12/18/13 16:16, Eric Blake wrote: On 12/18/2013 07:10 AM, Peter Krempa wrote: https://bugzilla.redhat.com/show_bug.cgi?id=105 When undefining a VM with storage the man page doesn't explicitly mention that the volumes need to be a part of the storage pool otherwise it won't work. --- tools/virsh.pod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ACK. (Although this is yet another place where libvirt auto-creating temporary storage pools for any disk referenced by a domain might be nice...) I'm not quite sure if we want to expose the temporary storage pool functionality outside of libvirtd. Let's see how the review of my gluster series will end up where we can discuss that. Peter P.S.: Pushed. 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] Remove stray semicolon after pragma macros
On 12/18/2013 09:17 AM, Daniel P. Berrange wrote: The VIR_WARNINGS_NO_CAST_ALIGN / VIR_WARNINGS_RESET should not have any trailing ';' since they are pragmas. The use of a ';' results in an empty statement which confuses CIL. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/nwfilter/nwfilter_dhcpsnoop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ACK. diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index e8fcfef..a96a790 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -981,9 +981,9 @@ virNWFilterSnoopDHCPDecode(virNWFilterSnoopReqPtr req, /* go through the protocol headers */ switch (ntohs(pep-eh_type)) { case ETHERTYPE_IP: -VIR_WARNINGS_NO_CAST_ALIGN; +VIR_WARNINGS_NO_CAST_ALIGN pip = (struct iphdr *) pep-eh_data; -VIR_WARNINGS_RESET; +VIR_WARNINGS_RESET len -= offsetof(virNWFilterSnoopEthHdr, eh_data); break; default: -- 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] lxcDomainShutdownFlags: Cleanup @flags usage
Currently, the @flags usage is a bit unclear at first sight to say the least. There's no need for such unclear code especially when we can borrow the working code from qemuDomainShutdownFlags(). In addition, this fixes one bug too. If user requested both VIR_DOMAIN_SHUTDOWN_INITCTL and VIR_DOMAIN_SHUTDOWN_SIGNAL at the same time, he is basically saying: 'Use the force Luke! If initctl fails try sending a signal.' But with the current code we don't do that. If initctl fails for some reason (e.g. inability to write to /dev/initctl) we don't try sending any signal but fail immediately. To make things worse, making a domain shutdown with bare _SIGNAL was working by blind chance of a @rc variable being placed at correct place on the stack so its initial value was zero. Signed-off-by: Michal Privoznik mpriv...@redhat.com --- src/lxc/lxc_driver.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index c499182..a563b70 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2594,7 +2594,8 @@ lxcDomainShutdownFlags(virDomainPtr dom, virDomainObjPtr vm; char *vroot = NULL; int ret = -1; -int rc; +int rc = 0; +bool useInitctl = false, initctlRequested, signalRequested; virCheckFlags(VIR_DOMAIN_SHUTDOWN_INITCTL | VIR_DOMAIN_SHUTDOWN_SIGNAL, -1); @@ -2623,25 +2624,24 @@ lxcDomainShutdownFlags(virDomainPtr dom, (unsigned long long)priv-initpid) 0) goto cleanup; -if (flags == 0 || -(flags VIR_DOMAIN_SHUTDOWN_INITCTL)) { -if ((rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF, -vroot)) 0) { +initctlRequested = flags VIR_DOMAIN_SHUTDOWN_INITCTL; +signalRequested = flags VIR_DOMAIN_SHUTDOWN_SIGNAL; + +if (initctlRequested || !flags) +useInitctl = true; + +if (useInitctl) { +rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF, vroot); +if (rc 0 !signalRequested) goto cleanup; -} -if (rc == 0 flags != 0 -((flags ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) { +if (rc == 0 !signalRequested) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, %s, _(Container does not provide an initctl pipe)); goto cleanup; } -} else { -rc = 0; } -if (rc == 0 -(flags == 0 || - (flags VIR_DOMAIN_SHUTDOWN_SIGNAL))) { +if (rc == 0 !useInitctl) { if (kill(priv-initpid, SIGTERM) 0 errno != ESRCH) { virReportSystemError(errno, -- 1.8.5.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Implementation deficiency in virInitctlSetRunLevel
Hi. On Wed, 18 Dec 2013 18:15:17 +0100 Michal Privoznik mpriv...@redhat.com wrote: While the part above looks okay, I think we should report error if the /dev/initctl is not a pipe. Moreover, with your approach, if it's really not a pipe, we don't call open() and proceed to safewrite(-1, ...) at line 153 which will report EBADF error. I've adjusted the patch to your suggestion. Missing ';' at EOL ^^^ - I guess you missed that during copy-paste. OOPS. My mistake. Looking forward to v2. Attached. I've tried following Daniel suggestions too. BTW: consider using git when sending patches. I couldn't really apply this patch via 'git am'. I cannot figure out how to force 'git send-email' to reply on a mail. It seems to insist to send a new one. Reco commit be722f5c49a6ceab5af7d4c5e672c0b70f969efd Author: Reco recovery...@gmail.com Date: Wed Dec 18 23:44:17 2013 +0400 Check whenever init control is a pipe diff --git a/src/util/virinitctl.c b/src/util/virinitctl.c index 64bc23a..2a2ec27 100644 --- a/src/util/virinitctl.c +++ b/src/util/virinitctl.c @@ -24,7 +24,10 @@ #include config.h #include sys/param.h +#include sys/types.h +#include dirent.h #include fcntl.h +#include string.h #include internal.h #include virinitctl.h @@ -46,11 +49,21 @@ * Copyright (C) 1995-2004 Miquel van Smoorenburg */ +#ifdef _DIRENT_HAVE_D_TYPE +# if defined(__FreeBSD_kernel__) +# define VIR_INITCTL_DIR /etc +# define VIR_INITCTL_FIFO .initctl +# else +# define VIR_INITCTL_DIR /dev +# define VIR_INITCTL_FIFO initctl +# endif +#else # if defined(__FreeBSD_kernel__) # define VIR_INITCTL_FIFO /etc/.initctl # else # define VIR_INITCTL_FIFO /dev/initctl # endif +#endif # define VIR_INITCTL_MAGIC 0x03091969 # define VIR_INITCTL_CMD_START 0 @@ -123,6 +136,13 @@ int virInitctlSetRunLevel(virInitctlRunLevel level, char *path = NULL; int ret = -1; +#ifdef _DIRENT_HAVE_D_TYPE +int dfd = -1; +DIR *dev; +char *dpath = NULL; +struct dirent* dentry; +#endif + memset(req, 0, sizeof(req)); req.magic = VIR_INITCTL_MAGIC; @@ -131,6 +151,63 @@ int virInitctlSetRunLevel(virInitctlRunLevel level, /* Yes it is an 'int' field, but wants a numeric character. Go figure */ req.runlevel = '0' + level; +#ifdef _DIRENT_HAVE_D_TYPE +if (vroot) { +if (virAsprintf(dpath, %s/%s, vroot, VIR_INITCTL_DIR) 0) +return -1; +} else { +if (VIR_STRDUP(dpath, VIR_INITCTL_DIR) 0) +return -1; +} + +if ((dfd = open(dpath, +O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY|O_DIRECTORY|O_NOFOLLOW)) 0) { +virReportSystemError(errno, + _(%s is not a directory), + dpath); +ret = -1; +goto cleanup; +} + +if ((dev = fdopendir(dfd)) == NULL) { +virReportSystemError(errno, + _(Failed to open directory %s), + dpath); +ret = -1; +goto cleanup; +} + +while ((dentry = readdir(dev))) { +if (strcmp(dentry-d_name, VIR_INITCTL_FIFO) != 0) +continue; + +if (dentry-d_type != DT_FIFO) +{ +virReportSystemError(errno, + _(Init control %s/%s is not a pipe), + dpath, VIR_INITCTL_FIFO); +closedir(dev); +ret = -1; +goto cleanup; +} + +if (virAsprintf(path, %s/%s, dpath, VIR_INITCTL_FIFO) 0) +{ +closedir(dev); +ret = -1; +goto cleanup; +} + +break; +} + +closedir(dev); + +if (! path) { +ret = 0; +goto cleanup; +} +#else if (vroot) { if (virAsprintf(path, %s/%s, vroot, VIR_INITCTL_FIFO) 0) return -1; @@ -138,8 +215,9 @@ int virInitctlSetRunLevel(virInitctlRunLevel level, if (VIR_STRDUP(path, VIR_INITCTL_FIFO) 0) return -1; } +#endif -if ((fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY)) 0) { +if ((fd = open(path, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW)) 0) { if (errno == ENOENT) { ret = 0; goto cleanup; @@ -160,6 +238,10 @@ int virInitctlSetRunLevel(virInitctlRunLevel level, ret = 1; cleanup: +#ifdef _DIRENT_HAVE_D_TYPE +VIR_FREE(dpath); +VIR_FORCE_CLOSE(dfd); +#endif VIR_FREE(path); VIR_FORCE_CLOSE(fd); return ret; -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Implementation deficiency in virInitctlSetRunLevel
On 12/18/2013 12:47 PM, Reco wrote: BTW: consider using git when sending patches. I couldn't really apply this patch via 'git am'. I cannot figure out how to force 'git send-email' to reply on a mail. git send-email --in-reply-to='messag...@example.com' for the correct value of messageid. But generally posting a new thread is better than threading your v2 to your v1 anyways, as top-level threads are easier to spot than a patch nested deep in reply to another 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
[libvirt] lvm storage pool destroy problem
Hi I am trying to stop the storage pool through php-libvirt api which is a LVM volume group. when I tried to stop it I got error error: internal error Child process (/sbin/vgchange -aln mylvmgrp) unexpected exit status 5: Can't deactivate volume group mylvmgrp with 4 open logical volume(s) Then I tried throggh virsh command but the result remain same. *root@kvm02:~# virsh pool-destroy vms* error: Failed to destroy pool vms error: internal error Child process (/sbin/vgchange -aln mylvmgrp) unexpected exit status 5: Can't deactivate volume group mylvmgrp with 4 open logical volume(s) The same error also occured if I use direct vgchange -aln on my kvm host, but then I tried *vgchange -aly mylvmgrp* this time its worked 14 logical volume(s) in volume group mylvmgrp now active 1) Now would you please help me? is this libvirt issue? or LVM? 2) Is this possible virsh pool-destroy pool also run the vgchange -aly instead of -aln Br. Umar -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Implementation deficiency in virInitctlSetRunLevel
Hi. On Wed, 18 Dec 2013 13:42:25 -0700 Eric Blake ebl...@redhat.com wrote: git send-email --in-reply-to='messag...@example.com' for the correct value of messageid. But generally posting a new thread is better than threading your v2 to your v1 anyways, as top-level threads are easier to spot than a patch nested deep in reply to another message. Thanks. Should I resend the patch the proper way again? Reco -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Implementation deficiency in virInitctlSetRunLevel
On 12/18/2013 02:06 PM, Reco wrote: Hi. On Wed, 18 Dec 2013 13:42:25 -0700 Eric Blake ebl...@redhat.com wrote: git send-email --in-reply-to='messag...@example.com' for the correct value of messageid. But generally posting a new thread is better than threading your v2 to your v1 anyways, as top-level threads are easier to spot than a patch nested deep in reply to another message. Thanks. Should I resend the patch the proper way again? Reco We also prefer that patches have authorship attributed to a legal name, rather than a nickname. But rather than resend your patch, I think we should pay attention to Dan's advice - that any solution we come up with that doesn't involve forking a child process, then resetting that child into the correct namespace, is prone to races and therefore does not solve the problem at hand (namely, that symlinks created in the guest namespace must NOT be followed in the parent in host namespace). -- 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] [Xen-devel] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver
Stefan Bader wrote: On 18.12.2013 14:28, Ian Campbell wrote: On Wed, 2013-12-18 at 14:12 +0100, Stefan Bader wrote: On 18.12.2013 13:27, Ian Campbell wrote: On Tue, 2013-12-17 at 18:32 +0100, Stefan Bader wrote: Might this libxl fix be relevant: commit 5420f26507fc5c9853eb1076401a8658d72669da Author: Jim Fehlig jfeh...@suse.com Date: Fri Jan 11 12:22:26 2013 + libxl: Set vfb and vkb devid if not done so by the caller Other devices set a sensible devid if the caller has not done so. Do the same for vfb and vkb. While at it, factor out the common code used to determine a sensible devid, so it can be used by other libxl__device_*_add functions. Signed-off-by: Jim Fehlig jfeh...@suse.com Acked-by: Ian Campbell ian.campb...@citrix.com Committed-by: Ian Campbell ian.campb...@citrix.com and a follow up in dfeccbeaa. Although the comment implies that nic's were already correctly assigning a devid if the caller specified -1, so I don't know why it doesn't work for you :-( Ok, yes, the commit above indeed changes libxl__device_nic_add to call libxl__device_nextid for the devid... Just how is this actually called. Maybe not sufficient but git grep libxl__device_nic_add in the xen code only shows the definition and a declaration in libxl_internal.h to me... I have a feeling a macro might be involved... Here we go, look for DEFINE_DEVICE_REMOVE in libxl.c. We should really add the eventual function names in comments to provide grep fodder Oh duh, yeah. So in DEFINE_DEVICE_ADD a libxl_device_nic_add is created which calls to libxl__device_nic_add. When I look for the single _ version I find a call from xl_cmdimpl.c and its public declaration in libxl.h. So I guess the bug is that libvirt in the libxl driver never seems to do so The macro creates libxl__add_nics which adds the nics from the libxl_domain_config-nics array. I don't think libvirt needs to call libxl_device_nic_add manually unless it is hotplugging a new nic at runtime. Hm, so I think this is the path: libxl_domain_create_new - do_domain_create - initiate_domain_create - libxl__bootloader_run (HVM domain, skipping bootloader) - domcreate_bootloader_done - domcreate_rebuild_done - domcreate_launch_dm - libxl__spawn_local_dm - domcreate_devmodel_started In libxl__spawn_local_dm, there is the following loop: for (i = 0; i d_config-num_nics; i++) { /* We have to init the nic here, because we still haven't * called libxl_device_nic_add at this point, but qemu needs * the nic information to be complete. */ ret = libxl__device_nic_setdefault(gc, d_config-nics[i], domid); if (ret) goto error_out; } So I think when starting the dm, the devid just is not set as setdefault does not seem to do so. I would be done in the later domcreate_devmodel_started callback but that is too late for the generated qemu arguments. Sorry for jumping in late... I stumbled across this problem just before openSUSE13.1 released and did a quick fix in libvirt https://build.opensuse.org/package/view_file/Virtualization:openSUSE13.1/libvirt/libxl-hvm-nic.patch?expand=1 I removed setting the NIC devid in the libxl driver a while back to be consistent with other devices http://libvirt.org/git/?p=libvirt.git;a=commit;h=ba64b97134a6129a48684f22f31be92c3b6eef96 The quick fix was to essentially revert the above commit until I could investigate further. Thank you for now having done that investigation :). Can the devid assignment logic be moved from libxl__device_nic_add() to libxl__device_nic_setdefault()? Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [v7 2/6] change qemu driver to use hostdev common library
Jim Fehlig wrote: Chunyan Liu wrote: Change qemu driver to use hostdev common library instead of APIs in qemu_hostdev.[ch] This patch causes 'make check' to fail qemuxml2xmltest and qemuargv2xmltest tests. Also, there's a segfault when running qemuhotplugtest. ~/upstream/libvirt/tests libtool --mode=execute gdb qemuhotplugtest (gdb) r ... Program received signal SIGSEGV, Segmentation fault. 0x77a6ed64 in virLockManagerPluginGetDriver (plugin=0x0) at locking/lock_manager.c:291 291return plugin-driver; (gdb) bt #0 0x77a6ed64 in virLockManagerPluginGetDriver (plugin=0x0) at locking/lock_manager.c:291 #1 0x77a6fc3f in virDomainLockManagerNew (plugin=0x0, uri=0x4fb743 qemu:///session, dom=0x7464f0, withResources=false) at locking/domain_lock.c:132 #2 0x77a702a9 in virDomainLockDiskAttach (plugin=0x0, uri=0x4fb743 qemu:///session, dom=0x7464f0, disk=0x75f240) at locking/domain_lock.c:256 #3 0x00456010 in qemuDomainAttachVirtioDiskDevice (conn=0x0, driver=0x72eba0 driver, vm=0x7464f0, disk=0x75f240) at qemu/qemu_hotplug.c:257 #4 0x00457d06 in qemuDomainAttachDeviceDiskLive (conn=0x0, driver=0x72eba0 driver, vm=0x7464f0, dev=0x75eab0) at qemu/qemu_hotplug.c:777 #5 0x0041d1a4 in testQemuHotplugAttach (vm=0x7464f0, dev=0x75eab0) at qemuhotplugtest.c:109 #6 0x0041d83c in testQemuHotplug (data=0x7fffdc90) at qemuhotplugtest.c:279 #7 0x0041ef7b in virtTestRun (title=0x4eea60 hotplug-base ATTACH disk-virtio, body=0x41d46e testQemuHotplug, data=0x7fffdc90) at testutils.c:138 #8 0x0041e195 in mymain () at qemuhotplugtest.c:430 #9 0x00420291 in virtTestMain (argc=1, argv=0x7fffe258, func=0x41da09 mymain) at testutils.c:593 #10 0x0041ebc5 in main (argc=1, argv=0x7fffe258) at qemuhotplugtest.c:487 While chatting on IRC yesterday, Chunyan mentioned she was not seeing this segfault. After applying the latest updates to my test setup, I'm no longer seeing it either. Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [v8 2/6] add a unit test for hostdev common library
Add unit test for hostdev common library. Current tests are based on virpcimock. Signed-off-by: Chunyan Liu cy...@suse.com --- tests/Makefile.am |5 + tests/virhostdevtest.c | 481 tests/virpcimock.c | 45 +- 3 files changed, 530 insertions(+), 1 deletions(-) create mode 100644 tests/virhostdevtest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 568b7a0..3e66d8c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -141,6 +141,7 @@ test_programs = virshtest sockettest \ virportallocatortest \ sysinfotest \ virstoragetest \ + virhostdevtest \ $(NULL) if WITH_REMOTE @@ -754,6 +755,10 @@ vircgroupmock_la_CFLAGS = $(AM_CFLAGS) vircgroupmock_la_LDFLAGS = -module -avoid-version \ -rpath /evil/libtool/hack/to/force/shared/lib/creation +virhostdevtest_SOURCES = \ + virhostdevtest.c testutils.h testutils.c +virhostdevtest_LDADD = $(LDADDS) + virpcitest_SOURCES = \ virpcitest.c testutils.h testutils.c virpcitest_LDADD = $(LDADDS) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c new file mode 100644 index 000..5b45548 --- /dev/null +++ b/tests/virhostdevtest.c @@ -0,0 +1,481 @@ +/* + * Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * http://www.gnu.org/licenses/. + * + * Author: Chunyan Liu cy...@suse.com + */ + +#include config.h + +#include testutils.h + +#ifdef __linux__ + +# include stdlib.h +# include stdio.h +# include sys/types.h +# include sys/stat.h +# include fcntl.h +# include virhostdev.h + +# define VIR_FROM_THIS VIR_FROM_NONE + +# define CHECK_LIST_COUNT(list, cnt)\ +if ((count = virPCIDeviceListCount(list)) != cnt) { \ +virReportError(VIR_ERR_INTERNAL_ERROR, \ + Unexpected count of items in #list : %d,\ + expecting %zu, count, (size_t) cnt); \ +goto cleanup; \ +} + +#ifdef DEBUG +#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__) +#else +#define DPRINTF(fmt, ...) do { } while (0) +#endif + +#define TEST_STATE_DIR abs_builddir /hostdevmgr +static const char *drv_name = test_driver; +static const char *dom_name = test_domain; +static const unsigned char *uuid = +(unsigned char *)(f92360b0-2541-8791-fb32-d1f838811541); +static int nhostdevs = 3; +static virDomainHostdevDefPtr hostdevs[] = {NULL, NULL, NULL}; +static virPCIDevicePtr dev[] = {NULL, NULL, NULL}; +static virHostdevManagerPtr mgr = NULL; + +static void +myCleanup(void) +{ +size_t i; +for (i = 0; i nhostdevs; i++) { + virPCIDeviceFree(dev[i]); + virDomainHostdevDefFree(hostdevs[i]); +} + +if (mgr) { +virObjectUnref(mgr-activePciHostdevs); +virObjectUnref(mgr-inactivePciHostdevs); +virObjectUnref(mgr-activeUsbHostdevs); +VIR_FREE(mgr-stateDir); +VIR_FREE(mgr); +} +} + +static int +myInit(void) +{ +size_t i; + +for (i = 0; i nhostdevs; i++) { +virDomainHostdevSubsys subsys; +hostdevs[i] = virDomainHostdevDefAlloc(); +if (!hostdevs[i]) +goto cleanup; +hostdevs[i]-mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; +subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; +subsys.u.pci.addr.domain = 0; +subsys.u.pci.addr.bus = 0; +subsys.u.pci.addr.slot = i + 1; +subsys.u.pci.addr.function = 0; +subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM; +hostdevs[i]-source.subsys = subsys; +} + +for (i = 0; i nhostdevs; i++) { +if (!(dev[i] = virPCIDeviceNew(0, 0, i + 1, 0)) || +virPCIDeviceSetStubDriver(dev[i], pci-stub) 0) +goto cleanup; +} + +if (VIR_ALLOC(mgr) 0) +goto cleanup; +if ((mgr-activePciHostdevs = virPCIDeviceListNew()) == NULL) +goto cleanup; +if ((mgr-activeUsbHostdevs = virUSBDeviceListNew()) == NULL) +goto cleanup; +if ((mgr-inactivePciHostdevs = virPCIDeviceListNew()) == NULL) +goto cleanup; +if ((mgr-activeScsiHostdevs = virSCSIDeviceListNew()) == NULL) +goto cleanup; +if (VIR_STRDUP(mgr-stateDir,
[libvirt] [v8 5/6] add hostdev pci backend type for xen
Add VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN. For legacy xen, it will use pciback as stub driver. Signed-off-by: Chunyan Liu cy...@suse.com --- docs/schemas/domaincommon.rng |1 + src/conf/domain_conf.c|3 ++- src/conf/domain_conf.h|1 + src/libxl/libxl_domain.c |9 + src/qemu/qemu_command.c |3 +-- src/qemu/qemu_hotplug.c |4 +--- src/util/virhostdev.c | 12 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index be32c6b..ebbeaca 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3318,6 +3318,7 @@ choice valuekvm/value valuevfio/value + valuexen/value /choice /attribute empty/ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0079234..9475b25 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -617,7 +617,8 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysPciBackend, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST, default, kvm, - vfio) + vfio, + xen) VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST, storage, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 647d115..5068b09 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -414,6 +414,7 @@ typedef enum { VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automaticaly, prefer VFIO */ VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM,/* force legacy kvm style */ VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO, /* force vfio */ +VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN,/* force legacy xen style, use pciback */ VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST } virDomainHostdevSubsysPciBackendType; diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 68009db..32e798b 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -393,6 +393,15 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, STRNEQ(def-os.type, hvm)) dev-data.chr-targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; +if (dev-type == VIR_DOMAIN_DEVICE_HOSTDEV) { +virDomainHostdevDefPtr hostdev = dev-data.hostdev; + +if (hostdev-mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS +hostdev-source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI +hostdev-source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) +hostdev-source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN; +} + return 0; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d50c9aa..6802376 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5538,8 +5538,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def, virBufferAddLit(buf, vfio-pci); break; -case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: -case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: +default: virReportError(VIR_ERR_INTERNAL_ERROR, _(invalid PCI passthrough type '%s'), virDomainHostdevSubsysPciBackendTypeToString(backend)); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9ea95b7..3d15d9f 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1193,9 +1193,7 @@ qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver, break; -case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: -case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: -case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: +default: break; } diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 63690b7..1b0354f 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -373,6 +373,13 @@ virHostdevGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) } break; +case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN : +if (virPCIDeviceSetStubDriver(dev, pciback) 0) { +virObjectUnref(list); +return NULL; +} +break; + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM : case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: if (virPCIDeviceSetStubDriver(dev, pci-stub) 0) { @@ -1191,6 +1198,11 @@ virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr, goto cleanup; break; +case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN : +if (virPCIDeviceSetStubDriver(dev, pciback) 0) +goto cleanup; +break; + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM : case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: if (virPCIDeviceSetStubDriver(dev, pci-stub) 0) -- 1.6.0.2 -- libvir-list mailing list libvir-list@redhat.com
[libvirt] [v8 0/6]Write separate module for hostdev passthrough
These patches implements a separate module for hostdev passthrough so that it could be shared by different drivers and can maintain a global state of a host device. patch 1/6: extract hostdev passthrough function from qemu_hostdev.c and make it reusable by multiple drivers. patch 2/6: add a unit test for hostdev common library. patch 3/6: switch qemu driver to use the common library instead of its own hostdev passthrough APIs. patch 4/6: switch lxc driver to use the common library instead of its own hostdev passthrough APIs. patch 5/6: add a hostdev pci backend type for xen usage. patch 6/6: add pci passthrough to libxl driver. --- Changes: * fix v7 comments * reorganize order of patches * rebase to latest source code Chunyan Liu (6): add hostdev passthrough common library add a unit test for hostdev common library change qemu driver to use hostdev common library change lxc driver to use hostdev common library add hostdev pci backend type for xen add pci passthrough to libxl driver docs/schemas/domaincommon.rng |1 + po/POTFILES.in |3 +- src/Makefile.am|3 +- src/conf/domain_conf.c |3 +- src/conf/domain_conf.h |1 + src/libvirt_private.syms | 21 + src/libxl/libxl_conf.c | 63 + src/libxl/libxl_conf.h |4 + src/libxl/libxl_domain.c |9 + src/libxl/libxl_driver.c | 448 +- src/lxc/lxc_conf.h |4 - src/lxc/lxc_driver.c | 47 +- src/lxc/lxc_hostdev.c | 413 - src/lxc/lxc_hostdev.h | 43 - src/lxc/lxc_process.c | 24 +- src/qemu/qemu_command.c|4 +- src/qemu/qemu_conf.h |9 +- src/qemu/qemu_domain.c | 22 + src/qemu/qemu_driver.c | 81 +- src/qemu/qemu_hostdev.c| 1454 - src/qemu/qemu_hostdev.h| 76 - src/qemu/qemu_hotplug.c| 136 +- src/qemu/qemu_process.c| 40 +- src/util/virhostdev.c | 1703 src/util/virhostdev.h | 134 ++ src/util/virpci.c | 30 +- src/util/virpci.h |9 +- src/util/virscsi.c | 28 +- src/util/virscsi.h |8 +- src/util/virusb.c | 29 +- src/util/virusb.h |8 +- tests/Makefile.am |5 + .../qemuxml2argv-hostdev-pci-address.xml |1 + .../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml |1 + tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml|2 + tests/virhostdevtest.c | 481 ++ tests/virpcimock.c | 45 +- 37 files changed, 3181 insertions(+), 2212 deletions(-) delete mode 100644 src/lxc/lxc_hostdev.c delete mode 100644 src/lxc/lxc_hostdev.h delete mode 100644 src/qemu/qemu_hostdev.c delete mode 100644 src/qemu/qemu_hostdev.h create mode 100644 src/util/virhostdev.c create mode 100644 src/util/virhostdev.h create mode 100644 tests/virhostdevtest.c -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [v8 6/6] add pci passthrough to libxl driver
Add pci passthrough to libxl driver, support attach-device, detach-device and start a vm with pci hostdev specified. Signed-off-by: Chunyan Liu cy...@suse.com --- src/libxl/libxl_conf.c | 63 +++ src/libxl/libxl_conf.h |4 + src/libxl/libxl_driver.c | 448 +- 3 files changed, 514 insertions(+), 1 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index aaeb00e..7791e4a 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1126,6 +1126,66 @@ libxlDriverConfigGet(libxlDriverPrivatePtr driver) return cfg; } +int +libxlMakePci(virDomainHostdevDefPtr hostdev, libxl_device_pci *pcidev) +{ +if (hostdev-mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) +return -1; +if (hostdev-source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) +return -1; + +pcidev-domain = hostdev-source.subsys.u.pci.addr.domain; +pcidev-bus = hostdev-source.subsys.u.pci.addr.bus; +pcidev-dev = hostdev-source.subsys.u.pci.addr.slot; +pcidev-func = hostdev-source.subsys.u.pci.addr.function; + +return 0; +} + +static int +libxlMakePciList(virDomainDefPtr def, libxl_domain_config *d_config) +{ +virDomainHostdevDefPtr *l_hostdevs = def-hostdevs; +size_t nhostdevs = def-nhostdevs; +size_t npcidevs = 0; +libxl_device_pci *x_pcidevs; +size_t i, j; + +if (nhostdevs == 0) +return 0; + +if (VIR_ALLOC_N(x_pcidevs, nhostdevs) 0) +return -1; + +for (i = 0, j = 0; i nhostdevs; i++) { +if (l_hostdevs[i]-mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) +continue; +if (l_hostdevs[i]-source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) +continue; + +libxl_device_pci_init(x_pcidevs[j]); + +if (libxlMakePci(l_hostdevs[i], x_pcidevs[j]) 0) +goto error; + +npcidevs++; +j++; +} + +VIR_SHRINK_N(x_pcidevs, nhostdevs, nhostdevs - npcidevs); +d_config-pcidevs = x_pcidevs; +d_config-num_pcidevs = npcidevs; + +return 0; + +error: +for (i = 0; i npcidevs; i++) +libxl_device_pci_dispose(x_pcidevs[i]); + +VIR_FREE(x_pcidevs); +return -1; +} + virCapsPtr libxlMakeCapabilities(libxl_ctx *ctx) { @@ -1174,6 +1234,9 @@ libxlBuildDomainConfig(libxlDriverPrivatePtr driver, if (libxlMakeVfbList(driver, def, d_config) 0) return -1; +if (libxlMakePciList(def, d_config) 0) +return -1; + d_config-on_reboot = def-onReboot; d_config-on_poweroff = def-onPoweroff; d_config-on_crash = def-onCrash; diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index ffa93bd..958a65b 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -38,6 +38,7 @@ # include virchrdev.h +# define LIBXL_DRIVER_NAME xenlight # define LIBXL_VNC_PORT_MIN 5900 # define LIBXL_VNC_PORT_MAX 65535 @@ -148,6 +149,9 @@ libxlMakeVfb(libxlDriverPrivatePtr driver, virDomainGraphicsDefPtr l_vfb, libxl_device_vfb *x_vfb); int +libxlMakePci(virDomainHostdevDefPtr hostdev, libxl_device_pci *pcidev); + +int libxlBuildDomainConfig(libxlDriverPrivatePtr driver, virDomainObjPtr vm, libxl_domain_config *d_config); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 29aa6c7..7d4cc36 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -52,6 +52,7 @@ #include virsysinfo.h #include viraccessapicheck.h #include viratomic.h +#include virhostdev.h #define VIR_FROM_THIS VIR_FROM_LIBXL @@ -328,6 +329,7 @@ libxlVmReap(libxlDriverPrivatePtr driver, virDomainShutoffReason reason) { libxlDomainObjPrivatePtr priv = vm-privateData; +virHostdevManagerPtr hostdev_mgr; if (libxl_domain_destroy(priv-ctx, vm-def-id, NULL) 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -335,6 +337,11 @@ libxlVmReap(libxlDriverPrivatePtr driver, return -1; } +hostdev_mgr = virHostdevManagerGetDefault(); +if (hostdev_mgr != NULL) +virHostdevReAttachDomainHostdevs(hostdev_mgr, LIBXL_DRIVER_NAME, + vm-def, VIR_SP_PCI_HOSTDEV); + libxlVmCleanup(driver, vm, reason); return 0; } @@ -558,6 +565,7 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, #ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS libxl_domain_restore_params params; #endif +virHostdevManagerPtr hostdev_mgr; if (libxlDomainObjPrivateInitCtx(vm) 0) goto error; @@ -616,6 +624,13 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, goto error; } +VIR_DEBUG(Preparing host PCI devices); +hostdev_mgr = virHostdevManagerGetDefault(); +if (hostdev_mgr == NULL || +virHostdevPrepareDomainHostdevs(hostdev_mgr, LIBXL_DRIVER_NAME, +vm-def, VIR_SP_PCI_HOSTDEV) 0) +goto error; + /* use as
[libvirt] [v8 4/6] change lxc driver to use hostdev common library
Change lxc driver to use hostdev common library instead of APIs in lxc_hostdev.[ch] Signed-off-by: Chunyan Liu cy...@suse.com --- po/POTFILES.in|1 - src/Makefile.am |1 - src/lxc/lxc_conf.h|4 - src/lxc/lxc_driver.c | 47 --- src/lxc/lxc_hostdev.c | 416 - src/lxc/lxc_hostdev.h | 43 - src/lxc/lxc_process.c | 24 +++- 7 files changed, 48 insertions(+), 488 deletions(-) delete mode 100644 src/lxc/lxc_hostdev.c delete mode 100644 src/lxc/lxc_hostdev.h diff --git a/po/POTFILES.in b/po/POTFILES.in index fcd3af9..f999445 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -62,7 +62,6 @@ src/locking/lock_manager.c src/locking/sanlock_helper.c src/lxc/lxc_cgroup.c src/lxc/lxc_fuse.c -src/lxc/lxc_hostdev.c src/lxc/lxc_container.c src/lxc/lxc_conf.c src/lxc/lxc_controller.c diff --git a/src/Makefile.am b/src/Makefile.am index 8b4a25c..96563dc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -619,7 +619,6 @@ LXC_DRIVER_SOURCES = \ lxc/lxc_container.c lxc/lxc_container.h \ lxc/lxc_cgroup.c lxc/lxc_cgroup.h \ lxc/lxc_domain.c lxc/lxc_domain.h \ - lxc/lxc_hostdev.c lxc/lxc_hostdev.h \ lxc/lxc_monitor.c lxc/lxc_monitor.h \ lxc/lxc_process.c lxc/lxc_process.h \ lxc/lxc_fuse.c lxc/lxc_fuse.h \ diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h index f6cbfc9..5940b16 100644 --- a/src/lxc/lxc_conf.h +++ b/src/lxc/lxc_conf.h @@ -92,10 +92,6 @@ struct _virLXCDriver { /* Immutable pointer, self-locking APIs */ virDomainObjListPtr domains; -/* Immutable pointer. Requires lock to be held before - * calling APIs. */ -virUSBDeviceListPtr activeUsbHostdevs; - /* Immutable pointer, self-locking APIs */ virObjectEventStatePtr domainEventState; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index c499182..2824c96 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -70,6 +70,7 @@ #include virstring.h #include viraccessapicheck.h #include viraccessapichecklxc.h +#include virhostdev.h #define VIR_FROM_THIS VIR_FROM_LXC @@ -1417,9 +1418,6 @@ static int lxcStateInitialize(bool privileged, if (!(lxc_driver-securityManager = lxcSecurityInit(cfg))) goto cleanup; -if ((lxc_driver-activeUsbHostdevs = virUSBDeviceListNew()) == NULL) -goto cleanup; - if ((virLXCDriverGetCapabilities(lxc_driver, true)) == NULL) goto cleanup; @@ -1534,7 +1532,6 @@ static int lxcStateCleanup(void) virSysinfoDefFree(lxc_driver-hostsysinfo); -virObjectUnref(lxc_driver-activeUsbHostdevs); virObjectUnref(lxc_driver-caps); virObjectUnref(lxc_driver-securityManager); virObjectUnref(lxc_driver-xmlopt); @@ -3172,6 +3169,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver, mode_t mode; bool created = false; virUSBDevicePtr usb = NULL; +virHostdevManagerPtr hostdev_mgr; if (virDomainHostdevFind(vm-def, def, NULL) = 0) { virReportError(VIR_ERR_OPERATION_FAILED, %s, @@ -3179,6 +3177,14 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver, return -1; } +hostdev_mgr = virHostdevManagerGetDefault(); +if (hostdev_mgr == NULL || +virHostdevPrepareUsbHostdevs(hostdev_mgr, + LXC_DRIVER_NAME, + vm-def-name, + def, 1, 0) 0) +return -1; + if (virAsprintf(vroot, /proc/%llu/root, (unsigned long long)priv-initpid) 0) goto cleanup; @@ -3254,6 +3260,11 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver, ret = 0; cleanup: +virHostdevReAttachUsbHostdevs(hostdev_mgr, + LXC_DRIVER_NAME, + vm-def-name, + def, + 1); virDomainAuditHostdev(vm, def, attach, ret == 0); if (ret 0 created) unlink(dstfile); @@ -3716,8 +3727,7 @@ cleanup: static int -lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver, -virDomainObjPtr vm, +lxcDomainDetachDeviceHostdevUSBLive(virDomainObjPtr vm, virDomainDeviceDefPtr dev) { virLXCDomainObjPrivatePtr priv = vm-privateData; @@ -3726,6 +3736,7 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver, char *dst = NULL; char *vroot = NULL; virUSBDevicePtr usb = NULL; +virHostdevManagerPtr hostdev_mgr; if ((idx = virDomainHostdevFind(vm-def, dev-data.hostdev, @@ -3770,9 +3781,10 @@
Re: [libvirt] [PATCH RFC 02/27] qemu: snapshot: Avoid libvirtd crash when qemu crashes while snapshotting
On 12/16/2013 09:32 AM, Peter Krempa wrote: We shouldn't access the domain definition while we are in the monitor section as the domain is unlocked. Additionaly after we exit from the s/Additionaly/Additionally/ monitor we need to check if the VM is still alive. Not doing so resulted into crash if qemu exits while attempting to do a external VM snapshot. s/into/in a/ s/a external/an external/ --- src/qemu/qemu_driver.c | 46 +++--- 1 file changed, 35 insertions(+), 11 deletions(-) ACK. This one can be applied in spite of the RFC. And patch 1 was indeed helpful in testing this. -- 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 RFC 02/27] qemu: snapshot: Avoid libvirtd crash when qemu crashes while snapshotting
On 12/18/2013 08:42 PM, Eric Blake wrote: On 12/16/2013 09:32 AM, Peter Krempa wrote: We shouldn't access the domain definition while we are in the monitor section as the domain is unlocked. Additionaly after we exit from the s/Additionaly/Additionally/ monitor we need to check if the VM is still alive. Not doing so resulted into crash if qemu exits while attempting to do a external VM snapshot. s/into/in a/ s/a external/an external/ --- src/qemu/qemu_driver.c | 46 +++--- 1 file changed, 35 insertions(+), 11 deletions(-) ACK. This one can be applied in spite of the RFC. And patch 1 was indeed helpful in testing this. Spoke too soon. After trying to redefine and restart my domain, I got the dreaded state change lock error, which means there's still a locking discrepancy in your patch. 2013-12-19 04:09:14.351+: 10084: error : qemuMonitorIO:656 : internal error: End of file from monitor 2013-12-19 04:10:44.000+: 10100: warning : qemuDomainObjBeginJobInternal:1093 : Cannot start job (modify, none) for domain f18-live; current job is (none, snapshot) owned by (0, 10099) 2013-12-19 04:10:44.000+: 10100: error : qemuDomainObjBeginJobInternal:1097 : Timed out during operation: cannot acquire state change lock It's too late for me to try and find it tonight, but I'll try again in the morning if you haven't found it first. -- 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 RFC 03/27] Revert DO NOT APPLY UPSTREAM: Reproducer for disk snapshot crash
On 12/16/2013 09:32 AM, Peter Krempa wrote: This reverts commit 96313c60b91197578b313717db154b6bac029c9e. Also not to be applied upstream :) --- src/qemu/qemu_driver.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ab20dfb..2140e1b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12226,9 +12226,6 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver, goto cleanup; } -kill(vm-pid, 9); -sleep(1); - /* create the actual snapshot */ if (snap-format) formatStr = virStorageFileFormatTypeToString(snap-format); -- 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 RFC 05/27] storage: gluster: Properly fix missing slashes in volume paths
On 12/16/2013 09:32 AM, Peter Krempa wrote: Add a slash to the volume key so that the URI that is generated from it will be formated properly. The extra slash doesn't hurt in the 'key' attribute as we just need it to be unique. --- src/storage/storage_backend_gluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 1be9034..36e99e9 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -222,7 +222,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, if (VIR_STRDUP(vol-name, name) 0) goto cleanup; -if (virAsprintf(vol-key, %s%s%s, state-volname, state-dir, +if (virAsprintf(vol-key, /%s%s%s, state-volname, state-dir, This does not match the documentation. I'd rather fix the problem with the URI generation (in patch 4/27) and leave the key unchanged, if only because we already released 1.2.0 with documentation that the key does not have a leading slash. -- 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 RFC 04/27] Revert storage: fix omitted slash in gluster volume URI
On 12/16/2013 09:32 AM, Peter Krempa wrote: The fix for the missing slash at the beginning of the volume URI prints to a bad variable causing a memory leak and another one if the variable will be fixed. Revert the commit instead as we can just add a slash to the key attribute. The fix also caused a regression, where the path of the volume didn't include the actual volume name and thus was invalid. This reverts commit 6cd60b687acd04ea1538690b7d80f2809e0e29d4. --- src/storage/storage_backend_gluster.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 622526b..1be9034 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -227,10 +227,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, goto cleanup; tmp = state-uri-path; -if (virAsprintf(vol-key, %s%s, state-uri-path, name) 0) { Uggh. I see what I did: I swapped vol-key and state-uri-path, and didn't run my patch through valgrind (where I would have seen the problem). -state-uri-path = tmp; -goto cleanup; -} +state-uri-path = vol-key; Rather than reverting this patch, I'd prefer to fix the string creation to use the intended order: diff --git i/src/storage/storage_backend_gluster.c w/src/storage/storage_backend_gluster.c index 622526b..aab70ba 100644 --- i/src/storage/storage_backend_gluster.c +++ w/src/storage/storage_backend_gluster.c @@ -227,7 +227,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, goto cleanup; tmp = state-uri-path; -if (virAsprintf(vol-key, %s%s, state-uri-path, name) 0) { +if (virAsprintf(state-uri-path, %s%s, vol-key, name) 0) { state-uri-path = tmp; goto cleanup; } -- 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 RFC 04/27] Revert storage: fix omitted slash in gluster volume URI
On 12/18/2013 09:30 PM, Eric Blake wrote: Rather than reverting this patch, I'd prefer to fix the string creation to use the intended order: diff --git i/src/storage/storage_backend_gluster.c w/src/storage/storage_backend_gluster.c index 622526b..aab70ba 100644 --- i/src/storage/storage_backend_gluster.c +++ w/src/storage/storage_backend_gluster.c @@ -227,7 +227,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, goto cleanup; tmp = state-uri-path; -if (virAsprintf(vol-key, %s%s, state-uri-path, name) 0) { +if (virAsprintf(state-uri-path, %s%s, vol-key, name) 0) { Except that's not right, either. I'll post what I actually tested in a separate thread. -- 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] storage: fix bogus target in gluster volume xml
Commit 6cd60b6 was flat out broken - it tried to print into the wrong variable. My testing was obviously too cursory (did the name get a slash added?); valgrind would have caught the error. Thankfully it didn't hit any release. Reported by Peter Krempa. * src/storage/storage_backend_gluster.c (virStorageBackendGlusterRefreshVol): Fix bogus code. Signed-off-by: Eric Blake ebl...@redhat.com --- src/storage/storage_backend_gluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 622526b..9aa692e 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -227,7 +227,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state, goto cleanup; tmp = state-uri-path; -if (virAsprintf(vol-key, %s%s, state-uri-path, name) 0) { +if (virAsprintf(state-uri-path, /%s, vol-key) 0) { state-uri-path = tmp; goto cleanup; } -- 1.8.4.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/1] virsh nodecpustats erroneously returns stats for offline cpus on Linux
From: Pradipta Kr. Banerjee bpra...@in.ibm.com virsh nodecpustats erroneously returns stats for offline cpus on Linux To retrieve node cpu statistics on Linux system, the linuxNodeGetCPUstats function performs a minimal match of the input cpuid with the cpuid read from /proc/cpustat. On systems with larger cpus this can result in erroneous data. For eg if /proc/stat has similar data cpu 3645648 485 361475 3691194868 176595 40645 69850 0 1526172 0 cpu0 494045 62 42763 138516619 16107 2339 2431 0 248345 0 cpu4 402646 59 34745 138617562 17738 1413 1196 0 193948 0 cpu8 318662 32 32119 138715131 7903 927 982 0 115429 0 cpu12 247004 33 30465 138791438 5251 759 913 0 51938 0 and cpu 1,2 are offline, then 'virsh nodecpustats 1' displays data for cpu12 whereas virsh nodecpustats 2 correctly throws the following error error: Unable to get node cpu stats error: Invalid cpuNum in linuxNodeGetCPUStats This patch fixes the above mentioned problem Signed-off-by: Pradipta Kr. Banerjee bpra...@in.ibm.com --- src/nodeinfo.c | 13 + 1 file changed, 13 insertions(+) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 1838547..c9e5ff1 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -614,6 +614,8 @@ linuxNodeGetCPUStats(FILE *procstat, unsigned long long usr, ni, sys, idle, iowait; unsigned long long irq, softirq, steal, guest, guest_nice; char cpu_header[3 + INT_BUFSIZE_BOUND(cpuNum)]; +char cpu_header_read[3 + INT_BUFSIZE_BOUND(cpuNum)]; +char cpu_header_fmt[8]; if ((*nparams) == 0) { /* Current number of cpu stats supported by linux */ @@ -631,8 +633,11 @@ linuxNodeGetCPUStats(FILE *procstat, if (cpuNum == VIR_NODE_CPU_STATS_ALL_CPUS) { strcpy(cpu_header, cpu); +snprintf(cpu_header_fmt, sizeof(cpu_header_fmt), %%%ds, 3); } else { snprintf(cpu_header, sizeof(cpu_header), cpu%d, cpuNum); +snprintf(cpu_header_fmt, sizeof(cpu_header_fmt), %%%ds, + (int)(3 + INT_BUFSIZE_BOUND(cpuNum))); } while (fgets(line, sizeof(line), procstat) != NULL) { @@ -649,6 +654,14 @@ linuxNodeGetCPUStats(FILE *procstat, continue; } +/* + * Process with stats gathering only if the cpuid from /proc/stat + * matches exactly with the input cpuid +*/ +sscanf(buf, cpu_header_fmt, cpu_header_read); +if (STRNEQ(cpu_header, cpu_header_read)) +continue; + for (i = 0; i *nparams; i++) { virNodeCPUStatsPtr param = params[i]; -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 02/27] qemu: snapshot: Avoid libvirtd crash when qemu crashes while snapshotting
On 12/16/2013 09:32 AM, Peter Krempa wrote: We shouldn't access the domain definition while we are in the monitor section as the domain is unlocked. Additionaly after we exit from the monitor we need to check if the VM is still alive. Not doing so resulted into crash if qemu exits while attempting to do a external VM snapshot. --- It would also be worth including your 1/27 patch body in the commit message of this patch (since 1/27 isn't being committed upstream, but at least the git log should make it easy to find out how to reliably trigger the problem). -- 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