We want to be able to pass a NULL instead of the connection
and use this function in tests. To achieve this, the virConnectPtr
is passed instead of virDomainPtr, and the driver is a new separate
parameter.
---
src/qemu/qemu_driver.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f9a3b15..9239e14 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7332,16 +7332,16 @@ qemuDomainUndefine(virDomainPtr dom)
static int
qemuDomainAttachDeviceLive(virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- virDomainPtr dom)
+ virConnectPtr conn,
+ virQEMUDriverPtr driver)
{
- virQEMUDriverPtr driver = dom->conn->privateData;
int ret = -1;
const char *alias = NULL;
switch ((virDomainDeviceType) dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, NULL);
- ret = qemuDomainAttachDeviceDiskLive(dom->conn, driver, vm, dev);
+ ret = qemuDomainAttachDeviceDiskLive(conn, driver, vm, dev);
if (!ret) {
alias = dev->data.disk->info.alias;
dev->data.disk = NULL;
@@ -7374,7 +7374,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_HOSTDEV:
qemuDomainObjCheckHostdevTaint(driver, vm, dev->data.hostdev, NULL);
- ret = qemuDomainAttachHostDevice(dom->conn, driver, vm,
+ ret = qemuDomainAttachHostDevice(conn, driver, vm,
dev->data.hostdev);
if (!ret) {
alias = dev->data.hostdev->info->alias;
@@ -8150,7 +8150,8 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom,
VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0)
goto endjob;
- if ((ret = qemuDomainAttachDeviceLive(vm, dev_copy, dom)) < 0)
+ if ((ret = qemuDomainAttachDeviceLive(vm, dev_copy, dom->conn,
+ dom->conn->privateData)) < 0)
goto endjob;
/*
* update domain status forcibly because the domain status may be
--
1.9.1