]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: monitor: Add argument for specifying backing name for block commit
authorPeter Krempa <pkrempa@redhat.com>
Tue, 13 May 2014 15:41:33 +0000 (17:41 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 4 Jul 2014 11:00:16 +0000 (13:00 +0200)
To allow changing the name that is recorded in the overlay of the TOP
image used in a block commit operation, we need to specify the backing
name to qemu. This is done via the "backing-file" attribute to the
block-commit command.

src/qemu/qemu_driver.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
tests/qemumonitorjsontest.c

index fcb318808d64381e99ed2b58a31955bdbb028766..ec9b7a69bb738c05d5fb79407278b0771de7397d 100644 (file)
@@ -15600,6 +15600,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
     ret = qemuMonitorBlockCommit(priv->mon, device,
                                  top && !topIndex ? top : topSource->path,
                                  base && !baseIndex ? base : baseSource->path,
+                                 NULL,
                                  bandwidth);
     qemuDomainObjExitMonitor(driver, vm);
 
index 457cecdccb0d967663097eb752fd273a0a478187..08db6cda4c13fee60d8c415dad9fad692e6c2938 100644 (file)
@@ -3231,13 +3231,14 @@ qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
 int
 qemuMonitorBlockCommit(qemuMonitorPtr mon, const char *device,
                        const char *top, const char *base,
+                       const char *backingName,
                        unsigned long bandwidth)
 {
     int ret = -1;
     unsigned long long speed;
 
-    VIR_DEBUG("mon=%p, device=%s, top=%s, base=%s, bandwidth=%ld",
-              mon, device, top, base, bandwidth);
+    VIR_DEBUG("mon=%p, device=%s, top=%s, base=%s, backingName=%s, bandwidth=%lu",
+              mon, device, top, base, NULLSTR(backingName), bandwidth);
 
     /* Convert bandwidth MiB to bytes - unfortunately the JSON QMP protocol is
      * limited to LLONG_MAX also for unsigned values */
@@ -3251,7 +3252,8 @@ qemuMonitorBlockCommit(qemuMonitorPtr mon, const char *device,
     speed <<= 20;
 
     if (mon->json)
-        ret = qemuMonitorJSONBlockCommit(mon, device, top, base, speed);
+        ret = qemuMonitorJSONBlockCommit(mon, device, top, base,
+                                         backingName, speed);
     else
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("block-commit requires JSON monitor"));
@@ -3266,7 +3268,7 @@ qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon)
     if (!mon->json)
         return false;
 
-    return qemuMonitorJSONBlockCommit(mon, "bogus", NULL, NULL, 0) == -2;
+    return qemuMonitorJSONBlockCommit(mon, "bogus", NULL, NULL, NULL, 0) == -2;
 }
 
 
index 63e78d8e4426bbc0436c2cba39ba59279f96f020..4652ea5e75183caf21f6c64c549712b9bc1e8ed7 100644 (file)
@@ -662,6 +662,7 @@ int qemuMonitorBlockCommit(qemuMonitorPtr mon,
                            const char *device,
                            const char *top,
                            const char *base,
+                           const char *backingName,
                            unsigned long bandwidth)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_NONNULL(4);
index b5e8a20ef50b2e50dd4210e7ad478c14c8510018..7af5b79e1cb929d02cc5806d27ba014a0d12baf8 100644 (file)
@@ -3465,6 +3465,7 @@ qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
 int
 qemuMonitorJSONBlockCommit(qemuMonitorPtr mon, const char *device,
                            const char *top, const char *base,
+                           const char *backingName,
                            unsigned long long speed)
 {
     int ret = -1;
@@ -3476,6 +3477,7 @@ qemuMonitorJSONBlockCommit(qemuMonitorPtr mon, const char *device,
                                      "U:speed", speed,
                                      "S:top", top,
                                      "S:base", base,
+                                     "S:backing-file", backingName,
                                      NULL);
     if (!cmd)
         return -1;
index 89e668cd7b3cefc78b77528fd3437cd643cd14dd..652a4b65e4599dd2b4a2bd1b991087aa44e187ed 100644 (file)
@@ -261,6 +261,7 @@ int qemuMonitorJSONBlockCommit(qemuMonitorPtr mon,
                                const char *device,
                                const char *top,
                                const char *base,
+                               const char *backingName,
                                unsigned long long bandwidth)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
index d136576ffc023df8886c5d78c49fdf482c361229..6debe13d50e7bfa9845ba03c4b7cd956bf180c53 100644 (file)
@@ -1164,7 +1164,7 @@ GEN_TEST_FUNC(qemuMonitorJSONAddDevice, "some_dummy_devicestr")
 GEN_TEST_FUNC(qemuMonitorJSONSetDrivePassphrase, "vda", "secret_passhprase")
 GEN_TEST_FUNC(qemuMonitorJSONDriveMirror, "vdb", "/foo/bar", NULL, 1024,
               VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)
-GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "/foo/bar1", "/foo/bar2", 1024)
+GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "/foo/bar1", "/foo/bar2", NULL, 1024)
 GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb", NULL, NULL)
 GEN_TEST_FUNC(qemuMonitorJSONScreendump, "/foo/bar")
 GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false)