[libvirt] [PATCH] To provide more accurate help messages of iface/net/pool-define in virsh help and man virsh
--- tools/virsh-interface.c | 4 ++-- tools/virsh-network.c | 4 ++-- tools/virsh-pool.c | 4 ++-- tools/virsh.pod | 8 +--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index d4ec854..6b4fd5f 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -507,10 +507,10 @@ cmdInterfaceDumpXML(vshControl *ctl, const vshCmd *cmd) */ static const vshCmdInfo info_interface_define[] = { {.name = help, - .data = N_(define (but don't start) a physical host interface from an XML file) + .data = N_(define (but don't start) or update a physical host interface from an XML file) }, {.name = desc, - .data = N_(Define a physical host interface.) + .data = N_(Define a physical host interface or update an existing one.) }, {.name = NULL} }; diff --git a/tools/virsh-network.c b/tools/virsh-network.c index fc08b09..0db333c 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -189,10 +189,10 @@ cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd) */ static const vshCmdInfo info_network_define[] = { {.name = help, - .data = N_(define (but don't start) a network from an XML file) + .data = N_(define (but don't start) or update a network from an XML file) }, {.name = desc, - .data = N_(Define a network.) + .data = N_(Define a network or update an existing one.) }, {.name = NULL} }; diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 7c40b5b..b0acd89 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -342,10 +342,10 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd) */ static const vshCmdInfo info_pool_define[] = { {.name = help, - .data = N_(define (but don't start) a pool from an XML file) + .data = N_(define (but don't start) or update a pool from an XML file) }, {.name = desc, - .data = N_(Define a pool.) + .data = N_(Define a pool or update an existing one.) }, {.name = NULL} }; diff --git a/tools/virsh.pod b/tools/virsh.pod index 849ae31..8086885 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -2472,7 +2472,8 @@ to get a description of the XML network format used by libvirt. =item Bnet-define Ifile Define a persistent virtual network from an XML Ifile, the network is just -defined but not instantiated (started). +defined but not instantiated (started). If a persistent virtual network with +the same name and UUID already exists, it will be replaced with the new XML. =item Bnet-destroy Inetwork @@ -2631,7 +2632,7 @@ See also Biface-unbridge for undoing this operation. =item Biface-define Ifile Define a host interface from an XML Ifile, the interface is just defined but -not started. +not started. If a host interface with the same name already exists, it will be replaced with the new XML. =item Biface-destroy Iinterface @@ -2778,7 +2779,8 @@ Itype. =item Bpool-define Ifile -Create, but do not start, a pool object from the XML Ifile. +Create, but do not start, a pool object from the XML Ifile. If a pool object +with the same name and UUID already exists, it will be replaced with the new XML. =item Bpool-define-as Iname I--print-xml Itype [Isource-host] [Isource-path] [Isource-dev] [Isource-name] [target] -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: RNG: Always fill in default random source path for default backend
On 07/25/14 14:55, John Ferlan wrote: On 07/25/2014 04:03 AM, Peter Krempa wrote: Libvirt documents that the default entropy source for the 'random' backend of a RNG device is /dev/random. Instead of storing and propagating NULL across our code and checking it in multiple places fill the default in the post parse callback and use that in the other places. --- Sending the fix as promised in the multiple-rng series. src/conf/domain_audit.c| 10 ++ src/conf/domain_conf.c | 14 +- src/qemu/qemu_cgroup.c | 12 src/qemu/qemu_command.c| 5 ++--- .../qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args | 2 +- .../qemuxml2argvdata/qemuxml2argv-virtio-rng-multiple.args | 3 ++- 6 files changed, 20 insertions(+), 26 deletions(-) ACK John 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 2/2] qemu: sound: Handle all possible sound cards in switch statement
On 07/25/14 15:18, Ján Tomko wrote: On 07/25/2014 10:59 AM, Peter Krempa wrote: Use correct type in the switch and handle all sound card models in it so that the compliler tracks additions. *compiler @@ -4712,6 +4706,15 @@ qemuBuildSoundDevStr(virDomainDefPtr def, goto error; } break; +case VIR_DOMAIN_SOUND_MODEL_SB16: +model = sb16; +break; +case VIR_DOMAIN_SOUND_MODEL_PCSPK: /* pc-speaker is handled separately */ Did you mean to report an error for PC speaker too? The pc-speaker is formatted in the function above, so that statement should never be reached at this point. +case VIR_DOMAIN_SOUND_MODEL_LAST: +virReportError(VIR_ERR_INTERNAL_ERROR, + _(sound card model '%s' is not supported by qemu), + virDomainSoundModelTypeToString(sound-model)); Jan 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] qemu: error out if PCI passthrough type is not supported
If PCI passthrough type is not supported, we should error out rather than continue building the command line. When starting a domain, the type has been already checked by qemuPrepareHostdevPCICheckSupport() before building qemu command line, so the problem doesn't emerge. But when coverting a domain xml without specifying passthrough type explictly to qemu arg, we will get a malformed command line. the xml: hostdev mode='subsystem' type='pci' managed='yes' source address domain='0x0001' bus='0x03' slot='0x00' function='0x0'/ /source address type='pci' domain='0x' bus='0x00' slot='0x05' function='0x0'/ /hostdev the converted command line: -device ,host=0001:03:00.0,id=hostdev0,bus=pci.0,addr=0x5 After this patch, virsh gives an error message: virsh domxml-to-native qemu-argv /tmp/tmp.xml error: internal error: invalid PCI passthrough type 'default' Signed-off-by: Hu Tao hu...@cn.fujitsu.com --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7f9357c..12d6354 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4880,7 +4880,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def, virReportError(VIR_ERR_INTERNAL_ERROR, _(invalid PCI passthrough type '%s'), virDomainHostdevSubsysPCIBackendTypeToString(backend)); -break; +goto error; } virBufferAddLit(buf, ,host=); -- 1.8.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] about ceph+qcow2+qemu(snapshot) support issue ?
Hi , Could you pls help me ask one question , now we are testing a fuction , about Ceph+ qcow2+(qemu(snapshot) tec, now we are running this command print this error : virsh snapshot-create-as --domain win08q2 --name snapwin08q2 --description test ucsm+qcow2error: operation failed: Error -5 while writing VM so we want-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/2] qemu: usb-audio support and cleanup of sound card handling
On 07/25/14 14:49, John Ferlan wrote: On 07/25/2014 04:59 AM, Peter Krempa wrote: qemu supports the usb sound card for a while, add support to libvirt too Peter Krempa (2): conf: Add USB sound card support and implement it for qemu qemu: sound: Handle all possible sound cards in switch statement ACK series. I've pushed 2/2 of this series and 1/2 unfortunately needs adding of docs (and maybe renaming the model as we use usb-serial for the serial device and usb-net for the network device, thus this probably should be called usb-audio) 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 1/2] LXC: add support for --config in setmaxmem command
-Original Message- From: Michal Privoznik [mailto:mpriv...@redhat.com] Sent: Thursday, July 24, 2014 5:00 PM To: Chen, Hanxiao/陈 晗霄; libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 1/2] LXC: add support for --config in setmaxmem command On 16.07.2014 11:51, Chen Hanxiao wrote: In lxc, we could not use setmaxmem command with --config options. This patch will add support for this. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_driver.c | 69 ++-- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index b7b4b02..be6ee19 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -721,10 +721,10 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, virLXCDomainObjPrivatePtr priv; virLXCDriverPtr driver = dom-conn-privateData; virLXCDriverConfigPtr cfg = NULL; -unsigned long oldmax = 0; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | - VIR_DOMAIN_AFFECT_CONFIG, -1); + VIR_DOMAIN_AFFECT_CONFIG | + VIR_DOMAIN_MEM_MAXIMUM, -1); if (!(vm = lxcDomObjFromDomain(dom))) goto cleanup; @@ -743,32 +743,55 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, persistentDef) 0) goto cleanup; -if (flags VIR_DOMAIN_AFFECT_LIVE) -oldmax = vm-def-mem.max_balloon; -if (flags VIR_DOMAIN_AFFECT_CONFIG) { -if (!oldmax || oldmax persistentDef-mem.max_balloon) -oldmax = persistentDef-mem.max_balloon; -} +if (flags VIR_DOMAIN_MEM_MAXIMUM) { +if (flags VIR_DOMAIN_AFFECT_LIVE) { +if (newmem vm-def-mem.cur_balloon) { +virReportError(VIR_ERR_OPERATION_INVALID, %s, + _(Cannot resize the max memory less than current + memory for an active domain)); +goto cleanup; +} +vm-def-mem.max_balloon = newmem; Are things that easy? Don't we need to communicate this with the lxc_controler somehow? Even though you allow only extending, I think unless we are 100% sure guest will see the resize, we shouldn't allow this. I focused on '--config', so I kept what the original lxcDomainSetMaxMemory did. It looks that guest could not see the resize, and we shouldn't allow this. +} -if (newmem oldmax) { -virReportError(VIR_ERR_INVALID_ARG, - %s, _(Cannot set memory higher than max memory)); -goto cleanup; -} +if (flags VIR_DOMAIN_AFFECT_CONFIG) { +sa_assert(persistentDef); Is this assert needed? Did clang complain or is this just a pure lefover from copying from qemu_driver.c? +persistentDef-mem.max_balloon = newmem; +if (persistentDef-mem.cur_balloon newmem) +persistentDef-mem.cur_balloon = newmem; +if (virDomainSaveConfig(cfg-configDir, persistentDef) 0) +goto cleanup; +} +} else { +unsigned long oldmax = 0; -if (flags VIR_DOMAIN_AFFECT_LIVE) { -if (virCgroupSetMemory(priv-cgroup, newmem) 0) { -virReportError(VIR_ERR_OPERATION_FAILED, - %s, _(Failed to set memory for domain)); -goto cleanup; +if (flags VIR_DOMAIN_AFFECT_LIVE) +oldmax = vm-def-mem.max_balloon; +if (flags VIR_DOMAIN_AFFECT_CONFIG) { +if (!oldmax || oldmax persistentDef-mem.max_balloon) +oldmax = persistentDef-mem.max_balloon; } -} -if (flags VIR_DOMAIN_AFFECT_CONFIG) { -sa_assert(persistentDef); Well, since it has been here already, I think we can leave it in your patch too. -persistentDef-mem.cur_balloon = newmem; -if (virDomainSaveConfig(cfg-configDir, persistentDef) 0) +if (newmem oldmax) { +virReportError(VIR_ERR_INVALID_ARG, + %s, _(Cannot set memory higher than max memory)); goto cleanup; +} + +if (flags VIR_DOMAIN_AFFECT_LIVE) { +if (virCgroupSetMemory(priv-cgroup, newmem) 0) { +virReportError(VIR_ERR_OPERATION_FAILED, + %s, _(Failed to set memory for domain)); +goto cleanup; +} +} + +if (flags VIR_DOMAIN_AFFECT_CONFIG) { +sa_assert(persistentDef); +persistentDef-mem.cur_balloon = newmem; +if (virDomainSaveConfig(cfg-configDir, persistentDef) 0) +goto cleanup; +} }
Re: [libvirt] [PATCH 2/2] LXC: use lxcDomainSetMemoryFlags to do lxcDomainSetMaxMemory's work
-Original Message- From: Michal Privoznik [mailto:mpriv...@redhat.com] Sent: Thursday, July 24, 2014 5:00 PM To: Chen, Hanxiao/陈 晗霄; libvir-list@redhat.com Subject: Re: [libvirt] [PATCH 2/2] LXC: use lxcDomainSetMemoryFlags to do lxcDomainSetMaxMemory's work On 16.07.2014 11:51, Chen Hanxiao wrote: Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_driver.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index be6ee19..9f974eb 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -680,37 +680,6 @@ lxcDomainGetMaxMemory(virDomainPtr dom) return ret; } -static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) -{ -virDomainObjPtr vm; -int ret = -1; - -if (!(vm = lxcDomObjFromDomain(dom))) -goto cleanup; - -if (virDomainSetMaxMemoryEnsureACL(dom-conn, vm-def) 0) -goto cleanup; - -if (newmax vm-def-mem.cur_balloon) { -if (!virDomainObjIsActive(vm)) { -vm-def-mem.cur_balloon = newmax; -} else { -virReportError(VIR_ERR_OPERATION_INVALID, %s, - _(Cannot set max memory lower than current - memory for an active domain)); -goto cleanup; -} -} - -vm-def-mem.max_balloon = newmax; -ret = 0; - - cleanup: -if (vm) -virObjectUnlock(vm); -return ret; -} - A-ha! This is what I was looking for in 1/2. Okay, but I'd rather note this fact in 1/2 commit message to make it more obvious. Will update commit message in v2. static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, unsigned int flags) { @@ -809,6 +778,11 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) return lxcDomainSetMemoryFlags(dom, newmem, VIR_DOMAIN_AFFECT_LIVE); } +static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long memory) +{ +return lxcDomainSetMemoryFlags(dom, memory, VIR_DOMAIN_MEM_MAXIMUM); +} + So previously, calling virDomainSetMaxMemory() on an inactive LXC domain would succeed. Now, after the change, due to problem with _CURRENT, _LIVE and _CONFIG this will basically return success, but without any effect on the domain config. And that's wrong. Current lxcDomainSetMaxMemory did: inactive: affect domain config active: success but no change So we should fix that and will do in v2. Thanks, - Chen static int lxcDomainSetMemoryParameters(virDomainPtr dom, virTypedParameterPtr params, Moreover, I think these two patches can be joined into one. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: sound: Fix uninitialized model string
Commit e5f36698e3efc3d258b2996c7423c47e05ec52b2 introduces a false-positive build failure in the sound card model handling switch. Initialize the model to NULL although the value should never be used. --- Notes: Pushed under the build-breaker and trivial rules. src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index cb3c584..beb8ca8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4674,7 +4674,7 @@ qemuBuildSoundDevStr(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; -const char *model; +const char *model = NULL; /* Hack for devices with different names in QEMU and libvirt */ switch ((virDomainSoundModel) sound-model) { -- 2.0.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] qemu: add vhost-scsi-pci definitions
On Fri, Jul 25, 2014 at 02:58:58PM -0700, Nicholas A. Bellinger wrote: A vhost-scsi controller instance doesn't require the extra virtio-scsi disk args, at least not in order to boot QEMU proper. The configuration of vhost-scsi WWPNs and their associated LUNs is done using a configfs based control plane provided by the in-kernel target, for which all in-kernel drivers share common code within drivers/target/target_core_fabric_configfs.c. Configfs provides reference counting for data structures within vhost-scsi itself, and also inter-module reference counting between LIO backend devices under /sys/kernel/config/target/core/$HBA/$DEV/, and vhost-scsi LUN export. The virtio-scsi LLD Host:Channel:Target:LUN disk locations in the guest are based upon what is populated using configfs groups + symlinks under /sys/kernel/config/target/vhost/$WWPN/$TPGT/lun/$LUN. The rtslib library + targetcli shell are the preferred (and friendliest) way for driving the creation of vhost-scsi controllers + LUN exports. Hmm, now I see why vhost-scsi is so crippled in terms of features compared to virtio-scsi. Almost everything about it is completely opaque to QEMU. Portraying it as equivalent to virtio-scsi, only faster, is really rather misleading / confusing :-( Since QEMU doesn't get to configure the attached LUNs we loose any ability to do block I/O measurement or throttling, all the drive-mirror block job functionality, LUN hotplug/unplug, control of what happens on LUN read or write errors, disk image formats and more besides. I don't see any viable way to address any of that via QEMU even if we wanted to fix it. If it is also opaque to libvirt, then it makes it impossible to actually use this feature via the libvirt API unless you also have a side-channel giving you root access to the host to configure configfs :-( W can also no longer apply disk locking / lease aquisition per LUN to prevent the same disk image being used by two VMs at the same time, and loose the SELinux/sVirt isolation of guest from disks. It would be possible to partially address much of this by making libvirt itself responsible for all of the configuration HBA in configfs, but that is a major amount of work to undertake. I also wonder if QEMU is placed in a cgroup with the blkio controller attached, will I/O to vhost-scsi be correctly attributed and controlled by the blkio controller. As long as everything about the LUN configuration is completely opaque to libvirt QEMU, I don't think that representing vhost-scsi as a controller really makes any sense. The controller stuff in libvirt only exists in the first place in order to have somewhere to hang the disk configs off. Using controller would only make sense if the patch were to properly support the corresponding disk attachments and take full ownership of configuring things via configfs. I'm not sure that is worth the effort or ongoing maintainence cost though given that we're expecting virtio-scsi to be able to match vhost-scsi for performance, so there won't be much compelling reason to sacrifice so many QEMU features and use vhost-scsi. As proposed, this patch is really doing something more akin to SCSI HBA passthrough from host to guest, which would be something that's more appropriate for the hostdev configuration data. That's making it clear that the device is completely opaque to libvirt/QEMU from a functional configuration POV. We currently have a hostdev 'scsi' feature, but that is about passthrough of individual LUNs, so we'd have to invent new configuration schema for 'scsi_host' hostdev type. This seems like the most viable approach to supporting this feature right now. 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] support vhost-scsi controller
On 13:18 Sat 19 Jul , Zhang Min wrote: libvirt support vhost-scsi controller. The way to config the vhost-scsi controller is edit the xml file, Format is as follows: controller type='scsi' index='0' model='vhost-scsi' source wwpn='naa.6001405f5e3acbba' event_idx='on'/ /controller the tag of wwpn is necessary, the 'model' must be 'vhost-scsi' 'event_idx' is optional. Signed-off-by: Zhang Min rudy.zhang...@huawei.com This patch will not work without passing a pre-opened file descriptor to vhost-scsi, so that the child qemu process can interact with the vhost-scsi character device. Please take a look at the following patch for further progress on this: https://www.redhat.com/archives/libvir-list/2014-July/msg01235.html -- Mike Perez -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] support vhost-scsi controller
On Sat, Jul 19, 2014 at 01:18:55PM +0800, Zhang Min wrote: libvirt support vhost-scsi controller. The way to config the vhost-scsi controller is edit the xml file, Format is as follows: controller type='scsi' index='0' model='vhost-scsi' source wwpn='naa.6001405f5e3acbba' event_idx='on'/ /controller the tag of wwpn is necessary, the 'model' must be 'vhost-scsi' 'event_idx' is optional. Signed-off-by: Zhang Min rudy.zhang...@huawei.com This design to XML modelling is flawed for the reasons I describe here, so NACK to this https://www.redhat.com/archives/libvir-list/2014-July/msg01390.html 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
[libvirt] [PATCHv2] conf: Add USB sound card support and implement it for qemu
--- Notes: Version 2: - added docs docs/formatdomain.html.in | 5 +++-- src/conf/domain_conf.c| 3 ++- src/conf/domain_conf.h| 1 + src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 14 -- tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 + tests/qemuhelptest.c | 9 ++--- 13 files changed, 33 insertions(+), 8 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8950959..d1cca19 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4959,9 +4959,10 @@ qemu-kvm -net nic,model=? /dev/null The codesound/code element has one mandatory attribute, codemodel/code, which specifies what real sound device is emulated. Valid values are specific to the underlying hypervisor, though typical -choices are 'es1370', 'sb16', 'ac97', and 'ich6' +choices are 'es1370', 'sb16', 'ac97', 'ich6' and 'usb'. (span class=since - 'ac97' only since 0.6.0, 'ich6' only since 0.8.8/span) + 'ac97' only since 0.6.0, 'ich6' only since 0.8.8, + 'usb' only since 1.2.7/span) /dd /dl diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 910f6e2..814b305 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -458,7 +458,8 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST, pcspk, ac97, ich6, - ich9) + ich9, + usb) VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST, virtio, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b988b17..3ddeede 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1166,6 +1166,7 @@ typedef enum { VIR_DOMAIN_SOUND_MODEL_AC97, VIR_DOMAIN_SOUND_MODEL_ICH6, VIR_DOMAIN_SOUND_MODEL_ICH9, +VIR_DOMAIN_SOUND_MODEL_USB, VIR_DOMAIN_SOUND_MODEL_LAST } virDomainSoundModel; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 07306e5..eb2bbfd 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -263,6 +263,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, memory-backend-ram, /* 170 */ numa, + usb-audio, ); @@ -1481,6 +1482,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { pvpanic, QEMU_CAPS_DEVICE_PANIC }, { usb-kbd, QEMU_CAPS_DEVICE_USB_KBD }, { memory-backend-ram, QEMU_CAPS_OBJECT_MEMORY_RAM }, +{ usb-audio, QEMU_CAPS_OBJECT_USB_AUDIO }, }; static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 4332633..ac65ef3 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -211,6 +211,7 @@ typedef enum { QEMU_CAPS_CHANGE_BACKING_FILE = 169, /* change name of backing file in metadata */ QEMU_CAPS_OBJECT_MEMORY_RAM = 170, /* -object memory-backend-ram */ QEMU_CAPS_NUMA = 171, /* newer -numa handling with disjoint cpu ranges */ +QEMU_CAPS_OBJECT_USB_AUDIO = 172, /* usb-audio device support */ QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index beb8ca8..0ed6a57 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2090,9 +2090,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, for (i = 0; i def-nsounds; i++) { if (def-sounds[i]-info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) continue; -/* Skip ISA sound card, and PCSPK */ +/* Skip ISA sound card, PCSPK and usb-audio */ if (def-sounds[i]-model == VIR_DOMAIN_SOUND_MODEL_SB16 || -def-sounds[i]-model == VIR_DOMAIN_SOUND_MODEL_PCSPK) +def-sounds[i]-model == VIR_DOMAIN_SOUND_MODEL_PCSPK || +def-sounds[i]-model == VIR_DOMAIN_SOUND_MODEL_USB) continue; if (virDomainPCIAddressReserveNextSlot(addrs, def-sounds[i]-info, @@ -4687,6 +4688,15 @@ qemuBuildSoundDevStr(virDomainDefPtr def, case VIR_DOMAIN_SOUND_MODEL_ICH6: model = intel-hda; break; +case VIR_DOMAIN_SOUND_MODEL_USB: +model = usb-audio; +if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_USB_AUDIO)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(usb-audio controller
Re: [libvirt] [RFC] require for suggestions on support for ivshmem device
Hi all, On 07/21/2014 04:38 AM, Wang Rui wrote: On 2014/7/17 17:37, Martin Kletzander wrote: On Tue, May 20, 2014 at 11:17:32AM +0200, Martin Kletzander wrote: On Wed, May 14, 2014 at 08:23:21AM +, Wangrui (K) wrote: Hi, Libvirt does not support ivshmem(Inter-VM Shared Memory) device recently, thus, I would like to know if there's any plan to support it in the future? If not, I would like to contribute a serial of patches to do so. I came back to this mail right now because I need to have this implemented. Is there any progress on your side with this or should I try hitting this? I am working right now on supporting ivshmem in libvirt. Please, see my github: https://github.com/6WIND/libvirt/commits/rfc_ivshmem_support I will try to send RFC patches on the mailing list in the next days. Maxime -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] storage: Refresh storage pool after upload
https://bugzilla.redhat.com/show_bug.cgi?id=1072653 Upon successful upload of a volume, the target volume and storage pool were not updated to reflect any changes as a result of the upload. Make use of the existing stream close callback mechanism to force a backend pool refresh to occur once the stream closes. Signed-off-by: John Ferlan jfer...@redhat.com --- src/libvirt.c| 8 + src/libvirt_private.syms | 1 + src/storage/storage_driver.c | 78 tools/virsh.pod | 3 ++ 4 files changed, 90 insertions(+) diff --git a/src/libvirt.c b/src/libvirt.c index 143d319..992e4f2 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -13960,6 +13960,14 @@ virStorageVolDownload(virStorageVolPtr vol, * detect any errors. The results will be unpredictable if * another active stream is writing to the storage volume. * + * When the data stream is closed whether the upload is successful + * or not the target storage pool will be refreshed to reflect pool + * and volume changes as a result of the upload. Depending on + * the target volume storage backend and the source stream type + * for a successful upload, the target volume may take on the + * characteristics from the source stream such as format type, + * capacity, and allocation. + * * Returns 0, or -1 upon error. */ int diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b1fb7c9..7ef68a1 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -825,6 +825,7 @@ virFDStreamCreateFile; virFDStreamOpen; virFDStreamOpenFile; virFDStreamOpenPTY; +virFDStreamSetInternalCloseCb; # libvirt_internal.h diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index efbe5ff..5fd5514 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -59,6 +59,12 @@ static virStorageDriverStatePtr driverState; static int storageStateCleanup(void); +typedef struct _virStorageVolStreamInfo virStorageVolStreamInfo; +typedef virStorageVolStreamInfo *virStorageVolStreamInfoPtr; +struct _virStorageVolStreamInfo { +char *pool_name; +}; + static void storageDriverLock(virStorageDriverStatePtr driver) { virMutexLock(driver-lock); @@ -1956,6 +1962,52 @@ storageVolDownload(virStorageVolPtr obj, } +/** + * Frees opaque data provided for the stream closing callback + * + * @opaque Data to be freed. + */ +static void virStorageVolFDStreamCloseCbFree(void *opaque) +{ +virStorageVolStreamInfoPtr cbdata = opaque; + +VIR_FREE(cbdata-pool_name); +VIR_FREE(cbdata); +} + +/** + * Callback being called if a FDstream is closed. Frees device entries + * from data structures and removes lockfiles. + * + * @st Pointer to stream being closed. + * @opaque Domain's device information structure. + */ +static void virStorageVolFDStreamCloseCb(virStreamPtr st ATTRIBUTE_UNUSED, + void *opaque) +{ + +virStorageVolStreamInfoPtr cbdata = opaque; +virStoragePoolObjPtr pool = NULL; +virStorageBackendPtr backend; + +storageDriverLock(driverState); +if (!(pool = virStoragePoolObjFindByName(driverState-pools, + cbdata-pool_name))) +goto cleanup; + +if (!(backend = virStorageBackendForType(pool-def-type))) +goto cleanup; + +virStoragePoolObjClearVols(pool); +if (backend-refreshPool(NULL, pool) 0) +VIR_DEBUG(Failed to refresh storage pool); + + cleanup: +if (pool) +virStoragePoolObjUnlock(pool); +storageDriverUnlock(driverState); +} + static int storageVolUpload(virStorageVolPtr obj, virStreamPtr stream, @@ -1966,6 +2018,7 @@ storageVolUpload(virStorageVolPtr obj, virStorageBackendPtr backend; virStoragePoolObjPtr pool = NULL; virStorageVolDefPtr vol = NULL; +virStorageVolStreamInfoPtr cbdata = NULL; int ret = -1; virCheckFlags(0, -1); @@ -1996,11 +2049,36 @@ storageVolUpload(virStorageVolPtr obj, goto cleanup; } +/* If we have a refreshPool, use the callback routine in order to + * refresh the pool after the volume upload stream closes. This way + * we make sure the volume and pool data are refreshed without user + * interaction and we can just lookup the backend in the callback + * routine in order to call the refresh API. + */ +if (backend-refreshPool) { +if (VIR_ALLOC(cbdata) 0 || +VIR_STRDUP(cbdata-pool_name, pool-def-name) 0) +goto cleanup; +} + ret = backend-uploadVol(obj-conn, pool, vol, stream, offset, length, flags); +/* Add cleanup callback - call after uploadVol since the stream + * is then fully set up + */ +if (cbdata) { +virFDStreamSetInternalCloseCb(stream, + virStorageVolFDStreamCloseCb, + cbdata,
[libvirt] [PATCH 1/2] virsh: check if domiftune parameters fit into UINT
We parse the bandwidth rates as unsinged long long, then try to fit them in VIR_TYPED_PARAM_UINT. Report an error if they exceed UINT_MAX instead of quietly using wrong values. https://bugzilla.redhat.com/show_bug.cgi?id=1043735 --- tools/virsh-domain.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ad68aab..f7193cb 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2686,6 +2686,14 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _(inbound format is incorrect)); goto cleanup; } +/* we parse the rate as unsigned long long, but the API + * only accepts UINT */ +if (inbound.average UINT_MAX || inbound.peak UINT_MAX || +inbound.burst UINT_MAX) { +vshError(ctl, _(inbound rate larger than maximum %u), + UINT_MAX); +goto cleanup; +} if (inbound.average == 0 (inbound.burst || inbound.peak)) { vshError(ctl, _(inbound average is mandatory)); goto cleanup; @@ -2714,6 +2722,12 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _(outbound format is incorrect)); goto cleanup; } +if (outbound.average UINT_MAX || outbound.peak UINT_MAX || +outbound.burst UINT_MAX) { +vshError(ctl, _(outbound rate larger than maximum %u), + UINT_MAX); +goto cleanup; +} if (outbound.average == 0 (outbound.burst || outbound.peak)) { vshError(ctl, _(outbound average is mandatory)); goto cleanup; -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] Don't overwrite errors from virNetDevBandwidthSet
Otherwise this beautiful error would be overwritten when the function is called with a really high rate number: 2014-07-28 12:51:47.920+: 2304: error : virCommandWait:2399 : internal error: Child process (/sbin/tc class add dev vnet0 parent 1: classid 1:1 htb rate 4294968kbps) unexpected exit status 1: Illegal rate Usage: ... qdisc add ... htb [default N] [r2q N] default minor id of class to which unclassified packets are sent {0} r2q DRR quantums are computed as rate in Bps/r2q {10} debugstring of 16 numbers each 0-3 {0} ... class add ... htb rate R1 [burst B1] [mpu B] [overhead O] [prio P] [slot S] [pslot PS] [ceil R2] [cburst B2] [mtu MTU] [quantum Q] rate rate allocated to this class (class can still borrow) burstmax bytes burst which can be accumulated during idle period {computed} mpu minimum packet size used in rate computations overhead per-packet size overhead used in rate computations linklay adapting to a linklayer e.g. atm ceil definite upper class rate (no borrows) {rate} cburst burst but for ceil {computed} mtu max packet size we create rate map for {1600} prio priority of leaf; lowe https://bugzilla.redhat.com/show_bug.cgi?id=1043735 --- src/lxc/lxc_process.c | 6 +- src/network/bridge_driver.c | 6 +- src/qemu/qemu_command.c | 6 +- src/qemu/qemu_driver.c | 6 +- src/qemu/qemu_hotplug.c | 6 +- src/util/virnetdevmacvlan.c | 3 --- 6 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 4912035..3353dc1 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -276,12 +276,8 @@ char *virLXCProcessSetupInterfaceBridged(virConnectPtr conn, if (virNetDevBandwidthSet(net-ifname, virDomainNetGetActualBandwidth(net), - false) 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _(cannot set bandwidth limits on %s), - net-ifname); + false) 0) goto cleanup; -} if (net-filter virDomainConfNWFilterInstantiate(conn, vm-uuid, net) 0) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 6ccc6e2..4a53f8a 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2080,12 +2080,8 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, } if (virNetDevBandwidthSet(network-def-bridge, - network-def-bandwidth, true) 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _(cannot set bandwidth limits on %s), - network-def-bridge); + network-def-bandwidth, true) 0) goto err5; -} VIR_FREE(macTapIfName); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index beb8ca8..fb8b75f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -382,12 +382,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, if (virNetDevBandwidthSet(net-ifname, virDomainNetGetActualBandwidth(net), - false) 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _(cannot set bandwidth limits on %s), - net-ifname); + false) 0) goto cleanup; -} if (net-filter net-ifname virDomainConfNWFilterInstantiate(conn, def-uuid, net) 0) { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 704ba39..199858e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9966,12 +9966,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, sizeof(*newBandwidth-out)); } -if (virNetDevBandwidthSet(net-ifname, newBandwidth, false) 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _(cannot set bandwidth limits on %s), - device); +if (virNetDevBandwidthSet(net-ifname, newBandwidth, false) 0) goto cleanup; -} virNetDevBandwidthFree(net-bandwidth); if (newBandwidth-in || newBandwidth-out) { diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 729744c..004b6a4 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2181,12 +2181,8 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, if (needBandwidthSet) { if (virNetDevBandwidthSet(newdev-ifname, virDomainNetGetActualBandwidth(newdev), - false) 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _(cannot set bandwidth limits on %s), - newdev-ifname); + false) 0) goto cleanup; -
[libvirt] [PATCH 0/2] Fix domiftune bandwidth bounds checking
For https://bugzilla.redhat.com/show_bug.cgi?id=1043735 Ján Tomko (2): virsh: check if domiftune parameters fit into UINT Don't overwrite errors from virNetDevBandwidthSet src/lxc/lxc_process.c | 6 +- src/network/bridge_driver.c | 6 +- src/qemu/qemu_command.c | 6 +- src/qemu/qemu_driver.c | 6 +- src/qemu/qemu_hotplug.c | 6 +- src/util/virnetdevmacvlan.c | 3 --- tools/virsh-domain.c| 14 ++ 7 files changed, 19 insertions(+), 28 deletions(-) -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] LXC broken on Linux = 3.15
Hi! Kernel commit 23adbe12 (fs,userns: Change inode_capable to capable_wrt_inode_uidgid) uncovered a libvirt-lxc issue. Starting with that commit the kernel correctly checks also the gid of an inode. Sadly this change breaks libvirt-lxc in a way such that openpty() will always fail with -EPERM within a container. Therefore ssh and other programs are no longer usable. Libvirt's virLXCControllerSetupDevPTS() has a hardcoded mount string for mounting devpts, namely newinstance,ptmxmode=0666,mode=0620,gid=5, devpts correctly translates the uid and gid while mounting but libvirt mounts devpts _before_ setting up the uid/gid mappings. Therefore the internal gid for the new devpts instance is still 5 instead the mapped gid and the new check in the kernel will always fail. We have two options to fix that: a) virLXCControllerSetupDevPTS() translates the gid (5) by hand and passes the correct value to devpts. (IMHO hacky) b) We setup devpts and therefore also the consoles after installing the mappings. This needs maybe a bit of work. First I thought a trivial patch like the appended one will do it, but then libvirt fails to start a guest with no further explanation. Maybe I've later the time to investigate further. What do you think? Thanks, //richard diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 2d220eb..3435f42 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -2157,9 +2157,6 @@ virLXCControllerRun(virLXCControllerPtr ctrl) if (virLXCControllerSetupResourceLimits(ctrl) 0) goto cleanup; -if (virLXCControllerSetupDevPTS(ctrl) 0) -goto cleanup; - if (virLXCControllerPopulateDevices(ctrl) 0) goto cleanup; @@ -2172,9 +2169,6 @@ virLXCControllerRun(virLXCControllerPtr ctrl) if (virLXCControllerSetupFuse(ctrl) 0) goto cleanup; -if (virLXCControllerSetupConsoles(ctrl, containerTTYPaths) 0) -goto cleanup; - if (lxcSetPersonality(ctrl-def) 0) goto cleanup; @@ -2198,6 +2192,12 @@ virLXCControllerRun(virLXCControllerPtr ctrl) if (virLXCControllerSetupUserns(ctrl) 0) goto cleanup; +if (virLXCControllerSetupDevPTS(ctrl) 0) +goto cleanup; + +if (virLXCControllerSetupConsoles(ctrl, containerTTYPaths) 0) +goto cleanup; + if (virLXCControllerMoveInterfaces(ctrl) 0) goto cleanup; signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] LXC broken on Linux = 3.15
On Mon, Jul 28, 2014 at 04:25:56PM +0200, Richard Weinberger wrote: Hi! Kernel commit 23adbe12 (fs,userns: Change inode_capable to capable_wrt_inode_uidgid) uncovered a libvirt-lxc issue. Starting with that commit the kernel correctly checks also the gid of an inode. Sadly this change breaks libvirt-lxc in a way such that openpty() will always fail with -EPERM within a container. Therefore ssh and other programs are no longer usable. Libvirt's virLXCControllerSetupDevPTS() has a hardcoded mount string for mounting devpts, namely newinstance,ptmxmode=0666,mode=0620,gid=5, devpts correctly translates the uid and gid while mounting but libvirt mounts devpts _before_ setting up the uid/gid mappings. Therefore the internal gid for the new devpts instance is still 5 instead the mapped gid and the new check in the kernel will always fail. We have two options to fix that: a) virLXCControllerSetupDevPTS() translates the gid (5) by hand and passes the correct value to devpts. (IMHO hacky) You mean that instead of passing the value '5', if the guest GIDs had been remapped to start at 1000, we would pass in '1005' to mount ? I don't think that's hacky - it seems like a perfectly sensible fix to do. 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] LXC broken on Linux = 3.15
Am 28.07.2014 16:37, schrieb Daniel P. Berrange: On Mon, Jul 28, 2014 at 04:25:56PM +0200, Richard Weinberger wrote: Hi! Kernel commit 23adbe12 (fs,userns: Change inode_capable to capable_wrt_inode_uidgid) uncovered a libvirt-lxc issue. Starting with that commit the kernel correctly checks also the gid of an inode. Sadly this change breaks libvirt-lxc in a way such that openpty() will always fail with -EPERM within a container. Therefore ssh and other programs are no longer usable. Libvirt's virLXCControllerSetupDevPTS() has a hardcoded mount string for mounting devpts, namely newinstance,ptmxmode=0666,mode=0620,gid=5, devpts correctly translates the uid and gid while mounting but libvirt mounts devpts _before_ setting up the uid/gid mappings. Therefore the internal gid for the new devpts instance is still 5 instead the mapped gid and the new check in the kernel will always fail. We have two options to fix that: a) virLXCControllerSetupDevPTS() translates the gid (5) by hand and passes the correct value to devpts. (IMHO hacky) You mean that instead of passing the value '5', if the guest GIDs had been remapped to start at 1000, we would pass in '1005' to mount ? I don't think that's hacky - it seems like a perfectly sensible fix to do. Correct. If you're fine with that I'll happily submit a patch. Thanks, //richard -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH for 1.2.7] storage: create: Create files with correct mode
Use correct mode when pre-creating files (for snapshots). The refactor changing to storage driver usage caused a regression as some systems created the file with 000 permissions forbidding qemu to write the file. Pass mode to the creating functions to avoid the problem. Regression since 185e07a5f82bc0692324f3ee13b4816d71b653c1. --- src/storage/storage_backend_fs.c | 6 +- src/storage/storage_backend_gluster.c | 7 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 378c553..b8f907a 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1390,8 +1390,12 @@ static int virStorageFileBackendFileCreate(virStorageSourcePtr src) { int fd = -1; +mode_t mode = S_IRUSR; -if ((fd = virFileOpenAs(src-path, O_WRONLY | O_TRUNC | O_CREAT, 0, +if (!src-readonly) +mode |= S_IWUSR; + +if ((fd = virFileOpenAs(src-path, O_WRONLY | O_TRUNC | O_CREAT, mode, src-drv-uid, src-drv-gid, 0)) 0) { errno = -fd; return -1; diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 38d02ac..8a7d7e5 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -638,8 +638,13 @@ virStorageFileBackendGlusterCreate(virStorageSourcePtr src) { virStorageFileBackendGlusterPrivPtr priv = src-drv-priv; glfs_fd_t *fd = NULL; +mode_t mode = S_IRUSR; -if (!(fd = glfs_open(priv-vol, src-path, O_CREAT | O_TRUNC | O_WRONLY))) +if (!src-readonly) +mode |= S_IWUSR; + +if (!(fd = glfs_creat(priv-vol, src-path, + O_CREAT | O_TRUNC | O_WRONLY, mode))) return -1; ignore_value(glfs_close(fd)); -- 2.0.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH] [RFC] Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm
On 22 Jul 2014, at 19:43, Alex Bligh a...@alex.org.uk wrote: Testing has been light to date (i.e. can I migrate it inbound with -S without anything complaining). I've given this quite a bit more testing today. It works fine qemu-kvm 1.0 - qemu-2.0+patch (cirrus vga) It works fine qemu-2.0+patch - qemu-2.0+patch (cirrus vga) It doesn't (yet) work qemu-2.0+patch - qemu-kvm 1.0 (cirrus vga). The reason for this is (at least) that I need to emulate the broken versioning of the mc146818rtc timer section, as writing it correctly confuses qemu-kvm 1.0. Therefore please don't bother testing migration back to 1.0 yet. -- Alex Bligh -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH] [RFC] Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm
Andreas, On 27 Jul 2014, at 15:10, Andreas Färber afaer...@suse.de wrote: Hi Alex, + quintela, mst, libvirt Thanks for your comments! This sounds like a really cool feature that SUSE would probably be interested in extending back to 0.14 and 0.15, but I see a fundamental flaw: libvirt on those old source systems does not know it should use a different machine name on the destination side and would still use pc-1.0, wouldn't it? After all, it needs to be able to migrate to other old qemu-kvm machines, so it can't just be updated to use the new name. Right. I'm not using libvirt but face a similar problem. The destination libvirt (or equivalent) now has two 'pc-1.0' machine types. One (allegedly) use by qemu-git 1.0, and one used by qemu-kvm 1.0. The name 'pc-1.0' needs to refer to exactly one of these (obviously), and it currently refers to qemu-git 1.0, so I've left it that way. In a distribution environment where qemu-1.0 was never used, one might want to make my new machine type called 'pc-1.0' and the existing qemu.git pc-1.0 called 'pc-1.0-qemu-git' or similar. Why don't I just change it? Well, imagine someone running Ubuntu 13.04 (say) which shipped with an early post merge qemu made a machine with machine type pc-1.0. Despite the fact that Ubuntu 12.04 was shipped with qemu-kvm (and hence -m pc-1.0 there meant qemu-kvm's pc-1.0), on 13.04, this would mean qemu-git's pc-1.0, and changing the name would break the migration of an Ubuntu 13.04 pc-1.0 machine, whilst fixing migration of a 12.04 pc-1.0 machine. Let no one say this isn't a mess. So, I'm expect whatever generates the qemu command line to know (from the other end) whether to use the different version. Perhaps a slightly nicer fix, if somewhat rococo, would be: * Use pc-1.0-qemu-kvm as one machine name * Use pc-1.0-qemu-git as another machine name * Make pc-1.0 an alias of either one or the other, configurable at the command line, and subject to a build-time default. This would let distributions / users simply decide which kind of pc-1.0 migration they'd like by working by default, and which they'd like broken; the broken one is a second class citizen which can only handle migration by changing the qemu command line appropriately. This would perhaps make things more transparent by default. BTW I would agree this is a significant issue, having spent quite a lot of today playing with stuff that (mis)parses qemu -version Also BTW, I did wonder whether I could autodetect this from the stream. However, as it has to be read serially, by the time you know it's wrong, you are too late AFAICT. Useful suggestion in case of future accidental breakage: put the qemu version in a section right up top. Minor bikeshedding: I would ask to keep the package name in front of the machine version, e.g. qemu-kvm-pc-1.0. Or just kvm-pc-1.0 since this is a QEMU parameter anyway. Obviously not a matter of great import, but per the list below, the standard appears to be 'pc-(arch)?-version' and I'd taken this as a subversion. # qemu-system-x86_64 -machine '?' Supported machines are: pc-0.13 Standard PC (i440FX + PIIX, 1996) pc-i440fx-2.0Standard PC (i440FX + PIIX, 1996) pc-1.0 Standard PC (i440FX + PIIX, 1996) pc-q35-1.7 Standard PC (Q35 + ICH9, 2009) pc-1.1 Standard PC (i440FX + PIIX, 1996) q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.0) pc-q35-2.0 Standard PC (Q35 + ICH9, 2009) pc-i440fx-1.4Standard PC (i440FX + PIIX, 1996) pc-i440fx-1.5Standard PC (i440FX + PIIX, 1996) pc-0.14 Standard PC (i440FX + PIIX, 1996) pc-0.15 Standard PC (i440FX + PIIX, 1996) xenfvXen Fully-virtualized PC pc-q35-1.4 Standard PC (Q35 + ICH9, 2009) isapcISA-only PC pc-0.10 Standard PC (i440FX + PIIX, 1996) pc Ubuntu 14.04 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-trusty) pc-i440fx-trusty Ubuntu 14.04 PC (i440FX + PIIX, 1996) (default) pc-1.2 Standard PC (i440FX + PIIX, 1996) pc-0.11 Standard PC (i440FX + PIIX, 1996) pc-i440fx-1.7Standard PC (i440FX + PIIX, 1996) pc-i440fx-1.6Standard PC (i440FX + PIIX, 1996) none empty machine xenpvXen Para-virtualized PC pc-q35-1.5 Standard PC (Q35 + ICH9, 2009) pc-1.0-qemu-kvm Standard PC (i440FX + PIIX, 1996) pc-q35-1.6 Standard PC (Q35 + ICH9, 2009) pc-0.12 Standard PC (i440FX + PIIX, 1996) pc-1.3 Standard PC (i440FX + PIIX, 1996) -- Alex Bligh -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH for 1.2.7] storage: create: Create files with correct mode
On 07/28/2014 08:59 AM, Peter Krempa wrote: Use correct mode when pre-creating files (for snapshots). The refactor changing to storage driver usage caused a regression as some systems created the file with 000 permissions forbidding qemu to write the file. Pass mode to the creating functions to avoid the problem. Regression since 185e07a5f82bc0692324f3ee13b4816d71b653c1. --- src/storage/storage_backend_fs.c | 6 +- src/storage/storage_backend_gluster.c | 7 ++- 2 files changed, 11 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] [PATCH] schema: bhyve and nmdm updates
On 07/25/2014 10:43 AM, Roman Bogorodskiy wrote: * docs/schemas/domaincommon.rng: Add bhyve domain type, nmdm serial type and master and slave optional attributes for serial that are used by nmdm * tests/domainschematest: Add bhyvexml2argvdata directory to validate bhyve XMLs --- docs/schemas/domaincommon.rng | 8 tests/domainschematest| 1 + 2 files changed, 9 insertions(+) ACK; safe for 1.2.7. +++ b/tests/domainschematest @@ -8,6 +8,7 @@ DIRS= DIRS=$DIRS domainschemadata qemuxml2argvdata sexpr2xmldata DIRS=$DIRS xmconfigdata xml2sexprdata qemuxml2xmloutdata Odd that this line has trailing whitespace embedded into $DIRS; if you want, you could clean that up before pushing. DIRS=$DIRS lxcxml2xmldata lxcxml2xmloutdata +DIRS=$DIRS bhyvexml2argvdata SCHEMA=domain.rng check_schema $DIRS $SCHEMA -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/3] nodedev: move pci express types to virpci.h
On 07/24/2014 04:03 AM, Martin Kletzander wrote: On Wed, Jul 23, 2014 at 09:06:07PM -0600, Eric Blake wrote: Finding virPCIE* code is more intuitive if located in virpci.h instead of node_device_conf.h. +struct _virPCIEDeviceInfo { +/* Not all PCI Express devices has link. For example this 'Root Complex I know it's pre-existing, but reading devices has link makes the back of my head itch, shouldn't it be 'have'? Could you change it if I am right? You are right; 'all ... devices' is plural, so it should pair with 'have'. Fixed, and series 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
[libvirt] [PATCH] LXC: Fix virLXCControllerSetupDevPTS() wrt user namespaces
The gid value passed to devpts has to be translated by hand as virLXCControllerSetupDevPTS() is called before setting up the user and group mappings. Otherwise devpts will use an unmapped gid and openpty() will fail within containers. Linux commit commit 23adbe12 (fs,userns: Change inode_capable to capable_wrt_inode_uidgid) uncovered that issue. Signed-off-by: Richard Weinberger rich...@nod.at --- src/lxc/lxc_controller.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 2d220eb..82ecf12 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1164,6 +1164,19 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl) return rc; } +static uint32_t +virLXCControllerLookupUsernsMap(virDomainIdMapEntryPtr map, int num, +uint32_t src) +{ +int i; + +for (i = 0; i num; i++) { +if (src map[i].start src map[i].start + map[i].count) +return map[i].target + (src - map[i].start); +} + +return src; +} static int virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map, @@ -1930,6 +1943,7 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl) char *opts = NULL; char *devpts = NULL; int ret = -1; +gid_t ptsgid = 5; VIR_DEBUG(Setting up private /dev/pts); @@ -1949,10 +1963,17 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl) goto cleanup; } +if (ctrl-def-idmap.ngidmap) +ptsgid = +virLXCControllerLookupUsernsMap(ctrl-def-idmap.gidmap, +ctrl-def-idmap.ngidmap, +ptsgid); + /* XXX should we support gid=X for X!=5 for distros which use * a different gid for tty? */ -if (virAsprintf(opts, newinstance,ptmxmode=0666,mode=0620,gid=5%s, -(mount_options ? mount_options : )) 0) +if (virAsprintf +(opts, newinstance,ptmxmode=0666,mode=0620,gid=%u%s, ptsgid, + (mount_options ? mount_options : )) 0) goto cleanup; VIR_DEBUG(Mount devpts on %s type=tmpfs flags=%x, opts=%s, -- 2.0.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/1] qemu: Tidy up job handling during live migration
During a QEMU live migration several warning messages about job handling could be written to syslog on the destination host: entering monitor without asking for a nested job is dangerous The messages are written because the job handling during migration uses hard coded asyncJob values in several places that are incorrect. This patch passes the required asyncJob value around and prevents the warnings as well as any issues that the warnings may be referring to. Signed-off-by: Sam Bobroff sam.bobr...@au1.ibm.com --- src/qemu/qemu_domain.c| 5 +++-- src/qemu/qemu_domain.h| 2 +- src/qemu/qemu_driver.c| 21 - src/qemu/qemu_migration.c | 3 ++- src/qemu/qemu_process.c | 33 ++--- src/qemu/qemu_process.h | 1 + 6 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4f63c88..3abbb14 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2497,7 +2497,8 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, - virDomainObjPtr vm) + virDomainObjPtr vm, + int asyncJob) { qemuDomainObjPrivatePtr priv = vm-privateData; char **aliases; @@ -2505,7 +2506,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT)) return 0; -qemuDomainObjEnterMonitor(driver, vm); +ignore_value(qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob)); if (qemuMonitorGetDeviceAliases(priv-mon, aliases) 0) { qemuDomainObjExitMonitor(driver, vm); return -1; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 67972b9..8736889 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -369,7 +369,7 @@ extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace; extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig; int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, - virDomainObjPtr vm); + virDomainObjPtr vm, int asyncJob); bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, virDomainDefPtr src, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 33541d3..b0439d2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1616,7 +1616,8 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, goto cleanup; } -if (qemuProcessStart(conn, driver, vm, NULL, -1, NULL, NULL, +if (qemuProcessStart(conn, driver, vm, QEMU_ASYNC_JOB_NONE, + NULL, -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, start_flags) 0) { virDomainAuditStart(vm, booted, false); @@ -5446,7 +5447,8 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, } /* Set the migration source and start it up. */ -ret = qemuProcessStart(conn, driver, vm, stdio, *fd, path, NULL, +ret = qemuProcessStart(conn, driver, vm, QEMU_ASYNC_JOB_NONE, + stdio, *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, VIR_QEMU_PROCESS_START_PAUSED); @@ -6143,7 +6145,8 @@ qemuDomainObjStart(virConnectPtr conn, } } -ret = qemuProcessStart(conn, driver, vm, NULL, -1, NULL, NULL, +ret = qemuProcessStart(conn, driver, vm, QEMU_ASYNC_JOB_NONE, + NULL, -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, start_flags); virDomainAuditStart(vm, booted, ret = 0); if (ret = 0) { @@ -6500,7 +6503,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, } if (ret == 0) -qemuDomainUpdateDeviceList(driver, vm); +qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE); return ret; } @@ -6560,7 +6563,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, } if (ret == 0) -qemuDomainUpdateDeviceList(driver, vm); +qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE); return ret; } @@ -14101,8 +14104,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (config) virDomainObjAssignDef(vm, config, false, NULL); -rc = qemuProcessStart(snapshot-domain-conn, - driver, vm, NULL, -1, NULL, snap, +rc = qemuProcessStart(snapshot-domain-conn, driver, vm, + QEMU_ASYNC_JOB_NONE, NULL, -1, NULL, snap, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, VIR_QEMU_PROCESS_START_PAUSED); virDomainAuditStart(vm, from-snapshot, rc = 0); @@ -14195,8 +14198,8 @@ static int
[libvirt] [PATCH] nodedev: fix a uninitialized variable build failure
Fix a -Werror=maybe-uninitialized warring Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/conf/node_device_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 78bc63f..96524a6 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1349,7 +1349,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, { virNodeDevCapsDefPtr caps; char *tmp; -int val, ret; +int val, ret = -1; if (VIR_ALLOC(caps) 0) return NULL; -- 1.9.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] LXC: Fix virLXCControllerSetupDevPTS() wrt user namespaces
-Original Message- From: libvir-list-boun...@redhat.com [mailto:libvir-list-boun...@redhat.com] On Behalf Of Richard Weinberger Sent: Tuesday, July 29, 2014 4:59 AM To: libvir-list@redhat.com Cc: Richard Weinberger; da...@sigma-star.at Subject: [libvirt] [PATCH] LXC: Fix virLXCControllerSetupDevPTS() wrt user namespaces The gid value passed to devpts has to be translated by hand as virLXCControllerSetupDevPTS() is called before setting up the user and group mappings. Otherwise devpts will use an unmapped gid and openpty() will fail within containers. Linux commit commit 23adbe12 (fs,userns: Change inode_capable to capable_wrt_inode_uidgid) uncovered that issue. Signed-off-by: Richard Weinberger rich...@nod.at Reviewed-by: Chen Hanxiao chenhanx...@cn.fujitsu.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] nodedev: fix a uninitialized variable build failure
On 07/28/2014 08:05 PM, Chen Hanxiao wrote: Fix a -Werror=maybe-uninitialized warring s/warring/warning/ Uninitialized only if caps-type is out-of-bounds from its enum type. ACK and pushed. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/conf/node_device_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 78bc63f..96524a6 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1349,7 +1349,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, { virNodeDevCapsDefPtr caps; char *tmp; -int val, ret; +int val, ret = -1; if (VIR_ALLOC(caps) 0) return NULL; -- 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] [Qemu-devel] [PATCH] [RFC] Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm
Quoting Alex Bligh (a...@alex.org.uk): On 22 Jul 2014, at 19:43, Alex Bligh a...@alex.org.uk wrote: Testing has been light to date (i.e. can I migrate it inbound with -S without anything complaining). thanks, Alex! I've given this quite a bit more testing today. It works fine qemu-kvm 1.0 - qemu-2.0+patch (cirrus vga) It works fine qemu-2.0+patch - qemu-2.0+patch (cirrus vga) It doesn't (yet) work qemu-2.0+patch - qemu-kvm 1.0 (cirrus vga). The reason for this is (at least) that I need to emulate the broken versioning of the mc146818rtc timer section, as writing it correctly confuses qemu-kvm 1.0. Therefore please don't bother testing migration back to 1.0 yet. I don't think that is in any way a problem. Is migrating to older versions ever actually expected to work? In either case I don't think for this particular case it's a problem. (The how to handle this in libvirt question is more interesting) -serge -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v5 0/4] fix blockcopy across libvirtd restart, turn on active blockcommit
v4 was here: https://www.redhat.com/archives/libvir-list/2014-June/msg01095.html Since then: I _finally_ implemented persistent domain updates to match live changes, by reimplementing how mirror is tracked in XML to be more robust to libvirtd restarts. In particular, it fixes a bug in v4 that Adam Litke pointed out where a pivot commit would emit a ready event for 'active commit' but then a completed event for plain 'commit'. Patches 1 and 2 are completely local to blockcopy, and fix a long-standing bug where it is not robust to libvirtd restarts (similar to the bug fixed in 60e4944). They are pre-requisite to turning on active commit. Patches 3 and 4 are borderline on whether it is a new feature or a bug fix. But consider that commit 47549d5 turned on qemu feature probing with the intent of getting this in 1.2.7, and we already missed getting active commit into 1.2.6. As it is, patch 4 is very similar to the already-acked counterpart of v4. Therefore, even though I missed rc1, I'm arguing that this whole series should be included in rc2 in time for 1.2.7. Not done yet, but that I'd also like to have in the release if I can swing it: the new virConnectGetDomainCapabilities API needs to expose features on whether active commit will work. Also, I'd like to fix libvirtd restarts to inspect all existing mirror tags and see if the job completed while libvirtd was offline (that is, when we miss an event, we should still start up in the correct state when reconnecting to qemu). Eric Blake (4): blockcopy: add more XML for state tracking blockjob: properly track blockcopy xml changes on disk blockcommit: track job type in xml blockcommit: turn on active commit docs/formatdomain.html.in | 23 ++- docs/schemas/domaincommon.rng | 19 ++- src/conf/domain_conf.c | 56 ++- src/conf/domain_conf.h | 14 +- src/qemu/qemu_driver.c | 167 ++--- src/qemu/qemu_process.c| 92 ++-- .../qemuxml2argv-disk-active-commit.xml| 37 + .../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 8 +- .../qemuxml2xmlout-disk-mirror-old.xml | 4 +- tests/qemuxml2xmltest.c| 1 + 10 files changed, 336 insertions(+), 85 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml -- 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v5 4/4] blockcommit: turn on active commit
With this in place, I can (finally!) now do: virsh blockcommit $dom vda --shallow --verbose --pivot and watch qemu shorten the backing chain by one, followed by libvirt automatically updating the dumpxml output, effectively undoing the work of virsh snapshot-commit --no-metadata --disk-only. Commit is S much faster than blockpull, when I'm still fairly close in time to when the temporary qcow2 wrapper file was created via a snapshot operation! * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Implement live commit. Signed-off-by: Eric Blake ebl...@redhat.com --- src/qemu/qemu_driver.c | 36 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 683eaf3..9cf8fe8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15517,9 +15517,11 @@ qemuDomainBlockCommit(virDomainPtr dom, char *topPath = NULL; char *basePath = NULL; char *backingPath = NULL; +virStorageSourcePtr mirror = NULL; -/* XXX Add support for COMMIT_ACTIVE, COMMIT_DELETE */ +/* XXX Add support for COMMIT_DELETE */ virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | + VIR_DOMAIN_BLOCK_COMMIT_ACTIVE | VIR_DOMAIN_BLOCK_COMMIT_RELATIVE, -1); if (!(vm = qemuDomObjFromDomain(dom))) @@ -15568,9 +15570,6 @@ qemuDomainBlockCommit(virDomainPtr dom, top_parent))) goto endjob; -/* FIXME: qemu 2.0 supports active commit, but as a two-stage - * process; qemu 2.1 is further improving active commit. We need - * to start supporting it in libvirt. */ if (topSource == disk-src) { if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_ACTIVE_COMMIT)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, @@ -15584,6 +15583,12 @@ qemuDomainBlockCommit(virDomainPtr dom, disk-dst); goto endjob; } +if (disk-mirror) { +virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, + _(disk '%s' already in active block job), + disk-dst); +goto endjob; +} } else if (flags VIR_DOMAIN_BLOCK_COMMIT_ACTIVE) { virReportError(VIR_ERR_INVALID_ARG, _(active commit requested but '%s' is not active), @@ -15614,6 +15619,16 @@ qemuDomainBlockCommit(virDomainPtr dom, goto endjob; } +/* For an active commit, clone enough of the base to act as the mirror */ +if (topSource == disk-src) { +if (!(mirror = virStorageSourceCopy(baseSource, false))) +goto endjob; +if (virStorageSourceInitChainElement(mirror, + disk-src, + false) 0) +goto endjob; +} + /* For the commit to succeed, we must allow qemu to open both the * 'base' image and the parent of 'top' as read/write; 'top' might * not have a parent, or might already be read-write. XXX It @@ -15665,6 +15680,18 @@ qemuDomainBlockCommit(virDomainPtr dom, bandwidth); qemuDomainObjExitMonitor(driver, vm); +if (ret == 0 mirror) { +virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); + +disk-mirror = mirror; +mirror = NULL; +disk-mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT; +if (virDomainSaveStatus(driver-xmlopt, cfg-stateDir, vm) 0) +VIR_WARN(Unable to save status on vm %s after block job, + vm-def-name); +virObjectUnref(cfg); +} + endjob: if (ret 0 clean_access) { /* Revert access to read-only, if possible. */ @@ -15674,6 +15701,7 @@ qemuDomainBlockCommit(virDomainPtr dom, qemuDomainPrepareDiskChainElement(driver, vm, top_parent, VIR_DISK_CHAIN_READ_ONLY); } +virStorageSourceFree(mirror); if (!qemuDomainObjEndJob(driver, vm)) vm = NULL; -- 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v5 3/4] blockcommit: track job type in xml
A future patch is going to wire up qemu active block commit jobs; but as they have similar events and are canceled/pivoted in the same way as block copy jobs, it is easiest to track all bookkeeping for the commit job by reusing the mirror element. This patch adds domain XML to track which job was responsible for creating a mirroring situation, and adds a job='copy' attribute to all existing uses of mirror. Along the way, it also massages the qemu monitor backend to read the new field in order to generate the correct type of libvirt job (even though it requires a future patch to actually cause a qemu event that can be reported as an active commit). It also prepares to update persistent XML to match changes made to live XML when a copy completes. * docs/schemas/domaincommon.rng: Enhance schema. * docs/formatdomain.html.in: Document it. * src/conf/domain_conf.h (_virDomainDiskDef): Add a field. * src/conf/domain_conf.c (virDomainBlockJobType): String conversion. (virDomainDiskDefParseXML): Parse job type. (virDomainDiskDefFormat): Output job type. * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Distinguish active from regular commit. * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Set job type. (qemuDomainBlockPivot, qemuDomainBlockJobImpl): Clean up job type on completion. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml: Update tests. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise. * tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml: New file. * tests/qemuxml2xmltest.c (mymain): Drive new test. Signed-off-by: Eric Blake ebl...@redhat.com --- docs/formatdomain.html.in | 15 + docs/schemas/domaincommon.rng | 13 src/conf/domain_conf.c | 33 ++- src/conf/domain_conf.h | 1 + src/qemu/qemu_driver.c | 2 ++ src/qemu/qemu_process.c| 37 +- .../qemuxml2argv-disk-active-commit.xml| 37 ++ .../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 6 ++-- .../qemuxml2xmlout-disk-mirror-old.xml | 4 +-- tests/qemuxml2xmltest.c| 1 + 10 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4cb4289..0e7fad2 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1898,16 +1898,19 @@ /dd dtcodemirror/code/dt dd -This element is present if the hypervisor has started a block -copy operation (via the codevirDomainBlockRebase/code -API), where the mirror location in the codesource/code -sub-element will eventually have the same contents as the -source, and with the file format in the +This element is present if the hypervisor has started a +long-running block job operation, where the mirror location in +the codesource/code sub-element will eventually have the +same contents as the source, and with the file format in the sub-element codeformat/code (which might differ from the format of the source). The details of the codesource/code sub-element are determined by the codetype/code attribute of the mirror, similar to what is done for the -overall codedisk/code device element. The +overall codedisk/code device element. The codejob/code +attribute mentions which API started the operation (copy for +the codevirDomainBlockRebase/code API, or active-commit +for the codevirDomainBlockCommit/code +API), span class=sincesince 1.2.7/span. The attribute codeready/code, if present, tracks progress of the job: codeyes/code if the disk is known to be ready to pivot, or, span class=sincesince diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 389c8c9..3911a9f 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4265,6 +4265,13 @@ /attribute /optional optional +attribute name='job' + choice +valuecopy/value + /choice +/attribute + /optional + optional interleave ref name='diskSourceFile'/ optional @@ -4274,6 +4281,12 @@ /optional /group group !-- preferred format -- + attribute name='job' +choice + valuecopy/value + valueactive-commit/value +/choice + /attribute interleave ref name=diskSource/ optional diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1c8f8cf..1a76ce7 100644 ---
[libvirt] [PATCH v5 2/4] blockjob: properly track blockcopy xml changes on disk
We were not directly saving the domain XML to file after starting or finishing a blockcopy. Without the startup write, a libvirtd restart in the middle of a copy job would forget that the job was underway. Then at pivot, we were indirectly writing new XML in reaction to events that occur as we stop and restart the guest CPUs. But there was a race: since pivot is an async action, it is possible that libvirtd is restarted before the pivot completes, so if XML changes during the event, that change was not written. The original blockcopy code cleared out the mirror element prior to restarting the CPUs, but this is also a race, observed if a user does an async pivot and a dumpxml before the event occurs. Furthermore, this race will interfere with active commit in a future patch, because that code will rely on the mirror element at the time of the qemu event to determine whether to inform the user of a normal commit or an active commit. Fix things by saving state any time we modify live XML, while delaying XML disk modifications until after the event completes. We still need a to teach libvirtd restarts to examine all existing mirror elements to see if the job completed in the meantime (that is, if libvirtd misses the event, the updated state still needs to be updated in live XML), but that will be a later patch, in part because we also need to to start taking advantage of newer qemu's ability to keep the job around after completion rather than the current usage where the job disappears both on error and on success. * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Track XML change on disk. (qemuDomainBlockJobImpl, qemuDomainBlockPivot): Move job-end XML rewrites... * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): ...here. Signed-off-by: Eric Blake ebl...@redhat.com --- src/qemu/qemu_driver.c | 121 ++-- src/qemu/qemu_process.c | 53 - 2 files changed, 117 insertions(+), 57 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index acc9ef0..180333c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14911,38 +14911,43 @@ qemuDomainBlockPivot(virConnectPtr conn, virSecurityManagerSetDiskLabel(driver-securityManager, vm-def, disk) 0)) goto cleanup; -/* Attempt the pivot. */ +/* Attempt the pivot. Record the attempt now, to prevent duplicate + * attempts; but the actual disk change will be made when emitting + * the event. + * XXX On libvirtd restarts, if we missed the qemu event, we need + * to double check what state qemu is in. + * XXX We should be using qemu's rerror flag to make sure the job + * remains alive until we know it's final state. + * XXX If the abort command is synchronous but the qemu event says + * that pivot failed, we need to reflect that failure into the + * overall return value. */ +disk-mirrorState = VIR_DOMAIN_DISK_MIRROR_PIVOT; qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorDrivePivot(priv-mon, device, disk-mirror-path, format); qemuDomainObjExitMonitor(driver, vm); -if (ret == 0) { -/* XXX We want to revoke security labels and disk lease, as - * well as audit that revocation, before dropping the original - * source. But it gets tricky if both source and mirror share - * common backing files (we want to only revoke the non-shared - * portion of the chain, and is made more difficult by the - * fact that we aren't tracking the full chain ourselves; so - * for now, we leak the access to the original. */ -virStorageSourceFree(oldsrc); -oldsrc = NULL; -} else { +if (ret 0) { /* On failure, qemu abandons the mirror, and reverts back to * the source disk (RHEL 6.3 has a bug where the revert could * cause catastrophic failure in qemu, but we don't need to * worry about it here as it is not an upstream qemu problem. */ /* XXX should we be parsing the exact qemu error, or calling * 'query-block', to see what state we really got left in - * before killing the mirroring job? And just as on the - * success case, there's security labeling to worry about. */ + * before killing the mirroring job? + * XXX We want to revoke security labels and disk lease, as + * well as audit that revocation, before dropping the original + * source. But it gets tricky if both source and mirror share + * common backing files (we want to only revoke the non-shared + * portion of the chain); so for now, we leak the access to + * the original. */ virStorageSourceFree(disk-mirror); +disk-mirror = NULL; +disk-mirrorState = VIR_DOMAIN_DISK_MIRROR_DEFAULT; } - -disk-mirror = NULL; -disk-mirrorState = VIR_DOMAIN_DISK_MIRROR_DEFAULT; +if
[libvirt] [PATCH v5 1/4] blockcopy: add more XML for state tracking
Doing a blockcopy operation across a libvirtd restart is not very robust at the moment. In particular, we are clearing the mirror element prior to telling qemu to finish the job; and thanks to the ability to request async completion, the user can easily regain control prior to qemu actually finishing the effort, and they should be able to poll the domain XML to see if the job is still going. A future patch will fix things to actually wait until qemu is done before modifying the XML to reflect the job completion. But since qemu issues identical BLOCK_JOB_COMPLETE events regardless of whether the job was cancelled (kept the original disk) or completed (pivoted to the new disk), we have to track which of the two operations were used to end the job. Furthermore, we'd like to avoid attempts to end a job where we are already waiting on an earlier request to qemu to end the job. Likewise, if we miss the qemu event (perhaps because it arrived during a libvirtd restart), we still need enough state recorded to be able to determine how to modify the domain XML once we reconnect to qemu and manually learn whether the job still exists. Although this patch doesn't actually fix the problem, it is a preliminary step that makes it possible to track whether a job has already begun steps towards completion. * src/conf/domain_conf.h (virDomainDiskMirror): New enum. (_virDomainDiskDef): Convert bool mirroring to new enum. * src/conf/domain_conf.c (virDomainDiskDefParseXML) (virDomainDiskDefFormat): Handle new values. * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Adjust client. * src/qemu/qemu_driver.c (qemuDomainBlockPivot) (qemuDomainBlockJobImpl): Likewise. * docs/schemas/domaincommon.rng (diskMirror): Expose new values. * docs/formatdomain.html.in (elementsDisks): Document it. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it. Signed-off-by: Eric Blake ebl...@redhat.com --- docs/formatdomain.html.in | 10 +++--- docs/schemas/domaincommon.rng | 6 +- src/conf/domain_conf.c | 23 +++--- src/conf/domain_conf.h | 13 +++- src/qemu/qemu_driver.c | 12 +-- src/qemu/qemu_process.c| 4 ++-- .../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 4 7 files changed, 56 insertions(+), 16 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8950959..4cb4289 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1907,9 +1907,13 @@ format of the source). The details of the codesource/code sub-element are determined by the codetype/code attribute of the mirror, similar to what is done for the -overall codedisk/code device element. If -attribute codeready/code is present, then it is known the -disk is ready to pivot; otherwise, the disk is probably still +overall codedisk/code device element. The +attribute codeready/code, if present, tracks progress of +the job: codeyes/code if the disk is known to be ready to +pivot, or, span class=sincesince +1.2.7/span, codeabort/code or codepivot/code if the +job is in the process of completing. If codeready/code is +not present, the disk is probably still copying. For now, this element only valid in output; it is ignored on input. The codesource/code sub-element exists for all two-phase jobs span class=sincesince 1.2.6/span. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f6f697c..389c8c9 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4284,7 +4284,11 @@ /choice optional attribute name='ready' - valueyes/value + choice +valueyes/value +valueabort/value +valuepivot/value + /choice /attribute /optional /element diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 910f6e2..1c8f8cf 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -747,6 +747,12 @@ VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST, unmap, ignore) +VIR_ENUM_IMPL(virDomainDiskMirror, VIR_DOMAIN_DISK_MIRROR_LAST, + default, + yes, + abort, + pivot) + #define VIR_DOMAIN_XML_WRITE_FLAGS VIR_DOMAIN_XML_SECURE #define VIR_DOMAIN_XML_READ_FLAGS VIR_DOMAIN_XML_INACTIVE @@ -5482,7 +5488,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, } ready = virXMLPropString(cur, ready); if (ready) { -def-mirroring = true; +def-mirrorState = virDomainDiskMirrorTypeFromString(ready); +if (def-mirrorState 0) { +
Re: [libvirt] [PATCH v5 0/4] fix blockcopy across libvirtd restart, turn on active blockcommit
On 07/28/2014 10:20 PM, Eric Blake wrote: v4 was here: https://www.redhat.com/archives/libvir-list/2014-June/msg01095.html Since then: I _finally_ implemented persistent domain updates to match live changes, by reimplementing how mirror is tracked in XML to be more robust to libvirtd restarts. In particular, it fixes a bug in v4 that Adam Litke pointed out where a pivot commit would emit a ready event for 'active commit' but then a completed event for plain 'commit'. Eric Blake (4): blockcopy: add more XML for state tracking blockjob: properly track blockcopy xml changes on disk blockcommit: track job type in xml blockcommit: turn on active commit Also at: http://repo.or.cz/w/libvirt/ericb.git/shortlog/refs/heads/gluster or git checkout git://repo.or.cz/libvirt/ericb.git gluster (although my testing so far has been on local files, the idea is that this series _should_ allow active commit into a gluster-based backing chain). -- 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