Allow referring to individual node name to rezise.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_monitor.c | 12 ++++++++++--
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 4 +++-
src/qemu/qemu_monitor_json.h | 3 ++-
tests/qemumonitorjsontest.c | 2 +-
6 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 15ec4931eb..9ee8d33f8d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11005,7 +11005,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;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 758942ffcb..4dcbd69dce 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 60418422e9..f8f6969ddb 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -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);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e43447dc53..de3fcd83d8 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 4d75e04183..19aebef5fb 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -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,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index fd54031e40..b048c40d7d 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -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")
--
2.16.2