qemu: monitor: Add 'nodename' argument for 'block_resize'

Allow referring to individual node name to resize.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-08-07 09:31:04 +02:00
parent 343969bac3
commit 5be8c8e13b
6 changed files with 19 additions and 7 deletions

View 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;
}

View 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);
}

View 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);

View 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)

View 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,

View 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")