[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-block
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change |
Date: |
Mon, 18 Jan 2016 14:06:23 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Dr. David Alan Gilbert (git)" <address@hidden> writes:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> x-blockdev-change has no HMP equivalent, so add x_block_change.
Uh, I can find neither QMP command x-blockdev-change nor
qmp_x_blockdev_change() in master.
> Example useages are:
> x_block_change foo -a bah
> to add the node bah to the parent foo
>
> x_block_change foo -d bah
> to delete the node bah from the parent foo
[...]
> diff --git a/hmp.c b/hmp.c
> index dc6dc30..631dacb 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1042,6 +1042,26 @@ void hmp_balloon(Monitor *mon, const QDict *qdict)
> }
> }
>
> +void hmp_block_change(Monitor *mon, const QDict *qdict)
> +{
> + const char *parent = qdict_get_str(qdict, "parent");
> + const char *child = qdict_get_str(qdict, "child");
> + bool add = qdict_get_try_bool(qdict, "add", false);
> + bool del = qdict_get_try_bool(qdict, "del", false);
> + Error *err = NULL;
> +
> + if (add == del) {
> + error_setg(&err, "One of -a or -d must be set");
> + hmp_handle_error(mon, &err);
> + return;
> + }
> +
> + qmp_x_blockdev_change(parent,
> + del, child,
> + add, child, &err);
> + hmp_handle_error(mon, &err);
> +}
> +
> void hmp_block_resize(Monitor *mon, const QDict *qdict)
> {
> const char *device = qdict_get_str(qdict, "device");
[...]
- Re: [Qemu-block] [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change,
Markus Armbruster <=