render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 621040f56e852c0b95be8aef20878b8a4012b9ee Mon Sep 17 00:00:00 2001
Message-Id: <621040f56e852c0b95be8aef20878b8a4012b9ee@dist-git>
From: Laine Stump <laine@laine.org>
Date: Thu, 11 Apr 2019 15:14:43 -0400
Subject: [PATCH] test: replace calls to individual detach functions with one
 call to main detach

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@laine.org>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit d3aab99096bb8f81600437682398235c17084d22)

Partially-Resolves: https://bugzilla.redhat.com/1658198
Signed-off-by: Laine Stump <laine@redhat.com>
Signed-off-by: Laine Stump <laine@laine.org>
Message-Id: <20190411191453.24055-32-laine@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/qemuhotplugtest.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index afaf706d27..f27fdbbb09 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -149,16 +149,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.21.0