In certain cases, we need to assign a hostdevN-style alias in a case when we don't have a virDomainHostdevDefPtr (instead we have a virDomainNetDefPtr). Since qemuAssignDeviceHostdevAlias() doesn't use anything in the virDomainHostdevDef except the alias string itself anyway, this patch just changes the arguments to pass a pointer to the alias pointer instead. --- src/qemu/qemu_alias.c | 6 +++--- src/qemu/qemu_alias.h | 2 +- src/qemu/qemu_hotplug.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 9691223..fc0653c 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -288,7 +288,7 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef, int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, - virDomainHostdevDefPtr hostdev, + char **alias, int idx) { if (idx == -1) { @@ -306,7 +306,7 @@ qemuAssignDeviceHostdevAlias(virDomainDefPtr def, } } - if (virAsprintf(&hostdev->info->alias, "hostdev%d", idx) < 0) + if (virAsprintf(alias, "hostdev%d", idx) < 0) return -1; return 0; @@ -414,7 +414,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) return -1; } for (i = 0; i < def->nhostdevs; i++) { - if (qemuAssignDeviceHostdevAlias(def, def->hostdevs[i], i) < 0) + if (qemuAssignDeviceHostdevAlias(def, &def->hostdevs[i]->info->alias, i) < 0) return -1; } for (i = 0; i < def->nredirdevs; i++) { diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h index 714a526..b915f73 100644 --- a/src/qemu/qemu_alias.h +++ b/src/qemu/qemu_alias.h @@ -43,7 +43,7 @@ int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef, virQEMUCapsPtr qemuCaps); int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, - virDomainHostdevDefPtr hostdev, + char **alias, int idx); int qemuAssignDeviceNetAlias(virDomainDefPtr def, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 14b6987..9fdf66a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1,7 +1,7 @@ /* * qemu_hotplug.c: QEMU device hotplug management * - * Copyright (C) 2006-2015 Red Hat, Inc. + * Copyright (C) 2006-2016 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -1260,7 +1260,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, teardownlabel = true; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0) + if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) < 0) goto error; if (virDomainPCIAddressEnsureAddr(priv->pciaddrs, hostdev->info) < 0) goto error; @@ -1871,7 +1871,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver, teardownlabel = true; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0) + if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) < 0) goto cleanup; if (!(devstr = qemuBuildUSBHostdevDevStr(vm->def, hostdev, priv->qemuCaps))) goto cleanup; @@ -1965,7 +1965,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, goto cleanup; teardownlabel = true; - if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0) + if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) < 0) goto cleanup; if (!(drvstr = qemuBuildSCSIHostdevDrvStr(conn, hostdev, priv->qemuCaps, @@ -3820,7 +3820,7 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver, if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && !detach->info->alias) { - if (qemuAssignDeviceHostdevAlias(vm->def, detach, -1) < 0) + if (qemuAssignDeviceHostdevAlias(vm->def, &detach->info->alias, -1) < 0) return -1; } -- 2.5.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list