Re: [PATCH] qemuDomainUpdateDeviceConfig: Allow full disk update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/02/2016 07:41 AM, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1368417
> 
> So far, when it comes to 'virsh update-device --config' of disks
> we are limiting ourselves for just the disk source update and
> just for CDROMs and floppies. This makes no sense. Especially if
> you look around and see that we already allow full update to
> graphics and net devices. So let's just take whatever XML user
> wants to have there and replace our internal definition with it.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 26 +++++++-------------------
>  1 file changed, 7 insertions(+), 19 deletions(-)
> 

Crazy this has been this way since 0.9.0 (commit id 'f37c29c8a').

Although this patch certainly does more than just ensure the
startupPolicy adjustment works for --config as well as --live (which is
the basis of the bug).

I would think to "just fix" the bug/issue "DISK" could be added to that
negative if condition, which leaves just LUN as a type that wouldn't be
updateable (since startupPolicy is updated in the subsequent code).

I guess the question is - is there something in the DISK or LUN specific
usages that shouldn't be just updated or something that could be lost if
we simply delete the old one without copying "something" in
(_virDomainDiskDef is used for a lot and especially that private piece
which could be of concern).

The text in the last paragraph of virDomainUpdateDeviceFlags just
doesn't give me enough of a hint why FLOPPY and CDROM were specifically
singled out.

Let's see if there's other comments/thoughts since I've bumped this.

John
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 2efaa2a..b5abb0c 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -8104,35 +8104,23 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
>                               unsigned int parse_flags,
>                               virDomainXMLOptionPtr xmlopt)
>  {
> -    virDomainDiskDefPtr orig, disk;
> +    virDomainDiskDefPtr newDisk;
>      virDomainGraphicsDefPtr newGraphics;
>      virDomainNetDefPtr net;
>      int pos;
>  
>      switch ((virDomainDeviceType) dev->type) {
>      case VIR_DOMAIN_DEVICE_DISK:
> -        disk = dev->data.disk;
> -        if (!(orig = virDomainDiskByName(vmdef, disk->dst, false))) {
> +        newDisk = dev->data.disk;
> +        if ((pos = virDomainDiskIndexByName(vmdef, newDisk->dst, false)) < 0) {
>              virReportError(VIR_ERR_INVALID_ARG,
> -                           _("target %s doesn't exist."), disk->dst);
> +                           _("target %s doesn't exist."), newDisk->dst);
>              return -1;
>          }
> -        if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
> -            !(orig->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)) {
> -            virReportError(VIR_ERR_INVALID_ARG, "%s",
> -                           _("this disk doesn't support update"));
> -            return -1;
> -        }
> -        /*
> -         * Update 'orig'
> -         * We allow updating src/type//driverType/cachemode/
> -         */
> -        orig->cachemode = disk->cachemode;
> -        orig->startupPolicy = disk->startupPolicy;
>  
> -        virStorageSourceFree(orig->src);
> -        orig->src = disk->src;
> -        disk->src = NULL;
> +        virDomainDiskDefFree(vmdef->disks[pos]);
> +        vmdef->disks[pos] = newDisk;
> +        dev->data.disk = NULL;
>          break;
>  
>      case VIR_DOMAIN_DEVICE_GRAPHICS:
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]