Change parameters to qemuDomainAttachDeviceLive

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.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Tomasz Flendrich 2016-07-16 02:42:46 +02:00 committed by Martin Kletzander
parent ed8f236491
commit d259e825bc

View File

@ -7327,16 +7327,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;
@ -7369,7 +7369,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;
@ -8151,7 +8151,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,
driver)) < 0)
goto endjob;
/*
* update domain status forcibly because the domain status may be