mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Always use 'alias' in warning message when removing USB address
Avoid the extra parameter passing in the disk 'dst' parameter to be reported instead of the device alias. Using 'dst' instead of alias does not add much value. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
dbd15d6c45
commit
3c0b1cfdf6
@ -3255,21 +3255,17 @@ qemuDomainEnsurePCIAddress(virDomainObjPtr obj,
|
|||||||
|
|
||||||
void
|
void
|
||||||
qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
|
qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
|
||||||
virDomainDeviceInfoPtr info,
|
virDomainDeviceInfoPtr info)
|
||||||
const char *devstr)
|
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
|
||||||
if (!devstr)
|
|
||||||
devstr = info->alias;
|
|
||||||
|
|
||||||
if (virDeviceInfoPCIAddressIsPresent(info)) {
|
if (virDeviceInfoPCIAddressIsPresent(info)) {
|
||||||
virDomainPCIAddressReleaseAddr(priv->pciaddrs, &info->addr.pci);
|
virDomainPCIAddressReleaseAddr(priv->pciaddrs, &info->addr.pci);
|
||||||
virDomainPCIAddressExtensionReleaseAddr(priv->pciaddrs, &info->addr.pci);
|
virDomainPCIAddressExtensionReleaseAddr(priv->pciaddrs, &info->addr.pci);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainUSBAddressRelease(priv->usbaddrs, info) < 0)
|
if (virDomainUSBAddressRelease(priv->usbaddrs, info) < 0)
|
||||||
VIR_WARN("Unable to release USB address on %s", NULLSTR(devstr));
|
VIR_WARN("Unable to release USB address on %s", NULLSTR(info->alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,8 +55,7 @@ int qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
void qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
|
void qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
|
||||||
virDomainDeviceInfoPtr info,
|
virDomainDeviceInfoPtr info);
|
||||||
const char *devstr);
|
|
||||||
|
|
||||||
int qemuDomainAssignMemoryDeviceSlot(virDomainDefPtr def,
|
int qemuDomainAssignMemoryDeviceSlot(virDomainDefPtr def,
|
||||||
virDomainMemoryDefPtr mem);
|
virDomainMemoryDefPtr mem);
|
||||||
|
@ -1020,7 +1020,7 @@ qemuDomainAttachVirtioDiskDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
if ((rv = qemuDomainAttachDiskGeneric(driver, vm, disk)) < 0) {
|
if ((rv = qemuDomainAttachDiskGeneric(driver, vm, disk)) < 0) {
|
||||||
if (rv == -1 && releaseaddr)
|
if (rv == -1 && releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &disk->info, disk->dst);
|
qemuDomainReleaseDeviceAddress(vm, &disk->info);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1100,7 +1100,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (ret != 0 && releaseaddr)
|
if (ret != 0 && releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &controller->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &controller->info);
|
||||||
|
|
||||||
VIR_FREE(devstr);
|
VIR_FREE(devstr);
|
||||||
return ret;
|
return ret;
|
||||||
@ -1666,7 +1666,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
vm->def->nets[vm->def->nnets++] = net;
|
vm->def->nets[vm->def->nnets++] = net;
|
||||||
} else {
|
} else {
|
||||||
if (releaseaddr)
|
if (releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &net->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &net->info);
|
||||||
|
|
||||||
if (iface_connected) {
|
if (iface_connected) {
|
||||||
virErrorPreserveLast(&originalError);
|
virErrorPreserveLast(&originalError);
|
||||||
@ -1883,7 +1883,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
|
|||||||
VIR_WARN("Unable to remove host device from /dev");
|
VIR_WARN("Unable to remove host device from /dev");
|
||||||
|
|
||||||
if (releaseaddr)
|
if (releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, info);
|
||||||
|
|
||||||
qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1);
|
qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1);
|
||||||
|
|
||||||
@ -2160,7 +2160,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
|
|||||||
virDomainAuditRedirdev(vm, redirdev, "attach", ret == 0);
|
virDomainAuditRedirdev(vm, redirdev, "attach", ret == 0);
|
||||||
cleanup:
|
cleanup:
|
||||||
if (ret < 0 && need_release)
|
if (ret < 0 && need_release)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &redirdev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &redirdev->info);
|
||||||
VIR_FREE(tlsAlias);
|
VIR_FREE(tlsAlias);
|
||||||
VIR_FREE(charAlias);
|
VIR_FREE(charAlias);
|
||||||
VIR_FREE(devstr);
|
VIR_FREE(devstr);
|
||||||
@ -2427,7 +2427,7 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
|
|||||||
if (virDomainObjIsActive(vm))
|
if (virDomainObjIsActive(vm))
|
||||||
qemuDomainChrInsertPreAllocCleanup(vmdef, chr);
|
qemuDomainChrInsertPreAllocCleanup(vmdef, chr);
|
||||||
if (need_release)
|
if (need_release)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &chr->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &chr->info);
|
||||||
if (teardowncgroup && qemuTeardownChardevCgroup(vm, chr) < 0)
|
if (teardowncgroup && qemuTeardownChardevCgroup(vm, chr) < 0)
|
||||||
VIR_WARN("Unable to remove chr device cgroup ACL on hotplug fail");
|
VIR_WARN("Unable to remove chr device cgroup ACL on hotplug fail");
|
||||||
if (teardownlabel && qemuSecurityRestoreChardevLabel(driver, vm, chr) < 0)
|
if (teardownlabel && qemuSecurityRestoreChardevLabel(driver, vm, chr) < 0)
|
||||||
@ -2544,7 +2544,7 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,
|
|||||||
virJSONValueFree(props);
|
virJSONValueFree(props);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (releaseaddr)
|
if (releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &rng->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &rng->info);
|
||||||
if (teardowncgroup && qemuTeardownRNGCgroup(vm, rng) < 0)
|
if (teardowncgroup && qemuTeardownRNGCgroup(vm, rng) < 0)
|
||||||
VIR_WARN("Unable to remove RNG device cgroup ACL on hotplug fail");
|
VIR_WARN("Unable to remove RNG device cgroup ACL on hotplug fail");
|
||||||
if (teardowndevice && qemuDomainNamespaceTeardownRNG(vm, rng) < 0)
|
if (teardowndevice && qemuDomainNamespaceTeardownRNG(vm, rng) < 0)
|
||||||
@ -3038,7 +3038,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
|
|||||||
qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
|
qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
|
||||||
VIR_WARN("Unable to remove host device from /dev");
|
VIR_WARN("Unable to remove host device from /dev");
|
||||||
if (releaseaddr)
|
if (releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, hostdev->info);
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainCCWAddressSetFree(ccwaddrs);
|
virDomainCCWAddressSetFree(ccwaddrs);
|
||||||
@ -3132,7 +3132,7 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
|
|||||||
vm->def->name,
|
vm->def->name,
|
||||||
&hostdev,
|
&hostdev,
|
||||||
1);
|
1);
|
||||||
qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, hostdev->info);
|
||||||
}
|
}
|
||||||
VIR_FREE(devstr);
|
VIR_FREE(devstr);
|
||||||
return ret;
|
return ret;
|
||||||
@ -3287,7 +3287,7 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (release_address)
|
if (release_address)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &shmem->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &shmem->info);
|
||||||
|
|
||||||
virJSONValueFree(props);
|
virJSONValueFree(props);
|
||||||
VIR_FREE(memAlias);
|
VIR_FREE(memAlias);
|
||||||
@ -3380,7 +3380,7 @@ qemuDomainAttachWatchdog(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (releaseAddress)
|
if (releaseAddress)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &watchdog->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &watchdog->info);
|
||||||
VIR_FREE(watchdogstr);
|
VIR_FREE(watchdogstr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -3472,7 +3472,7 @@ qemuDomainAttachInputDevice(virQEMUDriverPtr driver,
|
|||||||
if (teardowndevice)
|
if (teardowndevice)
|
||||||
qemuDomainNamespaceTeardownInput(vm, input);
|
qemuDomainNamespaceTeardownInput(vm, input);
|
||||||
if (releaseaddr)
|
if (releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &input->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &input->info);
|
||||||
virErrorRestore(&originalError);
|
virErrorRestore(&originalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3548,7 +3548,7 @@ qemuDomainAttachVsockDevice(virQEMUDriverPtr driver,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virErrorPreserveLast(&originalError);
|
virErrorPreserveLast(&originalError);
|
||||||
if (releaseaddr)
|
if (releaseaddr)
|
||||||
qemuDomainReleaseDeviceAddress(vm, &vsock->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &vsock->info);
|
||||||
virErrorRestore(&originalError);
|
virErrorRestore(&originalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4508,7 +4508,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virDomainAuditDisk(vm, disk->src, NULL, "detach", true);
|
virDomainAuditDisk(vm, disk->src, NULL, "detach", true);
|
||||||
|
|
||||||
qemuDomainReleaseDeviceAddress(vm, &disk->info, virDomainDiskGetSource(disk));
|
qemuDomainReleaseDeviceAddress(vm, &disk->info);
|
||||||
|
|
||||||
/* tear down disk security access */
|
/* tear down disk security access */
|
||||||
qemuHotplugPrepareDiskSourceAccess(driver, vm, disk->src, true);
|
qemuHotplugPrepareDiskSourceAccess(driver, vm, disk->src, true);
|
||||||
@ -4545,7 +4545,7 @@ qemuDomainRemoveControllerDevice(virDomainObjPtr vm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuDomainReleaseDeviceAddress(vm, &controller->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &controller->info);
|
||||||
virDomainControllerDefFree(controller);
|
virDomainControllerDefFree(controller);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4613,7 +4613,7 @@ qemuDomainRemovePCIHostDevice(virQEMUDriverPtr driver,
|
|||||||
virDomainHostdevDefPtr hostdev)
|
virDomainHostdevDefPtr hostdev)
|
||||||
{
|
{
|
||||||
qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1);
|
qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1);
|
||||||
qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, hostdev->info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4622,7 +4622,7 @@ qemuDomainRemoveUSBHostDevice(virQEMUDriverPtr driver,
|
|||||||
virDomainHostdevDefPtr hostdev)
|
virDomainHostdevDefPtr hostdev)
|
||||||
{
|
{
|
||||||
qemuHostdevReAttachUSBDevices(driver, vm->def->name, &hostdev, 1);
|
qemuHostdevReAttachUSBDevices(driver, vm->def->name, &hostdev, 1);
|
||||||
qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, hostdev->info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4648,7 +4648,7 @@ qemuDomainRemoveMediatedDevice(virQEMUDriverPtr driver,
|
|||||||
virDomainHostdevDefPtr hostdev)
|
virDomainHostdevDefPtr hostdev)
|
||||||
{
|
{
|
||||||
qemuHostdevReAttachMediatedDevices(driver, vm->def->name, &hostdev, 1);
|
qemuHostdevReAttachMediatedDevices(driver, vm->def->name, &hostdev, 1);
|
||||||
qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, hostdev->info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4842,7 +4842,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuDomainReleaseDeviceAddress(vm, &net->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &net->info);
|
||||||
virDomainConfNWFilterTeardown(net);
|
virDomainConfNWFilterTeardown(net);
|
||||||
|
|
||||||
if (cfg->macFilter && (net->ifname != NULL)) {
|
if (cfg->macFilter && (net->ifname != NULL)) {
|
||||||
@ -4917,7 +4917,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
|
|||||||
if (qemuDomainNamespaceTeardownChardev(vm, chr) < 0)
|
if (qemuDomainNamespaceTeardownChardev(vm, chr) < 0)
|
||||||
VIR_WARN("Unable to remove chr device from /dev");
|
VIR_WARN("Unable to remove chr device from /dev");
|
||||||
|
|
||||||
qemuDomainReleaseDeviceAddress(vm, &chr->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &chr->info);
|
||||||
qemuDomainChrRemove(vm->def, chr);
|
qemuDomainChrRemove(vm->def, chr);
|
||||||
|
|
||||||
/* The caller does not emit the event, so we must do it here. Note
|
/* The caller does not emit the event, so we must do it here. Note
|
||||||
@ -4991,7 +4991,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
if ((idx = virDomainRNGFind(vm->def, rng)) >= 0)
|
if ((idx = virDomainRNGFind(vm->def, rng)) >= 0)
|
||||||
virDomainRNGRemove(vm->def, idx);
|
virDomainRNGRemove(vm->def, idx);
|
||||||
qemuDomainReleaseDeviceAddress(vm, &rng->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &rng->info);
|
||||||
virDomainRNGDefFree(rng);
|
virDomainRNGDefFree(rng);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -5042,7 +5042,7 @@ qemuDomainRemoveShmemDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
if ((idx = virDomainShmemDefFind(vm->def, shmem)) >= 0)
|
if ((idx = virDomainShmemDefFind(vm->def, shmem)) >= 0)
|
||||||
virDomainShmemDefRemove(vm->def, idx);
|
virDomainShmemDefRemove(vm->def, idx);
|
||||||
qemuDomainReleaseDeviceAddress(vm, &shmem->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &shmem->info);
|
||||||
virDomainShmemDefFree(shmem);
|
virDomainShmemDefFree(shmem);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -5061,7 +5061,7 @@ qemuDomainRemoveWatchdog(virDomainObjPtr vm,
|
|||||||
VIR_DEBUG("Removing watchdog %s from domain %p %s",
|
VIR_DEBUG("Removing watchdog %s from domain %p %s",
|
||||||
watchdog->info.alias, vm, vm->def->name);
|
watchdog->info.alias, vm, vm->def->name);
|
||||||
|
|
||||||
qemuDomainReleaseDeviceAddress(vm, &watchdog->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &watchdog->info);
|
||||||
virDomainWatchdogDefFree(vm->def->watchdog);
|
virDomainWatchdogDefFree(vm->def->watchdog);
|
||||||
vm->def->watchdog = NULL;
|
vm->def->watchdog = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@ -5081,7 +5081,7 @@ qemuDomainRemoveInputDevice(virDomainObjPtr vm,
|
|||||||
if (vm->def->inputs[i] == dev)
|
if (vm->def->inputs[i] == dev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qemuDomainReleaseDeviceAddress(vm, &dev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &dev->info);
|
||||||
if (qemuSecurityRestoreInputLabel(vm, dev) < 0)
|
if (qemuSecurityRestoreInputLabel(vm, dev) < 0)
|
||||||
VIR_WARN("Unable to restore security label on input device");
|
VIR_WARN("Unable to restore security label on input device");
|
||||||
|
|
||||||
@ -5104,7 +5104,7 @@ qemuDomainRemoveVsockDevice(virDomainObjPtr vm,
|
|||||||
VIR_DEBUG("Removing vsock device %s from domain %p %s",
|
VIR_DEBUG("Removing vsock device %s from domain %p %s",
|
||||||
dev->info.alias, vm, vm->def->name);
|
dev->info.alias, vm, vm->def->name);
|
||||||
|
|
||||||
qemuDomainReleaseDeviceAddress(vm, &dev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &dev->info);
|
||||||
virDomainVsockDefFree(vm->def->vsock);
|
virDomainVsockDefFree(vm->def->vsock);
|
||||||
vm->def->vsock = NULL;
|
vm->def->vsock = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@ -5143,7 +5143,7 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
if ((idx = virDomainRedirdevDefFind(vm->def, dev)) >= 0)
|
if ((idx = virDomainRedirdevDefFind(vm->def, dev)) >= 0)
|
||||||
virDomainRedirdevDefRemove(vm->def, idx);
|
virDomainRedirdevDefRemove(vm->def, idx);
|
||||||
qemuDomainReleaseDeviceAddress(vm, &dev->info, NULL);
|
qemuDomainReleaseDeviceAddress(vm, &dev->info);
|
||||||
virDomainRedirdevDefFree(dev);
|
virDomainRedirdevDefFree(dev);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user