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

Re: [libvirt] [PATCHv2 08/62] qemu: hotplug: consolidate media change code paths



On Mon, Aug 13, 2018 at 05:59:42PM +0200, Peter Krempa wrote:
Use qemuDomainAttachDeviceDiskLive to change the media in
qemuDomainChangeDiskLive as the former function already does all the
necessary steps to prepare the new medium.

This also allows us to turn qemuDomainChangeEjectableMedia static.

Signed-off-by: Peter Krempa <pkrempa redhat com>
---
src/qemu/qemu_driver.c  | 18 ++----------------
src/qemu/qemu_hotplug.c | 18 +++++++++++++++---
src/qemu/qemu_hotplug.h |  9 ++-------
tests/qemuhotplugtest.c |  2 +-
4 files changed, 20 insertions(+), 27 deletions(-)

@@ -7884,16 +7878,8 @@ 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));
+        if (qemuDomainAttachDeviceDiskLive(driver, vm, dev, force) < 0)
            goto cleanup;
-        }

        dev->data.disk->src = NULL;

This assignment is now redundant - if qemuDomainAttachDeviceDiskLive
returns 0, the pointer is already cleared.

    }

Reviewed-by: Ján Tomko <jtomko redhat com>

Jano

Attachment: signature.asc
Description: Digital signature


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