qemuDomainAttachDiskGeneric: Split up frontend and backend attachment

Split up the monitor contexts to attach the backend of the disk and the
frontend device in preparation for hotplugging transient disks where
we'll need to add the code for adding the transient overlay between
these two steps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2021-05-21 10:34:55 +02:00
parent 17ba0eb458
commit 4f79d7ada6

View File

@ -723,15 +723,22 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
return -1;
}
if (!(devstr = qemuBuildDiskDeviceStr(vm->def, disk, priv->qemuCaps)))
return -1;
qemuDomainObjEnterMonitor(driver, vm);
rc = qemuBlockStorageSourceChainAttach(priv->mon, data);
if (rc == 0 &&
(rc = qemuDomainAttachExtensionDevice(priv->mon, &disk->info)) == 0)
if (qemuDomainObjExitMonitor(driver, vm) < 0)
return -2;
if (rc < 0)
goto rollback;
if (!(devstr = qemuBuildDiskDeviceStr(vm->def, disk, priv->qemuCaps)))
goto rollback;
qemuDomainObjEnterMonitor(driver, vm);
if ((rc = qemuDomainAttachExtensionDevice(priv->mon, &disk->info)) == 0)
extensionDeviceAttached = true;
if (rc == 0)