aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit@irqsave.net>2014-01-23 21:31:37 +0100
committerKevin Wolf <kwolf@redhat.com>2014-01-24 16:07:08 +0100
commit3b1dbd11a60d75e99af5fc9b73c34f4af9d4f510 (patch)
treea8758efe34e6caaa3dc29cd38cec46e45418c20c /blockdev.c
parent212a5a8f095de9a1624de6b4a589d60688b02747 (diff)
qmp: Allow block_resize to manipulate bs graph nodes.
Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/blockdev.c b/blockdev.c
index 32a356eadc..d192370f9c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1683,14 +1683,24 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
return 0;
}
-void qmp_block_resize(const char *device, int64_t size, Error **errp)
+void qmp_block_resize(bool has_device, const char *device,
+ bool has_node_name, const char *node_name,
+ int64_t size, Error **errp)
{
+ Error *local_err = NULL;
BlockDriverState *bs;
int ret;
- bs = bdrv_find(device);
- if (!bs) {
- error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+ bs = bdrv_lookup_bs(has_device ? device : NULL,
+ has_node_name ? node_name : NULL,
+ &local_err);
+ if (error_is_set(&local_err)) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
+ if (!bdrv_is_first_non_filter(bs)) {
+ error_set(errp, QERR_FEATURE_DISABLED, "resize");
return;
}