mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: restore non-pci hostdev labels after detach
Commit 409de00 changed the logic to only match PCI devices while moving this before Remove*HostDevice calls. https://bugzilla.redhat.com/show_bug.cgi?id=1342874
This commit is contained in:
parent
d41d18bcdc
commit
22d262c9b0
@ -2952,10 +2952,16 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
char *drivestr = NULL;
|
char *drivestr = NULL;
|
||||||
|
bool is_vfio = false;
|
||||||
|
|
||||||
VIR_DEBUG("Removing host device %s from domain %p %s",
|
VIR_DEBUG("Removing host device %s from domain %p %s",
|
||||||
hostdev->info->alias, vm, vm->def->name);
|
hostdev->info->alias, vm, vm->def->name);
|
||||||
|
|
||||||
|
if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
||||||
|
int backend = hostdev->source.subsys.u.pci.backend;
|
||||||
|
is_vfio = backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
|
||||||
|
}
|
||||||
|
|
||||||
if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
|
if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
|
||||||
/* build the actual drive id string as generated during
|
/* build the actual drive id string as generated during
|
||||||
* qemuBuildSCSIHostdevDrvStr that is passed to qemu */
|
* qemuBuildSCSIHostdevDrvStr that is passed to qemu */
|
||||||
@ -2993,13 +2999,10 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virDomainAuditHostdev(vm, hostdev, "detach", true);
|
virDomainAuditHostdev(vm, hostdev, "detach", true);
|
||||||
|
|
||||||
if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
if (!is_vfio &&
|
||||||
hostdev->source.subsys.u.pci.backend !=
|
virSecurityManagerRestoreHostdevLabel(driver->securityManager,
|
||||||
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
|
vm->def, hostdev, NULL) < 0)
|
||||||
if (virSecurityManagerRestoreHostdevLabel(driver->securityManager,
|
VIR_WARN("Failed to restore host device labelling");
|
||||||
vm->def, hostdev, NULL) < 0)
|
|
||||||
VIR_WARN("Failed to restore host device labelling");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuTeardownHostdevCgroup(vm, hostdev) < 0)
|
if (qemuTeardownHostdevCgroup(vm, hostdev) < 0)
|
||||||
VIR_WARN("Failed to remove host device cgroup ACL");
|
VIR_WARN("Failed to remove host device cgroup ACL");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user