mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Fix hotplugging of block device-backed usb disks
Commit ca91ba7 moved qemuSetupDiskCgroup into the qemuDomainPrepareDisk helper, but failed to call it for usb disks. https://bugzilla.redhat.com/show_bug.cgi?id=1175668`
This commit is contained in:
parent
531aef2e1b
commit
1cddf0001f
@ -679,17 +679,9 @@ qemuDomainAttachUSBMassstorageDevice(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainLockDiskAttach(driver->lockManager, cfg->uri,
|
if (qemuDomainPrepareDisk(driver, vm, disk, NULL, false) < 0)
|
||||||
vm, disk) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virSecurityManagerSetDiskLabel(driver->securityManager,
|
|
||||||
vm->def, disk) < 0) {
|
|
||||||
if (virDomainLockDiskDetach(driver->lockManager, vm, disk) < 0)
|
|
||||||
VIR_WARN("Unable to release lock on %s", src);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX not correct once we allow attaching a USB CDROM */
|
/* XXX not correct once we allow attaching a USB CDROM */
|
||||||
if (!src) {
|
if (!src) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -740,13 +732,7 @@ qemuDomainAttachUSBMassstorageDevice(virConnectPtr conn,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (virSecurityManagerRestoreDiskLabel(driver->securityManager,
|
ignore_value(qemuDomainPrepareDisk(driver, vm, disk, NULL, true));
|
||||||
vm->def, disk) < 0)
|
|
||||||
VIR_WARN("Unable to restore security label on %s", src);
|
|
||||||
|
|
||||||
if (virDomainLockDiskDetach(driver->lockManager, vm, disk) < 0)
|
|
||||||
VIR_WARN("Unable to release lock on %s", src);
|
|
||||||
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user