mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemuBlockReopenFormat: Extract @src handling and monitor invocation
This will simplify testing of the blockdev-reopen code once it's enabled. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
378f2263ba
commit
6f5980ee39
@ -3286,6 +3286,22 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBlockReopenFormatMon(qemuMonitor *mon,
|
||||
virStorageSource *src)
|
||||
{
|
||||
g_autoptr(virJSONValue) reopenprops = NULL;
|
||||
|
||||
if (!(reopenprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockReopenFormat:
|
||||
* @vm: domain object
|
||||
@ -3303,7 +3319,6 @@ qemuBlockReopenFormat(virDomainObj *vm,
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
virQEMUDriver *driver = priv->driver;
|
||||
g_autoptr(virJSONValue) reopenprops = NULL;
|
||||
int rc;
|
||||
|
||||
/* If we are lacking the object here, qemu might have opened an image with
|
||||
@ -3314,13 +3329,10 @@ qemuBlockReopenFormat(virDomainObj *vm,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(reopenprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
|
||||
return -1;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
rc = qemuMonitorBlockdevReopen(priv->mon, &reopenprops);
|
||||
rc = qemuBlockReopenFormatMon(priv->mon, src);
|
||||
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user