Now that we are able to select images from the backing chain via indexed
access we should also convert possible network sources to
qemu-compatible strings before passing them to qemu.
---
src/qemu/qemu_driver.c | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0f35123..338ec05 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15496,11 +15496,14 @@ qemuDomainBlockCommit(virDomainPtr dom,
const char *top_parent = NULL;
bool clean_access = false;
virStorageSourcePtr mirror = NULL;
-
+ char *topPath = NULL;
+ char *basePath = NULL;
+ char *backingPath = NULL;
/* XXX Add support for COMMIT_DELETE */
virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW |
- VIR_DOMAIN_BLOCK_COMMIT_ACTIVE, -1);
+ VIR_DOMAIN_BLOCK_COMMIT_ACTIVE |
+ VIR_DOMAIN_BLOCK_COMMIT_RELATIVE, -1);
if (!(vm = qemuDomObjFromDomain(dom)))
goto cleanup;
@@ -15630,6 +15633,31 @@ qemuDomainBlockCommit(virDomainPtr dom,
mirror->format = baseSource->format;
}
+ if (qemuGetDriveSourceString(topSource, NULL, &topPath) < 0)
+ goto endjob;
+
+ if (qemuGetDriveSourceString(baseSource, NULL, &basePath) < 0)
+ goto endjob;
+
+ if (flags & VIR_DOMAIN_BLOCK_COMMIT_RELATIVE &&
+ topSource != disk->src) {
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHANGE_BACKING_FILE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("this qemu doesn't support relative
blockpull"));
+ goto endjob;
+ }
+
+ if (virStorageFileGetRelativeBackingPath(topSource, baseSource,
+ &backingPath) < 0)
+ goto endjob;
+
+ if (!backingPath) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Can't keep relative backing
relationship."));
+ goto endjob;
+ }
+ }
+
/* Start the commit operation. Pass the user's original spelling,
* if any, through to qemu, since qemu may behave differently
* depending on whether the input was specified as relative or
@@ -15637,9 +15665,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
* thing if the user specified a relative name). */
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorBlockCommit(priv->mon, device,
- top && !topIndex ? top : topSource->path,
- base && !baseIndex ? base :
baseSource->path,
- NULL,
+ topPath, basePath, backingPath,
bandwidth);
qemuDomainObjExitMonitor(driver, vm);
@@ -15664,6 +15690,9 @@ qemuDomainBlockCommit(virDomainPtr dom,
vm = NULL;
cleanup:
+ VIR_FREE(topPath);
+ VIR_FREE(basePath);
+ VIR_FREE(backingPath);
VIR_FREE(device);
if (vm)
virObjectUnlock(vm);
--
1.9.3