Re: [PATCH 7/8] qemu: hotplug: Split out media change code from disk hotplug

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

 




On 9/27/18 11:09 AM, Peter Krempa wrote:
> Disk hotplug has slightly different semantics from media changing. Move
> the media change code out and add proper initialization of the new
> source object.
> 
> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c  | 15 +----------
>  src/qemu/qemu_hotplug.c | 56 +++++++++++++++++++++++++----------------
>  2 files changed, 35 insertions(+), 36 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 64f0ad33e8..f609151152 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -7851,12 +7851,6 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
>      virDomainDeviceDef oldDev = { .type = dev->type };
>      int ret = -1;
> 
> -    if (virDomainDiskTranslateSourcePool(disk) < 0)
> -        goto cleanup;
> -

Would removing this affect the subsequent virStorageSourceIsSameLocation
call?  Since def->disk->src is one of the "changed" values?


> -    if (qemuDomainDetermineDiskChain(driver, vm, disk, true) < 0)
> -        goto cleanup;
> -
>      if (!(orig_disk = virDomainDiskFindByBusAndDst(vm->def,
>                                                     disk->bus, disk->dst))) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> @@ -7885,16 +7879,9 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
>              goto cleanup;
>          }
> 
> -        /* Add the new disk src into shared disk hash table */
> -        if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0)
> -            goto cleanup;
> -
>          if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk,
> -                                           dev->data.disk->src, force) < 0) {
> -            ignore_value(qemuRemoveSharedDisk(driver, dev->data.disk,
> -                                              vm->def->name));
> +                                           dev->data.disk->src, force) < 0)
>              goto cleanup;
> -        }
> 
>          dev->data.disk->src = NULL;
>      }
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 6227a130da..ef3f0cd8b3 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -737,6 +737,15 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
> 
>      disk->src = newsrc;
> 
> +    if (virDomainDiskTranslateSourcePool(disk) < 0)
> +        goto cleanup;
> +
> +    if (qemuAddSharedDisk(driver, disk, vm->def->name) < 0)
> +        goto cleanup;

Failures after this would need to call qemuRemoveSharedDisk

John

[...]

--
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]

  Powered by Linux