The individual qemuDomainDetach*Device() functions will soon be "less functional", since some of the code that is duplicated in 10 of the 12 detach functions is going to be moved into the common qemuDomainDetachDeviceLive(), which calls them all. qemuhotplugtest.c is the only place any of these individual functions is called other than qemuDomainDetachDeviceLive() itself. Fortunately, qemuDomainDetachDeviceLive() provides exactly the functionality needed by the test driver (except that it supports detach of more device types than the test driver has tests for). This patch replaces the calls to qemuDomainDetach(Chr|Shmen|Watchdog|Disk)Device with a single call to the higher level function, allowing us to shift functionality between the lower level functions without breaking the tests. Signed-off-by: Laine Stump <laine@xxxxxxxxx> --- src/qemu/qemu_hotplug.c | 15 ++++++++------- src/qemu/qemu_hotplug.h | 16 ---------------- tests/qemuhotplugtest.c | 8 +------- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index ea5b6bf8ac..2d13fca871 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5389,7 +5389,7 @@ qemuFindDisk(virDomainDefPtr def, const char *dst) return -1; } -int +static int qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainDeviceDefPtr dev, @@ -5721,7 +5721,7 @@ qemuDomainDetachHostDevice(virQEMUDriverPtr driver, } -int +static int qemuDomainDetachShmemDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainShmemDefPtr dev, @@ -5775,7 +5775,7 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver, } -int +static int qemuDomainDetachWatchdog(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainWatchdogDefPtr dev, @@ -5940,10 +5940,11 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver, } -int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainChrDefPtr chr, - bool async) +static int +qemuDomainDetachChrDevice(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainChrDefPtr chr, + bool async) { int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 61f732c506..9980c2a756 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -114,22 +114,6 @@ int qemuDomainAttachRNGDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainRNGDefPtr rng); -int qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainDeviceDefPtr dev, - bool async); -int qemuDomainDetachShmemDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainShmemDefPtr dev, - bool async); -int qemuDomainDetachWatchdog(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainWatchdogDefPtr watchdog, - bool async); -int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainChrDefPtr chr, - bool async); int qemuDomainDetachDeviceLive(virDomainObjPtr vm, virDomainDeviceDefPtr dev, virQEMUDriverPtr driver, diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 1491c214d0..3eb97d886a 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -147,16 +147,10 @@ testQemuHotplugDetach(virDomainObjPtr vm, switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: - ret = qemuDomainDetachDeviceDiskLive(&driver, vm, dev, async); - break; case VIR_DOMAIN_DEVICE_CHR: - ret = qemuDomainDetachChrDevice(&driver, vm, dev->data.chr, async); - break; case VIR_DOMAIN_DEVICE_SHMEM: - ret = qemuDomainDetachShmemDevice(&driver, vm, dev->data.shmem, async); - break; case VIR_DOMAIN_DEVICE_WATCHDOG: - ret = qemuDomainDetachWatchdog(&driver, vm, dev->data.watchdog, async); + ret = qemuDomainDetachDeviceLive(vm, dev, &driver, async); break; default: VIR_TEST_VERBOSE("device type '%s' cannot be detached\n", -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list