]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: monitor: Add 'nodename' argument for 'block_resize'
authorPeter Krempa <pkrempa@redhat.com>
Tue, 7 Aug 2018 07:31:04 +0000 (09:31 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 21 Aug 2018 13:46:06 +0000 (15:46 +0200)
Allow referring to individual node name to resize.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
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 469c6539d4f424e042389f6f6d91581e22ae5253..5936a9fa3cdb65290184dabc61173825eb8a1d1a 100644 (file)
@@ -10989,7 +10989,7 @@ qemuDomainBlockResize(virDomainPtr dom,
         goto endjob;
 
     qemuDomainObjEnterMonitor(driver, vm);
-    if (qemuMonitorBlockResize(priv->mon, device, size) < 0) {
+    if (qemuMonitorBlockResize(priv->mon, device, NULL, size) < 0) {
         ignore_value(qemuDomainObjExitMonitor(driver, vm));
         goto endjob;
     }
index 758942ffcbeea6ba9025b24886b594ab86b88dd3..4dcbd69dce060546037ef35d3f79e4cc013ffb68 100644 (file)
@@ -2312,13 +2312,21 @@ qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
 int
 qemuMonitorBlockResize(qemuMonitorPtr mon,
                        const char *device,
+                       const char *nodename,
                        unsigned long long size)
 {
-    VIR_DEBUG("device=%s size=%llu", device, size);
+    VIR_DEBUG("device=%s nodename=%s size=%llu",
+              NULLSTR(device), NULLSTR(nodename), size);
 
     QEMU_CHECK_MONITOR(mon);
 
-    return qemuMonitorJSONBlockResize(mon, device, size);
+    if ((!device && !nodename) || (device && nodename)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("exactly one of 'device' and 'nodename' need to be specified"));
+        return -1;
+    }
+
+    return qemuMonitorJSONBlockResize(mon, device, nodename, size);
 }
 
 
index 60418422e970de79a2abeb46e1eb22397d43256e..f8f6969ddb021237d3f1a6b75587461aa25e2968 100644 (file)
@@ -596,7 +596,8 @@ int qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
     ATTRIBUTE_NONNULL(2);
 
 int qemuMonitorBlockResize(qemuMonitorPtr mon,
-                           const char *dev_name,
+                           const char *device,
+                           const char *nodename,
                            unsigned long long size);
 int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
                               const char *password);
index bdbe003d32ed8c67b8431bf1193c43692245b388..308376ca4f861bb7db8d40beefc64ab7c5da980d 100644 (file)
@@ -2542,6 +2542,7 @@ qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitorPtr mon,
 
 int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
                                const char *device,
+                               const char *nodename,
                                unsigned long long size)
 {
     int ret = -1;
@@ -2549,7 +2550,8 @@ int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
     virJSONValuePtr reply = NULL;
 
     cmd = qemuMonitorJSONMakeCommand("block_resize",
-                                     "s:device", device,
+                                     "S:device", device,
+                                     "S:node-name", nodename,
                                      "U:size", size,
                                      NULL);
     if (!cmd)
index 4d75e0418322117460c13d6b5a4d4b90139287f0..19aebef5fb1530d73c5da58f550390a989bc76d2 100644 (file)
@@ -94,7 +94,8 @@ int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitorPtr mon,
                                             virHashTablePtr stats,
                                             bool backingChain);
 int qemuMonitorJSONBlockResize(qemuMonitorPtr mon,
-                               const char *devce,
+                               const char *device,
+                               const char *nodename,
                                unsigned long long size);
 
 int qemuMonitorJSONSetVNCPassword(qemuMonitorPtr mon,
index 35d24cfb2294f17558a62cb8af1be405bc0614b4..3da4d3076a94dcd95f854512f4ed0c068e49af89 100644 (file)
@@ -1320,7 +1320,7 @@ cleanup: \
 }
 
 GEN_TEST_FUNC(qemuMonitorJSONSetLink, "vnet0", VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN)
-GEN_TEST_FUNC(qemuMonitorJSONBlockResize, "vda", 123456)
+GEN_TEST_FUNC(qemuMonitorJSONBlockResize, "vda", "asdf", 123456)
 GEN_TEST_FUNC(qemuMonitorJSONSetVNCPassword, "secret_password")
 GEN_TEST_FUNC(qemuMonitorJSONSetPassword, "spice", "secret_password", "disconnect")
 GEN_TEST_FUNC(qemuMonitorJSONExpirePassword, "spice", "123456")