mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-28 22:32:19 +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` (cherry picked from commit 1cddf0001f5f1af10791181229148f36fd6d94c5) Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
5443a58d6b
commit
03f19178ce
@ -678,17 +678,9 @@ qemuDomainAttachUSBMassstorageDevice(virConnectPtr conn,
|
||||
}
|
||||
}
|
||||
|
||||
if (virDomainLockDiskAttach(driver->lockManager, cfg->uri,
|
||||
vm, disk) < 0)
|
||||
if (qemuDomainPrepareDisk(driver, vm, disk, NULL, false) < 0)
|
||||
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 */
|
||||
if (!src) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -739,13 +731,7 @@ qemuDomainAttachUSBMassstorageDevice(virConnectPtr conn,
|
||||
return ret;
|
||||
|
||||
error:
|
||||
if (virSecurityManagerRestoreDiskLabel(driver->securityManager,
|
||||
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);
|
||||
|
||||
ignore_value(qemuDomainPrepareDisk(driver, vm, disk, NULL, true));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user