Re: [libvirt] [RFC PATCH 02/12] conf: Add support for parsing and formatting max memory and slot count
On 01/30/2015 06:20 AM, Peter Krempa wrote: Add a XML element that will allow to specify maximum supportable memory s/a XML/an XML/ and the count of memory slots to use with memory hotplug. Might be nice to demonstrate that XML here in the commit message, not just in formatdomain.html. To avoid possible confusion and misuse of the new element this patch also explicitly forbids the use of the maxMemory setting in individual drivers's post parse callbacks. This limitation will be lifted when the s/drivers's/drivers'/ support will be implemented. --- docs/formatdomain.html.in| 19 +++ docs/schemas/domaincommon.rng| 8 + src/bhyve/bhyve_domain.c | 4 +++ src/conf/domain_conf.c | 64 src/conf/domain_conf.h | 7 src/libvirt_private.syms | 1 + src/libxl/libxl_domain.c | 5 +++ src/lxc/lxc_domain.c | 4 +++ src/openvz/openvz_driver.c | 11 +-- src/parallels/parallels_driver.c | 6 +++- src/phyp/phyp_driver.c | 6 +++- src/qemu/qemu_domain.c | 4 +++ src/uml/uml_driver.c | 6 +++- src/vbox/vbox_common.c | 6 +++- src/vmware/vmware_driver.c | 6 +++- src/vmx/vmx.c| 6 +++- src/xen/xen_driver.c | 4 +++ src/xenapi/xenapi_driver.c | 6 +++- tests/domainschemadata/maxMemory.xml | 19 +++ 19 files changed, 183 insertions(+), 9 deletions(-) create mode 100644 tests/domainschemadata/maxMemory.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f8d5f89..12f7ede 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -664,6 +664,7 @@ pre lt;domaingt; ... + lt;maxMemory slots='123' unit='KiB'gt;1524288lt;/maxMemorygt; 123 is unusual; the example would look more realistic with a power of 2. lt;memory unit='KiB'gt;524288lt;/memorygt; lt;currentMemory unit='KiB'gt;524288lt;/currentMemorygt; Hmm. Historically, memory was the maximum memory, then ballooning was introduced and currentMemory was added to show the live difference between the ballooned current value and the boot-up maximum. But with the idea of hot-plug, I see where you are coming from - the balloon can only inflate or deflate up to the amount of memory currently plugged in, so maxMemory is the startup maximum, memory becomes the amount plugged in, and currentMemory reflects the balloon value (that is, current = memory = max). So I guess this makes sense; it may be more interesting figuring out how to expose it all through virsh. ... @@ -697,6 +698,24 @@ span class='since'codeunit/code since 0.9.11/span, span class='since'codedumpCore/code since 0.10.2 (QEMU only)/span/dd + dtcodemaxMemory/code/dt + ddThe run time maximum memory allocation of the guest. The initial +memory specified by codelt;memorygt;/code can be increased by +hot-plugging of memory to the limit specified by this element. + +The codeunit/code attribute behaves the same as for +codememory/code. + +The codeslots/code attribute specifies the number of slots +available for adding memory to the guest. The bounds are hypervisor +specific. + +Note that due to alignment of the memory chunks added via memory +hotplug the full size allocation specified by this element may be +impossible to achieve. Is a hypervisor free to reject requests that aren't aligned properly? With memory, we had the odd situation that we allowed the hypervisor to round requests up, so that live numbers were different than the original startup numbers; it might be easier to not repeat that. + optional +element name=maxMemory + ref name=scaledInteger/ + attribute name=slots +ref name=unsignedInt/ + /attribute This says the slots attribute mandatory; is there ever a reason to allow it to be optional (defaulting to one slot, an all-or-none hotplug)? +/** + * virDomainDefCheckUnsupportedMemoryHotplug: + * @def: domain definition + * + * Returns -1 if the domain definition would enable memory hotplug via the + * maxMemory tunable and reports an error. Otherwise returns 0. + */ +int +virDomainDefCheckUnsupportedMemoryHotplug(virDomainDefPtr def) +{ +/* memory hotplug tunables are not supported by this driver */ +if (def-mem.max_memory 0 || def-mem.memory_slots 0) { Based on the XML, mem.memory_slots cannot be specified unless max_memory is also present (at least, assuming that you enforce that maxMemory be = memory). But I guess it doesn't hurt to check both values. @@ -12735,6 +12756,16 @@ virDomainDefParseXML(xmlDocPtr xml, def-mem.cur_balloon, false, true) 0)
Re: [libvirt] [PATCH] check fc_host and vport_ops capabilities in SCSI host nodedevs
On Thu, Feb 5, 2015 at 6:13 PM, John Ferlan jfer...@redhat.com wrote: ...snip... Had a chance to try your patch. # cat testCaps.py import libvirt conn = libvirt.openReadOnly('qemu:///system') fc = conn.nodeDeviceLookupByName('scsi_host1') caps = fc.listCaps(); print The capabilities are, caps nCaps = fc.numOfCaps(); print The number of Caps : , nCaps # ./run python testCaps.py The capabilities are ['scsi_host', 'fc_host', 'vports'] The number of Caps : 3 Excellent - thanks... I assume prior to my patch the result would just be 'scsi_host' and 1 for number of caps... Yes it is.. :) # python testCaps.py The capabilities are ['scsi_host'] The num of Caps : 1 Given the above output(also virsh behaviour), I am thinking my patch should actually be checking the string vports instead of vport_ops. I am sending you the v2 with that change. Feel free to change the commit message as appropriate. I can edit your existing patch in my git branch to change vport_ops to vports - that's not a problem... Thanks for offering to edit my patch. Regards, Shiva John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] check fc_host and vport_ops capabilities in SCSI host nodedevs
On Wed, Feb 4, 2015 at 8:39 PM, Shivaprasad bhat shivaprasadb...@gmail.com wrote: On Wed, Feb 4, 2015 at 7:25 PM, John Ferlan jfer...@redhat.com wrote: On 02/03/2015 03:59 PM, John Ferlan wrote: On 02/03/2015 06:55 AM, Shivaprasad G Bhat wrote: fc_host vport_ops devices are SCSI devices with additional capabilities. Mere string comparison of basic types is not sufficient in this case. This patch introduces additional capability checks for SCSI devices if the user is looking to list 'fc_host' or 'vport_ops' devices. Signed-off-by: Shivaprasad G Bhat sb...@linux.vnet.ibm.com --- src/conf/node_device_conf.c |8 1 file changed, 8 insertions(+) While this does work and more or less follows what was done for virNodeDeviceCapMatch, I'm wondering if the 'fc_host' and 'vports_ops' capabilities need to also be returned in a list of capabilities for a node device That is I see that virNodeDeviceListCaps() seems to be only returning 1 capability for every device. However, for the scsi_host, it has those additional fc_host and vport_ops capabilities which if returned in the list would then be found by the python listDevices code which for some devices (like the scsi_host here) there may be more than one way to get at the information. I'm investigating whether modifying nodeDeviceListCaps() in src/node_device/node_device_driver.c to add fc_host and vport_ops to the return caps_list will resolve the issue... This also means virNodeDeviceNumOfCaps() (and it's driver API nodeDeviceNumOfCaps) will need some tweaking too. Another option would be to fix the libvirt-python code to use ListAllDevices with the flags argument like virsh does. John ...snip... As it turns out your patch will be required in order to cover the virNodeListDevices case as well as the attached patch in order to cover the virNodeDeviceNumOfCaps and virNodeDeviceListCaps cases. You are right, The listDevices doesn't use either of these APIs. Could you take a look at the attached code and try it out on your system to make sure it does what I expect (the system I use to test these types of checks is unavailable at the moment). What should happen is for 'scsi_host' devices with 'fc_host' and/or 'vports' capability types - the cap_list returned will be larger than 1. The code currently only has ever returned 1 element. The patch also lists the sample python which should work. With your successful test, I'll push the patches (although I'm tweaking your commit message a bit - it'll be very similar to the attached patch commit message). Thanks John. I agree with your changes for virNodeDeviceListCaps and virNodeDeviceNumOfCaps. I too don't have systems for verifying the patch for now. Let me see if I can catch hold of a system tomorrow. Had a chance to try your patch. # cat testCaps.py import libvirt conn = libvirt.openReadOnly('qemu:///system') fc = conn.nodeDeviceLookupByName('scsi_host1') caps = fc.listCaps(); print The capabilities are, caps nCaps = fc.numOfCaps(); print The number of Caps : , nCaps # ./run python testCaps.py The capabilities are ['scsi_host', 'fc_host', 'vports'] The number of Caps : 3 Given the above output(also virsh behaviour), I am thinking my patch should actually be checking the string vports instead of vport_ops. I am sending you the v2 with that change. Feel free to change the commit message as appropriate. Thanks - John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] check fc_host and vport_ops capabilities in SCSI host nodedevs
...snip... Had a chance to try your patch. # cat testCaps.py import libvirt conn = libvirt.openReadOnly('qemu:///system') fc = conn.nodeDeviceLookupByName('scsi_host1') caps = fc.listCaps(); print The capabilities are, caps nCaps = fc.numOfCaps(); print The number of Caps : , nCaps # ./run python testCaps.py The capabilities are ['scsi_host', 'fc_host', 'vports'] The number of Caps : 3 Excellent - thanks... I assume prior to my patch the result would just be 'scsi_host' and 1 for number of caps... Given the above output(also virsh behaviour), I am thinking my patch should actually be checking the string vports instead of vport_ops. I am sending you the v2 with that change. Feel free to change the commit message as appropriate. I can edit your existing patch in my git branch to change vport_ops to vports - that's not a problem... John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3] qemu: Pass file descriptor when using TPM passthrough
On 01/30/2015 07:17 PM, Eric Blake wrote: +} +i++; +} + +return -1; +} + /** * virCommandSetPidFile: * @cmd: the command to modify diff --git a/src/util/vircommand.h b/src/util/vircommand.h index bf65de4..198da2f 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -62,6 +62,9 @@ void virCommandPassFD(virCommandPtr cmd, void virCommandPassListenFDs(virCommandPtr cmd); +int virCommandPassFDGetFDIndex(virCommandPtr cmd, + int fd); + void virCommandSetPidFile(virCommandPtr cmd, const char *pidfile) ATTRIBUTE_NONNULL(2); Overall, I can see what you are hoping to do, and it's my fault for taking this long to get back to you on it. As penance, if you like my idea of changing virCommand to always remap child fds into consecutive orders, should I pitch in and help get that part of the patch in good condition? Sounds good ;-) I'll get to the rest of your comments 'later'. Stefan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] Interface backend attribute improvements
Both for https://bugzilla.redhat.com/show_bug.cgi?id=1147195 Ján Tomko (2): Only parse custom vhost path for virtio interfaces Error out when custom tap device path makes no sense src/conf/domain_conf.c | 6 +++- src/qemu/qemu_command.c| 17 +- .../qemuxml2argv-tap-vhost-incorrect.xml | 39 ++ .../qemuxml2xmlout-tap-vhost-incorrect.xml | 38 + tests/qemuxml2xmltest.c| 1 + 5 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] Only parse custom vhost path for virtio interfaces
It is not used for other network interface models. https://bugzilla.redhat.com/show_bug.cgi?id=1147195 --- src/conf/domain_conf.c | 6 +++- .../qemuxml2argv-tap-vhost-incorrect.xml | 39 ++ .../qemuxml2xmlout-tap-vhost-incorrect.xml | 38 + tests/qemuxml2xmltest.c| 1 + 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4251b13..da3764f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7369,6 +7369,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *vhostuser_path = NULL; char *vhostuser_type = NULL; char *trustGuestRxFilters = NULL; +char *vhost_path = NULL; virNWFilterHashTablePtr filterparams = NULL; virDomainActualNetDefPtr actual = NULL; xmlNodePtr oldnode = ctxt-node; @@ -7551,7 +7552,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(tmp); if ((tmp = virXMLPropString(cur, vhost))) -def-backend.vhost = virFileSanitizePath(tmp); +vhost_path = virFileSanitizePath(tmp); VIR_FREE(tmp); } } @@ -7992,6 +7993,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } def-driver.virtio.guest.ufo = val; } +def-backend.vhost = vhost_path; +vhost_path = NULL; } def-linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; @@ -8061,6 +8064,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(addrtype); VIR_FREE(trustGuestRxFilters); VIR_FREE(ips); +VIR_FREE(vhost_path); virNWFilterHashTableFree(filterparams); return def; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml b/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml new file mode 100644 index 000..2cf312f --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml @@ -0,0 +1,39 @@ +domain type='qemu' + nametest/name + uuidbba65c0e-c049-934f-b6aa-4e2c0582acdf/uuid + memory unit='KiB'1048576/memory + currentMemory unit='KiB'1048576/currentMemory + vcpu placement='static'1/vcpu + os +type arch='x86_64' machine='pc-0.13'hvm/type +boot dev='cdrom'/ +boot dev='hd'/ +bootmenu enable='yes'/ + /os + clock offset='utc'/ + on_poweroffdestroy/on_poweroff + on_rebootrestart/on_reboot + on_crashrestart/on_crash + devices +emulator/usr/bin/qemu/emulator +controller type='usb' index='0'/ +controller type='virtio-serial' index='0' + address type='pci' domain='0x' bus='0x00' slot='0x06' function='0x0'/ +/controller +controller type='ide' index='0'/ +controller type='pci' index='0' model='pci-root'/ +interface type='user' + mac address='52:54:00:e5:48:58'/ + model type='definitely-not-virtio'/ + driver name='vhost' queues='5'/ + backend tap='/dev/null' vhost='/dev/zero'/ +/interface +serial type='pty' + target port='0'/ +/serial +console type='pty' + target type='serial' port='0'/ +/console +memballoon model='virtio'/ + /devices +/domain diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml new file mode 100644 index 000..266cbf0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml @@ -0,0 +1,38 @@ +domain type='qemu' + nametest/name + uuidbba65c0e-c049-934f-b6aa-4e2c0582acdf/uuid + memory unit='KiB'1048576/memory + currentMemory unit='KiB'1048576/currentMemory + vcpu placement='static'1/vcpu + os +type arch='x86_64' machine='pc-0.13'hvm/type +boot dev='cdrom'/ +boot dev='hd'/ +bootmenu enable='yes'/ + /os + clock offset='utc'/ + on_poweroffdestroy/on_poweroff + on_rebootrestart/on_reboot + on_crashrestart/on_crash + devices +emulator/usr/bin/qemu/emulator +controller type='usb' index='0'/ +controller type='virtio-serial' index='0' + address type='pci' domain='0x' bus='0x00' slot='0x06' function='0x0'/ +/controller +controller type='ide' index='0'/ +controller type='pci' index='0' model='pci-root'/ +interface type='user' + mac address='52:54:00:e5:48:58'/ + model type='definitely-not-virtio'/ + backend tap='/dev/null'/ +/interface +serial type='pty' + target port='0'/ +/serial +console type='pty' + target type='serial' port='0'/ +/console +memballoon model='virtio'/ + /devices +/domain diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a0a1cab..d3dfd9e 100644 --- a/tests/qemuxml2xmltest.c +++
Re: [libvirt] [PATCH] check fc_host and vport_ops capabilitis in SCSI host nodedevs
On 02/03/2015 06:52 AM, Shivaprasad G Bhat wrote: virNodeListDevices called by listDevices indirectly uses the virNodeDeviceHasCap() which is buggy. Earlier, virNodeListDevices was used in virsh nodedev-list as well. Though, the code was rewritten to use vshNodeDeviceListCollect instead. The patch fixes listDevices output for the below python script. - import libvirt conn = libvirt.openReadOnly('qemu:///system') fc = conn.listDevices('fc_host', 0) print(fc) --- Shivaprasad G Bhat (1): check fc_host and vport_ops capabilities in SCSI host nodedevs src/conf/node_device_conf.c |8 1 file changed, 8 insertions(+) These are now pushed... Thanks again! John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] Error out when custom tap device path makes no sense
It is only usable for NETWORK and BRIDGE type interfaces. Error out when trying to start a domain where the custom tap device path is specified for interfaces of other types, or when the daemon is not privileged. Note that this cannot be checked at definition time, because the comparison is against actual type. https://bugzilla.redhat.com/show_bug.cgi?id=1147195 --- src/qemu/qemu_command.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3b6eddc..06a59d0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -299,8 +299,14 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); const char *tunpath = /dev/net/tun; -if (net-backend.tap) +if (net-backend.tap) { tunpath = net-backend.tap; +if (!cfg-privileged) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(cannot use custom tap device in session mode)); +goto cleanup; +} +} if (!(brname = virDomainNetGetActualBridgeName(net))) { virReportError(VIR_ERR_INTERNAL_ERROR, %s, _(Missing bridge name)); @@ -7721,6 +7727,15 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, return -1; } +if (net-backend.tap +!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK || + actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(Custom tap device path is not supported for: %s), + virDomainNetTypeToString(actualType)); +return -1; +} + if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK || actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) { tapfdSize = net-driver.virtio.queues; -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] 答复: Re: [PATCH 0/3] Prevent removing a in-used static bridge and destroying a in-used virtual network
Daniel P. Berrange berra...@redhat.com 2015-2-4 下午 23:10 On Wed, Feb 04, 2015 at 02:21:18AM -0500, Laine Stump wrote: On 02/03/2015 11:47 AM, Michal Privoznik wrote: On 02.02.2015 15:08, Lin Ma wrote: * Get the live state info of a virtual network through netcf in networkGetXMLDesc. * Add --system flag for net-dumpxml to show the live state info. * Check the live state info in net-destroy. * Add --force flag for net-destroy to forcibly destroy the virtual network. * Check the transient interfaces info in iface-unbridge. --- Lin Ma (3): bridge_driver: Return the live state info of a given virtual network virsh: prevent destroying a in-used network for net-destroy virsh: prevent removing a in-used bridge for iface-unbridge include/libvirt/libvirt-network.h| 1 + src/Makefile.am | 3 + src/network/bridge_driver.c | 141 ++- src/network/bridge_driver_platform.h | 7 ++ tests/Makefile.am| 4 + tools/virsh-interface.c | 25 ++- tools/virsh-network.c| 62 ++- tools/virsh.pod | 8 +- 8 files changed, 241 insertions(+), 10 deletions(-) So I've spent some time thinking about this. I don't really like the idea of producing completely different XML (it doesn't even have as its root element!). But I see what you're trying to achieve. How about putting the bridged interfaces into the network definition (on request signalized by a flag, of course). I think that if we're going to add the list of connected guest devices to a network's status, that it should just always be there - adding a new flag for every little bit of different status sets a bad precedent and sets us up to have an infinitely increasing number of flags. Like I mentioned in my response to one of the patches, I think this information is better gathered and maintained by the bridge driver as guests connect to / disconnect from a network; this avoids the necessity of dragging netcf into the picture and allows much better information - the name of the domain using each interface can be included. You know if this checking for guests were done in the virNetworkDestroy API implementation in src/network/bridge_driver.c, instead of in virsh, then we would not need any of this code for extending the XML nor parsing it in virsh. We could simply check the number of connections which is something we have directly available internally. So 95% of this patch series would go away :-C I'm sad.. :-), Anyway, Because we keep the original behaviour of net-destroy, So we keep iface-unbridge no changes as well, Then droping this patch series makes sense. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-test-API][PATCH 0/2] Add API openGraphicsFD test case
On 01/06/2015 02:50 PM, Jincheng Miao wrote: Add API openGraphicsFD test case to linux_domain.conf Jincheng Miao (2): domain: add open_graphicsfd Add open_graphicsFD to linux_domain.conf cases/linux_domain.conf | 14 ++ repos/domain/open_graphicsfd.py | 89 +++ 2 files changed, 103 insertions(+), 0 deletions(-) create mode 100644 repos/domain/open_graphicsfd.py ACK BR, Jianwei -- 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
[libvirt] [PATCH 1/5] Also store features blocking migration as CPUx86Data in the cpu map
Allowing their use with x86Data* helpers for easier filtering. --- src/cpu/cpu_x86.c | 38 ++ 1 file changed, 38 insertions(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 45be262..f6e8eec 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -90,6 +90,7 @@ struct x86_map { struct x86_feature *features; struct x86_model *models; struct x86_feature *migrate_blockers; +virCPUx86Data *migrate_blocker_data; }; static struct x86_map* virCPUx86Map; @@ -689,6 +690,36 @@ x86ParseCPUID(xmlXPathContextPtr ctxt, } +static virCPUx86Data * +x86DataFromCPUFeatureList(const struct x86_feature *list, + const struct x86_map *map) +{ +virCPUx86Data *data; +const struct x86_feature *feat; + +if (VIR_ALLOC(data) 0) +return NULL; + +for (feat = list; feat; feat = feat-next) { +const struct x86_feature *feature; +if (!(feature = x86FeatureFind(map, feat-name))) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _(Unknown CPU feature %s), feat-name); +goto error; +} + +if (x86DataAdd(data, feature-data) 0) +goto error; +} + +return data; + + error: +virCPUx86DataFree(data); +return NULL; +} + + static int x86FeatureLoad(xmlXPathContextPtr ctxt, struct x86_map *map) @@ -1139,6 +1170,7 @@ x86MapFree(struct x86_map *map) x86FeatureFree(migrate_blocker); } +virCPUx86DataFree(map-migrate_blocker_data); VIR_FREE(map); } @@ -1221,6 +1253,12 @@ virCPUx86LoadMap(void) if (x86MapLoadInternalFeatures(map) 0) goto error; +map-migrate_blocker_data = x86DataFromCPUFeatureList(map-migrate_blockers, + map); +if (!map-migrate_blocker_data) +goto error; + + return map; error: -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/5] Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE flag
This flag for virConnectBaselineCPU will allow filtering out CPU features that block migration from the result. https://bugzilla.redhat.com/show_bug.cgi?id=1171484 --- include/libvirt/libvirt-host.h | 1 + src/libvirt-host.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index f760a55..77058af 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -862,6 +862,7 @@ int virConnectGetCPUModelNames(virConnectPtr conn, */ typedef enum { VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES = (1 0), /* show all features */ +VIR_CONNECT_BASELINE_CPU_MIGRATABLE = (1 1), /* filter out non-migratable features */ } virConnectBaselineCPUFlags; char *virConnectBaselineCPU(virConnectPtr conn, diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 78ee770..b4dc13e 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -1052,6 +1052,9 @@ virConnectGetCPUModelNames(virConnectPtr conn, const char *arch, char ***models, * without this flag features that are part of the CPU model will not be * listed. * + * If @flags includes VIR_CONNECT_BASELINE_CPU_MIGRATABLE, the resulting + * CPU will not include features that block migration. + * * Returns XML description of the computed CPU (caller frees) or NULL on error. */ char * -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] 答复: Re: [PATCH 1/3] bridge_driver: Return the live state info of a given virtual network
Daniel P. Berrange berra...@redhat.com 2015-2-4 下午 17:17 On Mon, Feb 02, 2015 at 10:08:21PM +0800, Lin Ma wrote: It constructs a temporary static config of the network, Obtains all of attached interfaces information through netcf, Then removes the config. Signed-off-by: Lin Ma --- include/libvirt/libvirt-network.h| 1 + src/Makefile.am | 3 + src/network/bridge_driver.c | 141 ++- src/network/bridge_driver_platform.h | 7 ++ tests/Makefile.am| 4 + 5 files changed, 155 insertions(+), 1 deletion(-) So, IIUC, the point of this change is to display a list of all the TAP devices attached to a network. I'm not entirely convinced this is the right approach to take. Also do we want to limit this to reporting of devices inside bridges. It could be equally useful to see a list of macvtap devices associated with a physical NIC. Obtaining a list of macvtap devices associated with a physical NIC, It's a good idea. I intend to implement this api, also implement a new virsh subcommand to show these information to user. If you agreed with my thought, Then what are the proper api name and virsh subcommand name you suggest? and what about the output format? Modifying the XML to include the list of VIFs is certainly one options, but I'm not sure it is necceessarily the best. As Laine points out this is a output only attribute - not something you can feed in with the XML when defining the network. Perhaps we want to have an actual API for this - a virNetworkListPorts which returns a list of associated devices (of any type) from guests. Or perhaps we should be reporting a list of virDomainPtr's that are attached to the network, or perhaps even both. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] 答复: Re: [PATCH 0/3] Prevent removing a in-used static bridge and destroying a in-used virtual network
Daniel P. Berrange berra...@redhat.com 2015-2-4 下午 23:10 On Wed, Feb 04, 2015 at 02:21:18AM -0500, Laine Stump wrote: On 02/03/2015 11:47 AM, Michal Privoznik wrote: On 02.02.2015 15:08, Lin Ma wrote: * Get the live state info of a virtual network through netcf in networkGetXMLDesc. * Add --system flag for net-dumpxml to show the live state info. * Check the live state info in net-destroy. * Add --force flag for net-destroy to forcibly destroy the virtual network. * Check the transient interfaces info in iface-unbridge. --- Lin Ma (3): bridge_driver: Return the live state info of a given virtual network virsh: prevent destroying a in-used network for net-destroy virsh: prevent removing a in-used bridge for iface-unbridge include/libvirt/libvirt-network.h| 1 + src/Makefile.am | 3 + src/network/bridge_driver.c | 141 ++- src/network/bridge_driver_platform.h | 7 ++ tests/Makefile.am| 4 + tools/virsh-interface.c | 25 ++- tools/virsh-network.c| 62 ++- tools/virsh.pod | 8 +- 8 files changed, 241 insertions(+), 10 deletions(-) So I've spent some time thinking about this. I don't really like the idea of producing completely different XML (it doesn't even have as its root element!). But I see what you're trying to achieve. How about putting the bridged interfaces into the network definition (on request signalized by a flag, of course). I think that if we're going to add the list of connected guest devices to a network's status, that it should just always be there - adding a new flag for every little bit of different status sets a bad precedent and sets us up to have an infinitely increasing number of flags. Like I mentioned in my response to one of the patches, I think this information is better gathered and maintained by the bridge driver as guests connect to / disconnect from a network; this avoids the necessity of dragging netcf into the picture and allows much better information - the name of the domain using each interface can be included. You know if this checking for guests were done in the virNetworkDestroy API implementation in src/network/bridge_driver.c, instead of in virsh, then we would not need any of this code for extending the XML nor parsing it in virsh. We could simply check the number of connections which is something we have directly available internally. So 95% of this patch series would go away :-C I'm sad.. :-), Anyway, Because we keep the original behaviour of net-destroy, So we keep iface-unbridge no changes as well, Then droping this patch series makes sense. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/10] libxl: update dom-id in libxlDomainCreateWithFlags
Marek Marczykowski-Górecki wrote: Otherwise domainCreateWithFlags via remote returns -1 as domid. Signed-off-by: Marek Marczykowski-Górecki marma...@invisiblethingslab.com --- src/libxl/libxl_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index c95b387..ce3a99b 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2375,6 +2375,9 @@ libxlDomainCreateWithFlags(virDomainPtr dom, } ret = libxlDomainStart(driver, vm, (flags VIR_DOMAIN_START_PAUSED) != 0, -1); +if (ret 0) +goto cleanup; +dom-id = vm-def-id; It looks at though this is the only callsite of libxlDomainStart that needs this change. Have you noticed this with other APIs that call libxlDomainStart? ACK to the fix here though; pushed. Thanks! Regards, Jim cleanup: if (vm) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] Error out when custom tap device path makes no sense
On 02/05/2015 07:52 AM, Ján Tomko wrote: It is only usable for NETWORK and BRIDGE type interfaces. Error out when trying to start a domain where the custom tap device path is specified for interfaces of other types, or when the daemon is not privileged. Note that this cannot be checked at definition time, because the comparison is against actual type. https://bugzilla.redhat.com/show_bug.cgi?id=1147195 --- src/qemu/qemu_command.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) Note: Something I forgot for [1/2] The backend is not well described in formatdomain.html.in - perhaps take the opportunity to indicate that backend attribute vhost is only valid for virtio network interfaces. Do you think it's reasonable to list the default of value /dev/vhost-net Then of course for this one - formatdomain.html.in - the backend attribute tap is only usable for NETWORK and BRIDGE type interfaces. Furthermore, custom tap devices are not supported in session mode. Do you think it's reasonable to list the default value /dev/net/tun? diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3b6eddc..06a59d0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -299,8 +299,14 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); const char *tunpath = /dev/net/tun; -if (net-backend.tap) +if (net-backend.tap) { tunpath = net-backend.tap; +if (!cfg-privileged) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(cannot use custom tap device in session mode)); +goto cleanup; +} +} This seems reasonable, wasn't part of the bz, but still should be documented... ACK - with the doc changes... John if (!(brname = virDomainNetGetActualBridgeName(net))) { virReportError(VIR_ERR_INTERNAL_ERROR, %s, _(Missing bridge name)); @@ -7721,6 +7727,15 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, return -1; } +if (net-backend.tap +!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK || + actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(Custom tap device path is not supported for: %s), + virDomainNetTypeToString(actualType)); +return -1; +} + if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK || actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) { tapfdSize = net-driver.virtio.queues; -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Properly report error when cookin uuid not match the ctxt uuid
On Thu, Feb 05, 2015 at 11:42:26AM +0800, Luyao Huang wrote: Add the missing jump to the error label when cookin uuid does not match the ctxt uuid. 'cookie uuid' and 'ctxt uuid' don't seem clear enough to me. I have reworded the commit message: Add the missing jump to the error label when the uuid in the migration cookie XML does not match the uuid of the migrated domain. Signed-off-by: Luyao Huang lhu...@redhat.com --- src/qemu/qemu_migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8a8fa63..879b1bf 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1147,6 +1147,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, virReportError(VIR_ERR_INTERNAL_ERROR, _(Incoming cookie data had unexpected UUID %s vs %s), tmp, uuidstr); +goto error; } VIR_FREE(tmp); ACK and pushed. Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/5] Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE flag
Add a flag to virConnectBaselineCPU to filter out features that block migration. Ján Tomko (5): Also store features blocking migration as CPUx86Data in the cpu map Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE flag Implement VIR_CONNECT_BASELINE_CPU_MIGRATABLE in the x86 cpu driver Trivially implement VIR_CONNECT_BASELINE_CPU_MIGRATABLE for non-x86 cpus Add --migratable support to virsh cpu-baseline include/libvirt/libvirt-host.h | 1 + src/bhyve/bhyve_driver.c| 3 +- src/cpu/cpu_aarch64.c | 3 +- src/cpu/cpu_arm.c | 3 +- src/cpu/cpu_generic.c | 3 +- src/cpu/cpu_powerpc.c | 3 +- src/cpu/cpu_x86.c | 47 - src/libvirt-host.c | 3 ++ src/qemu/qemu_driver.c | 3 +- tests/cputest.c | 6 tests/cputestdata/x86-baseline-6-migratable.xml | 10 ++ tests/cputestdata/x86-baseline-6-result.xml | 11 ++ tests/cputestdata/x86-baseline-6.xml| 37 +++ tools/virsh-domain.c| 6 tools/virsh.pod | 5 +-- 15 files changed, 135 insertions(+), 9 deletions(-) create mode 100644 tests/cputestdata/x86-baseline-6-migratable.xml create mode 100644 tests/cputestdata/x86-baseline-6-result.xml create mode 100644 tests/cputestdata/x86-baseline-6.xml -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/5] Implement VIR_CONNECT_BASELINE_CPU_MIGRATABLE in the x86 cpu driver
Subtract the migrate blocker data from the result if this flag was specified. --- src/bhyve/bhyve_driver.c| 3 +- src/cpu/cpu_x86.c | 9 +- src/qemu/qemu_driver.c | 3 +- tests/cputest.c | 6 tests/cputestdata/x86-baseline-6-migratable.xml | 10 +++ tests/cputestdata/x86-baseline-6-result.xml | 11 tests/cputestdata/x86-baseline-6.xml| 37 + 7 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 tests/cputestdata/x86-baseline-6-migratable.xml create mode 100644 tests/cputestdata/x86-baseline-6-result.xml create mode 100644 tests/cputestdata/x86-baseline-6.xml diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 56cc8ab..2a1cd2f 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1340,7 +1340,8 @@ bhyveConnectBaselineCPU(virConnectPtr conn, { char *cpu = NULL; -virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL); +virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | + VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); if (virConnectBaselineCPUEnsureACL(conn) 0) goto cleanup; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index f6e8eec..a95d15a 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1953,6 +1953,9 @@ x86Baseline(virCPUDefPtr *cpus, const char *modelName; bool matchingNames = true; +virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | + VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); + if (!(map = virCPUx86GetMap())) goto error; @@ -2025,6 +2028,9 @@ x86Baseline(virCPUDefPtr *cpus, model = NULL; } +if (flags VIR_CONNECT_BASELINE_CPU_MIGRATABLE) +x86DataSubtract(base_model-data, map-migrate_blocker_data); + if (x86DataIsEmpty(base_model-data)) { virReportError(VIR_ERR_OPERATION_FAILED, %s, _(CPUs are incompatible)); @@ -2034,7 +2040,8 @@ x86Baseline(virCPUDefPtr *cpus, if (vendor virCPUx86DataAddCPUID(base_model-data, vendor-cpuid) 0) goto error; -if (x86Decode(cpu, base_model-data, models, nmodels, modelName, flags) 0) +if (x86Decode(cpu, base_model-data, models, nmodels, modelName, + flags VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) 0) goto error; if (STREQ_NULLABLE(cpu-model, modelName)) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cf351e6..8eded5e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12376,7 +12376,8 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED, { char *cpu = NULL; -virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL); +virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | + VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); if (virConnectBaselineCPUEnsureACL(conn) 0) goto cleanup; diff --git a/tests/cputest.c b/tests/cputest.c index e49ae24..ab3efdf 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -346,6 +346,8 @@ cpuTestBaseline(const void *arg) if (data-flags VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) suffix = expanded; +else if (data-flags VIR_CONNECT_BASELINE_CPU_MIGRATABLE) +suffix = migratable; else suffix = result; if (virAsprintf(result, %s-%s, data-name, suffix) 0) @@ -533,6 +535,8 @@ mymain(void) char *label;\ if ((flags) VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) \ suffix = (expanded); \ +if ((flags) VIR_CONNECT_BASELINE_CPU_MIGRATABLE) \ +suffix = (migratable); \ if (virAsprintf(label, %s%s, name, suffix) 0) {\ ret = -1; \ } else {\ @@ -612,6 +616,8 @@ mymain(void) DO_TEST_BASELINE(x86, 4, VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0); DO_TEST_BASELINE(x86, 5, 0, 0); DO_TEST_BASELINE(x86, 5, VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0); +DO_TEST_BASELINE(x86, 6, 0, 0); +DO_TEST_BASELINE(x86, 6, VIR_CONNECT_BASELINE_CPU_MIGRATABLE, 0); DO_TEST_BASELINE(ppc64, incompatible-vendors, 0, -1); DO_TEST_BASELINE(ppc64, no-vendor, 0, 0); diff --git a/tests/cputestdata/x86-baseline-6-migratable.xml b/tests/cputestdata/x86-baseline-6-migratable.xml new file mode 100644 index 000..3c2f38c --- /dev/null +++ b/tests/cputestdata/x86-baseline-6-migratable.xml @@ -0,0 +1,10 @@ +cpu mode='custom' match='exact' + model fallback='allow'SandyBridge/model + vendorIntel/vendor + feature policy='require' name='hypervisor'/ + feature policy='require' name='osxsave'/ +
[libvirt] [PATCH 5/5] Add --migratable support to virsh cpu-baseline
Wire up VIR_CONNECT_BASELINE_CPU_MIGRATABLE to this command line option. --- tools/virsh-domain.c | 6 ++ tools/virsh.pod | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bab44fe..2b4f06d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6860,6 +6860,10 @@ static const vshCmdOptDef opts_cpu_baseline[] = { .type = VSH_OT_BOOL, .help = N_(Show features that are part of the CPU model type) }, +{.name = migratable, + .type = VSH_OT_BOOL, + .help = N_(Do not include features that block migration) +}, {.name = NULL} }; @@ -6882,6 +6886,8 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, features)) flags |= VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES; +if (vshCommandOptBool(cmd, migratable)) +flags |= VIR_CONNECT_BASELINE_CPU_MIGRATABLE; if (vshCommandOptStringReq(ctl, cmd, file, from) 0) return false; diff --git a/tools/virsh.pod b/tools/virsh.pod index e367e04..3881614 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -573,7 +573,7 @@ Icellno modifier can be used to narrow the modification down to a single host NUMA cell. On the other end of spectrum lies I--all which executes the modification on all NUMA cells. -=item Bcpu-baseline IFILE [I--features] +=item Bcpu-baseline IFILE [I--features] [I--migratable] Compute baseline CPU which will be supported by all host CPUs given in file. The list of host CPUs is built by extracting all cpu elements from the @@ -582,7 +582,8 @@ by new lines or even a set of complete capabilities elements printed by Bcapabilities command. If I--features is specified then the resulting XML description will explicitly include all features that make up the CPU, without this option features that are part of the CPU model -will not be listed in the XML description. +will not be listed in the XML description. If I--migratable is specified, +features that block migration will not be included in the resulting CPU. =item Bcpu-compare IFILE [I--error] -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/10] conf: support backend domain name in disk and network devices
Marek Marczykowski-Górecki wrote: At least Xen supports backend drivers in another domain (aka driver domain). This patch introduces XML config option for such setting as 'domain' attribute of 'source' element. Verification its content is left for the driver. In the future same option will be needed for USB devices (hostdev objects), but for now libxl doesn't have support for PVUSB. Signed-off-by: Marek Marczykowski-Górecki marma...@invisiblethingslab.com --- Changes in v2: - describe in docs/formatdomain.html.in - enforce empty domain tag (only 'name' attribute allowed) Changes in v3: - change domain name='xx'/ element to domain='' attribute of source element - this is more logical place - grammar of docs docs/formatdomain.html.in | 29 +++-- docs/schemas/domaincommon.rng | 20 src/conf/domain_conf.c| 33 + src/conf/domain_conf.h| 1 + src/util/virstoragefile.c | 4 +++- src/util/virstoragefile.h | 1 + 6 files changed, 81 insertions(+), 7 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c5ad6f4..38c42d5 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1907,13 +1907,17 @@ span class=sincesince 0.0.3/span/dt dd The codefile/code attribute specifies the fully-qualified - path to the file holding the disk. + path to the file holding the disk. The optional + codedomain/code attribute allows specifying a backend domain Interesting approach. It almost feels like this is a different type of disk, e.g. disk type='brokered' :). There's a fair bit of experience on the list wrt extending the XML. Let's see if other have suggestions. Regards, Jim + (aka driver domain) where the file is stored. /dd dtcodetype='block'/code span class=sincesince 0.0.3/span/dt dd The codedev/code attribute specifies the path to the - host device to serve as the disk. + host device to serve as the disk. The optional + codedomain/code attribute allows specifying a backend domain + (aka driver domain) for the device. /dd dtcodetype='dir'/code span class=sincesince 0.7.5/span/dt @@ -4336,6 +4340,27 @@ qemu-kvm -net nic,model=? /dev/null element is unspecified is to have the link state codeup/code. span class=sinceSince 0.9.5/span /p +h5a name=elementDomainSetting up a network backend in a driver domain/a/h5 +pre + ... + lt;devicesgt; +... +lt;interface type='bridge'gt; + lt;source bridge='br0' bdomain='netvm'/b/gt; +lt;/interfacegt; +... + lt;/devicesgt; + .../pre + +p + The optional codedomain/code attribute allows specifying a backend + domain (aka driver domain) for the device. Use the codename/code attribute + to specify its name. You can use it to create a direct network link between + domains (so data will not go through host system). Use with type 'ethernet' + to create plain network link, or with 'bridge' to connect to some bridge + inside the driver domain. + span class=sinceSince 1.0.7 (Xen only)/span +/p h5a name=ipconfigIP configuration/a/h5 pre diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index d467dce..a4321f1 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1340,6 +1340,11 @@ attribute name=file ref name=absFilePath/ /attribute +optional + attribute name=domain +ref name=domainName/ + /attribute +/optional /optional optional ref name=storageStartupPolicy/ @@ -1365,6 +1370,11 @@ /attribute /optional optional +attribute name=domain + ref name=domainName/ +/attribute + /optional + optional ref name=storageStartupPolicy/ /optional optional @@ -2040,6 +2050,11 @@ attribute name=bridge ref name=deviceName/ /attribute +optional + attribute name=domain +ref name=domainName/ + /attribute +/optional empty/ /element /optional @@ -2059,6 +2074,11 @@ attribute name=dev ref name=deviceName/ /attribute +optional + attribute name=domain +ref name=domainName/
Re: [libvirt] [PATCH 04/10] libxl: fill HVM SDL and VNC settings based on graphics/ entries
Marek Marczykowski-Górecki wrote: Vfb entries in domain config are used only by PV drivers. Qemu parameters are build based on b_info struct. So fill it with the same data as vfb entries (actually the first one). This will additionally allow graphic-less domain, when no graphics/ entries are present in domain XML (previously VNC was always enabled). This should already be handled in libxlMakeVfbList(). Is there something missing in that function? Regards, Jim Signed-off-by: Marek Marczykowski-Górecki marma...@invisiblethingslab.com --- src/libxl/libxl_conf.c | 100 - 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 1811a83..c9f8ad5 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -618,12 +618,53 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf) _(unsupported chardev '%s'), type); return -1; } +return 0; +} + +static int +libxlMakeVNCInfo(virPortAllocatorPtr graphicsports, + virDomainGraphicsDefPtr l_vfb, + libxl_vnc_info *x_vnc) +{ +unsigned short port; +const char *listenAddr; + +libxl_defbool_set(x_vnc-enable, 1); +/* driver handles selection of free port */ +libxl_defbool_set(x_vnc-findunused, 0); +if (l_vfb-data.vnc.autoport) { + +if (virPortAllocatorAcquire(graphicsports, port) 0) +return -1; +l_vfb-data.vnc.port = port; +} +x_vnc-display = l_vfb-data.vnc.port - LIBXL_VNC_PORT_MIN; +listenAddr = virDomainGraphicsListenGetAddress(l_vfb, 0); +if (listenAddr) { +/* libxl_device_vfb_init() does VIR_STRDUP(127.0.0.1) */ +VIR_FREE(x_vnc-listen); +if (VIR_STRDUP(x_vnc-listen, listenAddr) 0) +return -1; +} +return 0; +} + +static int +libxlMakeSDLInfo(virDomainGraphicsDefPtr l_vfb, + libxl_sdl_info *x_sdl) +{ +libxl_defbool_set(x_sdl-enable, 1); +if (VIR_STRDUP(x_sdl-display, l_vfb-data.sdl.display) 0) +return -1; +if (VIR_STRDUP(x_sdl-xauthority, l_vfb-data.sdl.xauth) 0) +return -1; return 0; } static int libxlMakeDomBuildInfo(virDomainDefPtr def, + virPortAllocatorPtr graphicsports, libxl_ctx *ctx, libxl_domain_config *d_config) { @@ -745,6 +786,35 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, return -1; } +/* Disable VNC and SDL until explicitly enabled */ +libxl_defbool_set(b_info-u.hvm.vnc.enable, 0); +libxl_defbool_set(b_info-u.hvm.sdl.enable, 0); + +for (i = 0; i def-ngraphics; i++) { +switch (def-graphics[i]-type) { +case VIR_DOMAIN_GRAPHICS_TYPE_VNC: +if (libxl_defbool_val(b_info-u.hvm.vnc.enable)) +continue; +if (libxlMakeVNCInfo(graphicsports, +def-graphics[i], +b_info-u.hvm.vnc) 0) +return -1; +if (def-graphics[i]-data.vnc.keymap +VIR_STRDUP(b_info-u.hvm.keymap, + def-graphics[i]-data.vnc.keymap) 0) { +virReportOOMError(); +return -1; +} +break; +case VIR_DOMAIN_GRAPHICS_TYPE_SDL: +if (libxl_defbool_val(b_info-u.hvm.sdl.enable)) +continue; +if (libxlMakeSDLInfo(def-graphics[i], b_info-u.hvm.sdl) 0) +return -1; +break; +} +} + /* * The following comment and calculation were taken directly from * libxenlight's internal function libxl_get_required_shadow_memory(): @@ -1171,38 +1241,16 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports, virDomainGraphicsDefPtr l_vfb, libxl_device_vfb *x_vfb) { -unsigned short port; -const char *listenAddr; - libxl_device_vfb_init(x_vfb); switch (l_vfb-type) { case VIR_DOMAIN_GRAPHICS_TYPE_SDL: -libxl_defbool_set(x_vfb-sdl.enable, 1); -if (VIR_STRDUP(x_vfb-sdl.display, l_vfb-data.sdl.display) 0) -return -1; -if (VIR_STRDUP(x_vfb-sdl.xauthority, l_vfb-data.sdl.xauth) 0) +if (libxlMakeSDLInfo(l_vfb, x_vfb-sdl) 0) return -1; break; case VIR_DOMAIN_GRAPHICS_TYPE_VNC: -libxl_defbool_set(x_vfb-vnc.enable, 1); -/* driver handles selection of free port */ -libxl_defbool_set(x_vfb-vnc.findunused, 0); -
Re: [libvirt] [PATCH 05/10] libxl: pass ipaddr to libxl toolstack
Marek Marczykowski-Górecki wrote: Do not silently ignore its value. LibXL support only one address, so refuse multiple IPs. Signed-off-by: Marek Marczykowski-Górecki marma...@invisiblethingslab.com --- src/libxl/libxl_conf.c | 5 + src/libxl/libxl_domain.c | 11 +++ 2 files changed, 16 insertions(+) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index c9f8ad5..4730585 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1133,6 +1133,11 @@ libxlMakeNic(virDomainDefPtr def, case VIR_DOMAIN_NET_TYPE_ETHERNET: if (VIR_STRDUP(x_nic-script, l_nic-script) 0) return -1; +if (l_nic-nips 0) { +x_nic-ip = virSocketAddrFormat(l_nic-ips[0]-address); +if (!x_nic-ip) +return -1; +} IP address should be supported on VIR_DOMAIN_NET_TYPE_NETWORK interface types too. The domainXML docs even contain an example http://libvirt.org/formatdomain.html#ipconfig Regards, Jim break; case VIR_DOMAIN_NET_TYPE_NETWORK: { diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 856cfb4..afb0b15 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -482,6 +482,17 @@ 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_NET +(dev-data.net-type == VIR_DOMAIN_NET_TYPE_BRIDGE || + dev-data.net-type == VIR_DOMAIN_NET_TYPE_ETHERNET)) { +if (dev-data.net-nips 1) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, +_(multiple IP addresses not supported on device type %s), +virDomainNetTypeToString(dev-data.net-type)); +return -1; +} +} + if (dev-type == VIR_DOMAIN_DEVICE_HOSTDEV || (dev-type == VIR_DOMAIN_DEVICE_NET dev-data.net-type == VIR_DOMAIN_NET_TYPE_HOSTDEV)) { -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH 01/12] qemu: caps: Add capability bit for the pc-dimm device
On 01/30/2015 06:20 AM, Peter Krempa wrote: The pc-dimm device represents a RAM memory module. --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 + 3 files changed, 4 insertions(+) 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 01/10] libxl: update dom-id in libxlDomainCreateWithFlags
On Thu, Feb 05, 2015 at 02:25:41PM -0700, Jim Fehlig wrote: Marek Marczykowski-Górecki wrote: Otherwise domainCreateWithFlags via remote returns -1 as domid. Signed-off-by: Marek Marczykowski-Górecki marma...@invisiblethingslab.com --- src/libxl/libxl_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index c95b387..ce3a99b 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2375,6 +2375,9 @@ libxlDomainCreateWithFlags(virDomainPtr dom, } ret = libxlDomainStart(driver, vm, (flags VIR_DOMAIN_START_PAUSED) != 0, -1); +if (ret 0) +goto cleanup; +dom-id = vm-def-id; It looks at though this is the only callsite of libxlDomainStart that needs this change. Have you noticed this with other APIs that call libxlDomainStart? Not directly. But there is a problem if domain gets restarted by some other client - the first one will still use old domid. IIUC for now the only workaround is to listen to lifecycle events for every domain. -- Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? pgptUfG1NHIOi.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: don't allow multiple portgroups with the same name in a network
On 02/05/2015 12:29 PM, Laine Stump wrote: When defining and creating networks, we have been checking to make sure there is only a single default portgroup, but haven't verified that no two portgroups have the same name. We *do* check for multiple definitions when updating the portgroups in an existing network though. This patch adds a check to networkValidate(), which is called when a network is defined or created, to disallow duplicate names. It would actually make sense to do this in the network XML parser (since it's not really something that might make sense but isn't supported by this driver, but is instead something that should never be allowed), but doing that carries the danger of causing errors when rereading the config of existing networks when libvirtd is restarted after an upgrade, and that would result in networks disappearing from libvirt's list. (I'm thinking I should change the error to XML_ERROR instead of UNSUPPORTED, even though that's not the type of error that networkValidate is intended for) This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1115858 --- src/network/bridge_driver.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) +for (j = i+1; j def-nPortGroups; j++) { Wonder why our syntax-checker didn't flag the lack of spaces around '+'? 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] [PATCHv3] Trivially support DomainHasManagedSaveImage
On 02/05/2015 01:48 AM, Ján Tomko wrote: Return 0 instead of ERR_NO_SUPPORT in each driver where we don't support managed save or -1 if the domain does not exist. This avoids spamming daemon logs when 'virsh dominfo' is run. https://bugzilla.redhat.com/show_bug.cgi?id=1095637 --- ACK -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/5] Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE flag
On Thu, Feb 05, 2015 at 15:47:53 +0100, Ján Tomko wrote: This flag for virConnectBaselineCPU will allow filtering out CPU features that block migration from the result. https://bugzilla.redhat.com/show_bug.cgi?id=1171484 --- include/libvirt/libvirt-host.h | 1 + src/libvirt-host.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index f760a55..77058af 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -862,6 +862,7 @@ int virConnectGetCPUModelNames(virConnectPtr conn, */ typedef enum { VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES = (1 0), /* show all features */ +VIR_CONNECT_BASELINE_CPU_MIGRATABLE = (1 1), /* filter out non-migratable features */ } virConnectBaselineCPUFlags; ACK Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] 答复: Re: [PATCH 3/3] virsh: prevent removing a in-used bridge for iface-unbridge
Laine Stump la...@laine.org 2015-2-4 下午 17:12 On 02/03/2015 11:39 AM, Michal Privoznik wrote: On 02.02.2015 15:08, Lin Ma wrote: By checking transient interfaces, It obtains the live information of attached interfaces to see if the bridge is in use. Signed-off-by: Lin Ma --- tools/virsh-interface.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) Technically, this is a v2 to a previous patch (I mildly recall seeing something like this in the past). It looks to be the same patch, just with reference to a private bug report removed, and preceded with the check for net-destroy (since I had said in my response to the original patch that the behavior of iface-unbridge was made to be similar to net-destroy, and that my opinion was that either neither should be changed, or both). It seems like that we decided to keep the original net-destroy behaviour, Then let's keep iface-unbridge's too. diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 5f848b6..ff40be0 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -1040,11 +1040,11 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd) const char *br_name; char *if_type = NULL, *if_name = NULL; bool nostart = false; -char *br_xml = NULL; +char *br_xml = NULL, *br_xml_transient_if = NULL; xmlChar *if_xml = NULL; int if_xml_size; -xmlDocPtr xml_doc = NULL; -xmlXPathContextPtr ctxt = NULL; +xmlDocPtr xml_doc = NULL, xml_doc_transient_if = NULL; +xmlXPathContextPtr ctxt = NULL, ctxt_transient_if = NULL; xmlNodePtr top_node, if_node, cur; /* Get a handle to the original device */ @@ -1103,6 +1103,22 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd) goto cleanup; } +/* verify whether there is any transient interface attached to bridge. */ +if (!(br_xml_transient_if = virInterfaceGetXMLDesc(br_handle, 0))) +goto cleanup; + +if (!(xml_doc_transient_if = virXMLParseStringCtxt(br_xml_transient_if, + _((bridge interface definition)), + ctxt_transient_if))) { +vshError(ctl, _(Failed to parse configuration of %s), br_name); +goto cleanup; +} + +if (virXPathNode(./bridge/interface[2], ctxt_transient_if) != NULL) { +vshError(ctl, %s, _(The bridge is in use by transient interfaces)); +goto cleanup; +} + /* Change the type and name of the outer/master interface to * the type/name of the attached slave interface. */ @@ -1198,10 +1214,13 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd) virInterfaceFree(br_handle); VIR_FREE(if_xml); VIR_FREE(br_xml); +VIR_FREE(br_xml_transient_if); VIR_FREE(if_type); VIR_FREE(if_name); xmlXPathFreeContext(ctxt); +xmlXPathFreeContext(ctxt_transient_if); xmlFreeDoc(xml_doc); +xmlFreeDoc(xml_doc_transient_if); return ret; } ACK. I'll merge this tomorrow (unless somebody beats me). Please don't push it as is. I think the behavior of iface-unbridge should match whatever is done to net-destroy (if anything). If the change is made, it should be made to both at the same time, and this one should also have a --force option to allow overriding the extra check, as patch 2/3 does for net-destroy. As Daniel points out, destroy is The net-destroy already shows to user that it's a forceful operation, So we don't need a --force option, then iface-unbridge either. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 5/5] Add --migratable support to virsh cpu-baseline
On Thu, Feb 05, 2015 at 15:47:56 +0100, Ján Tomko wrote: Wire up VIR_CONNECT_BASELINE_CPU_MIGRATABLE to this command line option. --- tools/virsh-domain.c | 6 ++ tools/virsh.pod | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bab44fe..2b4f06d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6860,6 +6860,10 @@ static const vshCmdOptDef opts_cpu_baseline[] = { .type = VSH_OT_BOOL, .help = N_(Show features that are part of the CPU model type) }, +{.name = migratable, + .type = VSH_OT_BOOL, + .help = N_(Do not include features that block migration) +}, {.name = NULL} }; @@ -6882,6 +6886,8 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, features)) flags |= VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES; +if (vshCommandOptBool(cmd, migratable)) +flags |= VIR_CONNECT_BASELINE_CPU_MIGRATABLE; if (vshCommandOptStringReq(ctl, cmd, file, from) 0) return false; diff --git a/tools/virsh.pod b/tools/virsh.pod index e367e04..3881614 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -573,7 +573,7 @@ Icellno modifier can be used to narrow the modification down to a single host NUMA cell. On the other end of spectrum lies I--all which executes the modification on all NUMA cells. -=item Bcpu-baseline IFILE [I--features] +=item Bcpu-baseline IFILE [I--features] [I--migratable] Compute baseline CPU which will be supported by all host CPUs given in file. The list of host CPUs is built by extracting all cpu elements from the @@ -582,7 +582,8 @@ by new lines or even a set of complete capabilities elements printed by Bcapabilities command. If I--features is specified then the resulting XML description will explicitly include all features that make up the CPU, without this option features that are part of the CPU model -will not be listed in the XML description. +will not be listed in the XML description. If I--migratable is specified, +features that block migration will not be included in the resulting CPU. =item Bcpu-compare IFILE [I--error] I understand two spaces after a dot which ends a sentence, but three spaces seem to be more than enough :-) ACK Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix reporting of i/o errors by iohelper process
Hello Eric, it has been quite a while since we have looked at this :). I'm revisiting this problem and I find that it still exists. Here is an archive link of our previous discussions on this: https://www.redhat.com/archives/libvir-list/2014-July/thread.html#00809 Basically, when I do a migration and run out of disk space I do not see a meaningful error message without this patch. Early on in our previous discussions you asked me how I had gotten through the qemuDomainSaveMemory function without hitting this code: if (virFileWrapperFdClose(wrapperFd) 0) goto cleanup; If qemuMigrationToFile fails we go directly to cleanup and do not pass through the virFileWrapperFdClose call. For reference: /* Perform the migration */ if (qemuMigrationToFile(driver, vm, fd, offset, path, qemuCompressProgramName(compressed), bypassSecurityDriver, asyncJob) 0) goto cleanup; This is why my patch adds the additional call to virFileWrapperFdClose. Perhaps, if we cannot tolerate calling it twice, I can adjust the code such that we only call it once. For some odd reason, you seem to see messages that I do not (take look at my final message in the thread linked above). I was not able to see your goodbye world \n message. I would be interested to know what you see when you run my test case without my patch. If you feel like trying it just create a 50MB disk image and loop mount it: mount -o loop /usr/local/var/lib/libvirt/qemu/save.img /usr/local/var/lib/libvirt/qemu/save Then: virsh managedsave guestname And report what you saw on the command line and the libvirtd console and/or log depending on how you run the daemon. I suspect (since you saw goodbye world) that you would also see the out of disk space message ok. If I'm correct, then the question becomes... why don't I see it too? :) Thanks for your time. -- -- Jason J. Herne (jjhe...@linux.vnet.ibm.com) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Properly report error when cookin uuid not match the ctxt uuid
On 02/05/2015 03:14 PM, Ján Tomko wrote: On Thu, Feb 05, 2015 at 11:42:26AM +0800, Luyao Huang wrote: Add the missing jump to the error label when cookin uuid does not match the ctxt uuid. 'cookie uuid' and 'ctxt uuid' don't seem clear enough to me. I have reworded the commit message: Add the missing jump to the error label when the uuid in the migration cookie XML does not match the uuid of the migrated domain. Okay, thanks for rewording the message. Signed-off-by: Luyao Huang lhu...@redhat.com --- src/qemu/qemu_migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8a8fa63..879b1bf 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1147,6 +1147,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, virReportError(VIR_ERR_INTERNAL_ERROR, _(Incoming cookie data had unexpected UUID %s vs %s), tmp, uuidstr); +goto error; } VIR_FREE(tmp); ACK and pushed. Thanks. Jan Luyao -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv3] Trivially support DomainHasManagedSaveImage
Return 0 instead of ERR_NO_SUPPORT in each driver where we don't support managed save or -1 if the domain does not exist. This avoids spamming daemon logs when 'virsh dominfo' is run. https://bugzilla.redhat.com/show_bug.cgi?id=1095637 --- src/bhyve/bhyve_driver.c | 25 +- src/esx/esx_driver.c | 39 - src/lxc/lxc_driver.c | 26 +- src/openvz/openvz_driver.c | 28 ++- src/parallels/parallels_driver.c | 20 ++- src/phyp/phyp_driver.c | 29 +++- src/uml/uml_driver.c | 33 +- src/vbox/vbox_common.c | 73 +++- src/vmware/vmware_driver.c | 27 ++- src/xenapi/xenapi_driver.c | 27 ++- 10 files changed, 317 insertions(+), 10 deletions(-) v2: implement the function in all drivers, not just LXC v3: also check if the domain exists diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 56cc8ab..ae39917 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -2,7 +2,7 @@ * bhyve_driver.c: core driver methods for managing bhyve guests * * Copyright (C) 2014 Roman Bogorodskiy - * Copyright (C) 2014 Red Hat, Inc. + * Copyright (C) 2014-2015 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1430,6 +1430,28 @@ bhyveConnectDomainEventDeregisterAny(virConnectPtr conn, return 0; } +static int +bhyveDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) +{ +virDomainObjPtr vm = NULL; +int ret = -1; + +virCheckFlags(0, -1); + +if (!(vm = bhyveDomObjFromDomain(domain))) +goto cleanup; + +if (virDomainHasManagedSaveImageEnsureACL(domain-conn, vm-def) 0) +goto cleanup; + +ret = 0; + + cleanup: +if (vm) +virObjectUnlock(vm); +return ret; +} + static virHypervisorDriver bhyveHypervisorDriver = { .name = bhyve, .connectOpen = bhyveConnectOpen, /* 1.2.2 */ @@ -1476,6 +1498,7 @@ static virHypervisorDriver bhyveHypervisorDriver = { .connectCompareCPU = bhyveConnectCompareCPU, /* 1.2.4 */ .connectDomainEventRegisterAny = bhyveConnectDomainEventRegisterAny, /* 1.2.5 */ .connectDomainEventDeregisterAny = bhyveConnectDomainEventDeregisterAny, /* 1.2.5 */ +.domainHasManagedSaveImage = bhyveDomainHasManagedSaveImage, /* 1.2.13 */ }; diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 6b9965f..179f44c 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -1,7 +1,7 @@ /* * esx_driver.c: core driver functions for managing VMware ESX hosts * - * Copyright (C) 2010-2014 Red Hat, Inc. + * Copyright (C) 2010-2015 Red Hat, Inc. * Copyright (C) 2009-2014 Matthias Bolte matthias.bo...@googlemail.com * Copyright (C) 2009 Maximilian Wilhelm m...@rfc2324.org * @@ -5147,6 +5147,42 @@ esxConnectListAllDomains(virConnectPtr conn, } #undef MATCH +static int +esxDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) +{ +int result = -1; +esxPrivate *priv = domain-conn-privateData; +esxVI_ManagedObjectReference *managedObjectReference = NULL; +char uuid_string[VIR_UUID_STRING_BUFLEN] = ; + +virCheckFlags(0, -1); + +if (esxVI_EnsureSession(priv-primary) 0) +return -1; + +virUUIDFormat(domain-uuid, uuid_string); + +if (esxVI_FindByUuid(priv-primary, priv-primary-datacenter-_reference, + uuid_string, esxVI_Boolean_True, + esxVI_Boolean_Undefined, + managedObjectReference) 0) { +return -1; +} + +if (!managedObjectReference) { +virReportError(VIR_ERR_NO_DOMAIN, + _(Could not find domain with UUID '%s'), + uuid_string); +goto cleanup; +} + +result = 0; + + cleanup: +esxVI_ManagedObjectReference_Free(managedObjectReference); +return result; +} + static virHypervisorDriver esxHypervisorDriver = { .name = ESX, @@ -5226,6 +5262,7 @@ static virHypervisorDriver esxHypervisorDriver = { .domainSnapshotHasMetadata = esxDomainSnapshotHasMetadata, /* 0.9.13 */ .domainSnapshotDelete = esxDomainSnapshotDelete, /* 0.8.0 */ .connectIsAlive = esxConnectIsAlive, /* 0.9.8 */ +.domainHasManagedSaveImage = esxDomainHasManagedSaveImage, /* 1.2.13 */ }; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 487e2a2..3adb21d 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2014 Red Hat, Inc. + * Copyright (C) 2010-2015 Red Hat, Inc. * Copyright IBM Corp. 2008 * * lxc_driver.c: linux container driver functions @@ -5726,6 +5726,29 @@ lxcNodeAllocPages(virConnectPtr conn, } +static int +lxcDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) +{ +
Re: [libvirt] [PATCH 1/2] Only parse custom vhost path for virtio interfaces
On 02/05/2015 07:52 AM, Ján Tomko wrote: It is not used for other network interface models. A little light here... Something along the lines of only supporting backend vhost attribute for virtio adapters and quietly dropping it for any other definition... https://bugzilla.redhat.com/show_bug.cgi?id=1147195 --- src/conf/domain_conf.c | 6 +++- .../qemuxml2argv-tap-vhost-incorrect.xml | 39 ++ .../qemuxml2xmlout-tap-vhost-incorrect.xml | 38 + tests/qemuxml2xmltest.c| 1 + 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4251b13..da3764f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7369,6 +7369,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *vhostuser_path = NULL; char *vhostuser_type = NULL; char *trustGuestRxFilters = NULL; +char *vhost_path = NULL; virNWFilterHashTablePtr filterparams = NULL; virDomainActualNetDefPtr actual = NULL; xmlNodePtr oldnode = ctxt-node; @@ -7551,7 +7552,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(tmp); if ((tmp = virXMLPropString(cur, vhost))) -def-backend.vhost = virFileSanitizePath(tmp); +vhost_path = virFileSanitizePath(tmp); VIR_FREE(tmp); Coverity got grumpy here - it believes vhost can be found twice probably because there's other code (just above here) which fills in vhostuser_* values, but first checks (!vhostuser_* ...) To keep Coverity quiet, adding a !vhost_path prior to the tmp = does work. Why this doesn't get flagged for def-backend.tap nor the former code and some other allocations, I'm not quite sure. Another option is to not use vhost_path and just do the following after decoding def-model (prior to the if loop where you used vhost_path): if (def-backend.vhost STRNEQ_NULLABLE(def-model, virtio)) VIR_FREE(def-backend.vhost); ACK - regardless of which method you choose. John } } @@ -7992,6 +7993,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } def-driver.virtio.guest.ufo = val; } +def-backend.vhost = vhost_path; +vhost_path = NULL; } def-linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; @@ -8061,6 +8064,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(addrtype); VIR_FREE(trustGuestRxFilters); VIR_FREE(ips); +VIR_FREE(vhost_path); virNWFilterHashTableFree(filterparams); return def; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml b/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml new file mode 100644 index 000..2cf312f --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-tap-vhost-incorrect.xml @@ -0,0 +1,39 @@ +domain type='qemu' + nametest/name + uuidbba65c0e-c049-934f-b6aa-4e2c0582acdf/uuid + memory unit='KiB'1048576/memory + currentMemory unit='KiB'1048576/currentMemory + vcpu placement='static'1/vcpu + os +type arch='x86_64' machine='pc-0.13'hvm/type +boot dev='cdrom'/ +boot dev='hd'/ +bootmenu enable='yes'/ + /os + clock offset='utc'/ + on_poweroffdestroy/on_poweroff + on_rebootrestart/on_reboot + on_crashrestart/on_crash + devices +emulator/usr/bin/qemu/emulator +controller type='usb' index='0'/ +controller type='virtio-serial' index='0' + address type='pci' domain='0x' bus='0x00' slot='0x06' function='0x0'/ +/controller +controller type='ide' index='0'/ +controller type='pci' index='0' model='pci-root'/ +interface type='user' + mac address='52:54:00:e5:48:58'/ + model type='definitely-not-virtio'/ + driver name='vhost' queues='5'/ + backend tap='/dev/null' vhost='/dev/zero'/ +/interface +serial type='pty' + target port='0'/ +/serial +console type='pty' + target type='serial' port='0'/ +/console +memballoon model='virtio'/ + /devices +/domain diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml new file mode 100644 index 000..266cbf0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml @@ -0,0 +1,38 @@ +domain type='qemu' + nametest/name + uuidbba65c0e-c049-934f-b6aa-4e2c0582acdf/uuid + memory unit='KiB'1048576/memory + currentMemory unit='KiB'1048576/currentMemory + vcpu placement='static'1/vcpu + os +type arch='x86_64'
[libvirt] [PATCH] network: don't allow multiple portgroups with the same name in a network
When defining and creating networks, we have been checking to make sure there is only a single default portgroup, but haven't verified that no two portgroups have the same name. We *do* check for multiple definitions when updating the portgroups in an existing network though. This patch adds a check to networkValidate(), which is called when a network is defined or created, to disallow duplicate names. It would actually make sense to do this in the network XML parser (since it's not really something that might make sense but isn't supported by this driver, but is instead something that should never be allowed), but doing that carries the danger of causing errors when rereading the config of existing networks when libvirtd is restarted after an upgrade, and that would result in networks disappearing from libvirt's list. (I'm thinking I should change the error to XML_ERROR instead of UNSUPPORTED, even though that's not the type of error that networkValidate is intended for) This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1115858 --- src/network/bridge_driver.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index c56e8f2..d549ca5 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1,7 +1,7 @@ /* * bridge_driver.c: core driver methods for managing network * - * Copyright (C) 2006-2014 Red Hat, Inc. + * Copyright (C) 2006-2015 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -2728,7 +2728,7 @@ static int networkValidate(virNetworkDefPtr def, bool check_active) { -size_t i; +size_t i, j; bool vlanUsed, vlanAllowed, badVlanUse = false; virPortGroupDefPtr defaultPortGroup = NULL; virNetworkIpDefPtr ipdef; @@ -2874,7 +2874,15 @@ networkValidate(virNetworkDefPtr def, } defaultPortGroup = def-portGroups[i]; } - +for (j = i+1; j def-nPortGroups; j++) { +if (STREQ(def-portGroups[i].name, def-portGroups[j].name)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(multiple portgroup elements with the + same name (%s) in network '%s'), + def-portGroups[i].name, def-name); +return -1; +} +} if (def-portGroups[i].bandwidth !bandwidthAllowed) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _(Unsupported bandwidth element in network '%s' -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list