Check for !dev->info.alias was done after a VIR_DEBUG() statement that already tried to print - just flip sequence Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/qemu/qemu_hotplug.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index cf1e4dc..d158a73 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1887,14 +1887,14 @@ int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver, int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; - VIR_DEBUG("dev: %s, state: %d", dev->info.alias, linkstate); - if (!dev->info.alias) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("can't change link state: device alias not found")); return -1; } + VIR_DEBUG("dev: %s, state: %d", dev->info.alias, linkstate); + qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSetLink(priv->mon, dev->info.alias, linkstate); @@ -3323,8 +3323,7 @@ qemuDomainDetachHostUSBDevice(virQEMUDriverPtr driver, } static int -qemuDomainDetachHostSCSIDevice(virConnectPtr conn ATTRIBUTE_UNUSED, - virQEMUDriverPtr driver, +qemuDomainDetachHostSCSIDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr detach) { @@ -3358,8 +3357,7 @@ qemuDomainDetachHostSCSIDevice(virConnectPtr conn ATTRIBUTE_UNUSED, } static int -qemuDomainDetachThisHostDevice(virConnectPtr conn, - virQEMUDriverPtr driver, +qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr detach) { @@ -3373,7 +3371,7 @@ qemuDomainDetachThisHostDevice(virConnectPtr conn, ret = qemuDomainDetachHostUSBDevice(driver, vm, detach); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: - ret = qemuDomainDetachHostSCSIDevice(conn, driver, vm, detach); + ret = qemuDomainDetachHostSCSIDevice(driver, vm, detach); break; default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -3396,8 +3394,7 @@ qemuDomainDetachThisHostDevice(virConnectPtr conn, } /* search for a hostdev matching dev and detach it */ -int qemuDomainDetachHostDevice(virConnectPtr conn, - virQEMUDriverPtr driver, +int qemuDomainDetachHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainDeviceDefPtr dev) { @@ -3466,14 +3463,13 @@ int qemuDomainDetachHostDevice(virConnectPtr conn, * function so that mac address / virtualport are reset */ if (detach->parent.type == VIR_DOMAIN_DEVICE_NET) - return qemuDomainDetachNetDevice(conn, driver, vm, &detach->parent); + return qemuDomainDetachNetDevice(driver, vm, &detach->parent); else - return qemuDomainDetachThisHostDevice(conn, driver, vm, detach); + return qemuDomainDetachThisHostDevice(driver, vm, detach); } int -qemuDomainDetachNetDevice(virConnectPtr conn, - virQEMUDriverPtr driver, +qemuDomainDetachNetDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainDeviceDefPtr dev) { @@ -3489,7 +3485,7 @@ qemuDomainDetachNetDevice(virConnectPtr conn, if (virDomainNetGetActualType(detach) == VIR_DOMAIN_NET_TYPE_HOSTDEV) { /* coverity[negative_returns] */ - ret = qemuDomainDetachThisHostDevice(conn, driver, vm, + ret = qemuDomainDetachThisHostDevice(driver, vm, virDomainNetGetActualHostdev(detach)); goto cleanup; } -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list