The testQemuHotplugDetach() already does call qemuDomainDetachDeviceLive() but only for some device types. For the rest it reports an error (but only if running test verbosely). This makes no sense. Just call qemuDomainDetachDeviceLive() directly and drop testQemuHotplugDetach(). Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- tests/qemuhotplugtest.c | 49 +---------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 6aaccce55b..4f9d1bcb2a 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -169,53 +169,6 @@ testQemuHotplugAttach(virDomainObj *vm, return ret; } -static int -testQemuHotplugDetach(virDomainObj *vm, - virDomainDeviceDef *dev, - bool async) -{ - int ret = -1; - - switch (dev->type) { - case VIR_DOMAIN_DEVICE_DISK: - case VIR_DOMAIN_DEVICE_CHR: - case VIR_DOMAIN_DEVICE_SHMEM: - case VIR_DOMAIN_DEVICE_WATCHDOG: - case VIR_DOMAIN_DEVICE_HOSTDEV: - case VIR_DOMAIN_DEVICE_NET: - ret = qemuDomainDetachDeviceLive(vm, dev, &driver, async); - break; - - case VIR_DOMAIN_DEVICE_LEASE: - case VIR_DOMAIN_DEVICE_FS: - case VIR_DOMAIN_DEVICE_INPUT: - case VIR_DOMAIN_DEVICE_SOUND: - case VIR_DOMAIN_DEVICE_VIDEO: - case VIR_DOMAIN_DEVICE_CONTROLLER: - case VIR_DOMAIN_DEVICE_GRAPHICS: - case VIR_DOMAIN_DEVICE_HUB: - case VIR_DOMAIN_DEVICE_REDIRDEV: - case VIR_DOMAIN_DEVICE_NONE: - case VIR_DOMAIN_DEVICE_SMARTCARD: - case VIR_DOMAIN_DEVICE_MEMBALLOON: - case VIR_DOMAIN_DEVICE_NVRAM: - case VIR_DOMAIN_DEVICE_LAST: - case VIR_DOMAIN_DEVICE_RNG: - case VIR_DOMAIN_DEVICE_TPM: - case VIR_DOMAIN_DEVICE_PANIC: - case VIR_DOMAIN_DEVICE_MEMORY: - case VIR_DOMAIN_DEVICE_IOMMU: - case VIR_DOMAIN_DEVICE_VSOCK: - case VIR_DOMAIN_DEVICE_AUDIO: - case VIR_DOMAIN_DEVICE_CRYPTO: - VIR_TEST_VERBOSE("device type '%s' cannot be detached", - virDomainDeviceTypeToString(dev->type)); - break; - } - - return ret; -} - static int testQemuHotplugUpdate(virDomainObj *vm, virDomainDeviceDef *dev) @@ -394,7 +347,7 @@ testQemuHotplug(const void *data) break; case DETACH: - ret = testQemuHotplugDetach(vm, dev, false); + ret = qemuDomainDetachDeviceLive(vm, dev, &driver, false); if (ret == 0 || fail) ret = testQemuHotplugCheckResult(vm, domain_xml, domain_filename, fail); -- 2.39.2