mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: change args to qemuAssignDeviceHostdevAlias()
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.
This commit is contained in:
parent
3992ff14e5
commit
f09c7139b0
@ -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++) {
|
||||
|
@ -43,7 +43,7 @@ int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
|
||||
virQEMUCapsPtr qemuCaps);
|
||||
|
||||
int qemuAssignDeviceHostdevAlias(virDomainDefPtr def,
|
||||
virDomainHostdevDefPtr hostdev,
|
||||
char **alias,
|
||||
int idx);
|
||||
|
||||
int qemuAssignDeviceNetAlias(virDomainDefPtr def,
|
||||
|
@ -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,
|
||||
@ -3822,7 +3822,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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user