* [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change
@ 2015-12-17 10:47 Dr. David Alan Gilbert (git)
2015-12-17 16:43 ` Eric Blake
2016-01-18 13:06 ` Markus Armbruster
0 siblings, 2 replies; 5+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2015-12-17 10:47 UTC (permalink / raw)
To: wency, zhang.zhanghailiang, qemu-devel; +Cc: qemu-block
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
x-blockdev-change has no HMP equivalent, so add x_block_change.
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
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hmp-commands.hx | 18 ++++++++++++++++++
hmp.c | 20 ++++++++++++++++++++
hmp.h | 1 +
3 files changed, 39 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index a381b0b..cf2459b 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -57,6 +57,24 @@ Quit the emulator.
ETEXI
{
+ .name = "x_block_change",
+ .args_type = "parent:B,add:-a,del:-d,child:B",
+ .params = "parent [-a] [-d] child",
+ .help = "add or remove a child from a block driver",
+ .mhandler.cmd = hmp_block_change,
+ },
+
+STEXI
+@item x_block_change
+@findex x_block_change
+Dynamically reconfigure the block driver state graph. It can be used
+to add, remove, insert or replace a block driver state. Currently only
+the Quorum driver implements this feature to add or remove its child.
+This is useful to fix a broken quorum child.
+ETEXI
+
+
+ {
.name = "block_resize",
.args_type = "device:B,size:o",
.params = "device size",
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");
diff --git a/hmp.h b/hmp.h
index 864a300..1588850 100644
--- a/hmp.h
+++ b/hmp.h
@@ -53,6 +53,7 @@ void hmp_cont(Monitor *mon, const QDict *qdict);
void hmp_system_wakeup(Monitor *mon, const QDict *qdict);
void hmp_nmi(Monitor *mon, const QDict *qdict);
void hmp_set_link(Monitor *mon, const QDict *qdict);
+void hmp_block_change(Monitor *mon, const QDict *qdict);
void hmp_block_passwd(Monitor *mon, const QDict *qdict);
void hmp_balloon(Monitor *mon, const QDict *qdict);
void hmp_block_resize(Monitor *mon, const QDict *qdict);
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change
2015-12-17 10:47 [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change Dr. David Alan Gilbert (git)
@ 2015-12-17 16:43 ` Eric Blake
2015-12-17 16:48 ` Dr. David Alan Gilbert
2016-01-18 13:06 ` Markus Armbruster
1 sibling, 1 reply; 5+ messages in thread
From: Eric Blake @ 2015-12-17 16:43 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git), wency, zhang.zhanghailiang,
qemu-devel
Cc: qemu-block
[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]
On 12/17/2015 03:47 AM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> x-blockdev-change has no HMP equivalent, so add x_block_change.
>
> Example useages are:
s/useages/usages/
> 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
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> +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");
Maybe s/One/Exactly one/ ?
Limited in that we may eventually want to allow both add and delete at
the same time; but HMP does not have hard-and-fast back-compat rules.
So I'm fine with fixing the minor issues mentioned above, and adding:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change
2015-12-17 16:43 ` Eric Blake
@ 2015-12-17 16:48 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2015-12-17 16:48 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-block, zhang.zhanghailiang, qemu-devel
* Eric Blake (eblake@redhat.com) wrote:
> On 12/17/2015 03:47 AM, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > x-blockdev-change has no HMP equivalent, so add x_block_change.
> >
> > Example useages are:
>
> s/useages/usages/
Yep.
> > 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
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
>
> > +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");
>
> Maybe s/One/Exactly one/ ?
Yep, can do.
> Limited in that we may eventually want to allow both add and delete at
> the same time; but HMP does not have hard-and-fast back-compat rules.
Oh I was assuming if we wanted to make a 'change' we'd add a -c.
> So I'm fine with fixing the minor issues mentioned above, and adding:
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
Thanks.
Dave
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change
2015-12-17 10:47 [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change Dr. David Alan Gilbert (git)
2015-12-17 16:43 ` Eric Blake
@ 2016-01-18 13:06 ` Markus Armbruster
2016-01-18 13:11 ` Dr. David Alan Gilbert
1 sibling, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2016-01-18 13:06 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: qemu-block, zhang.zhanghailiang, qemu-devel
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> writes:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> 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");
[...]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change
2016-01-18 13:06 ` Markus Armbruster
@ 2016-01-18 13:11 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2016-01-18 13:11 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-block, zhang.zhanghailiang, qemu-devel
* Markus Armbruster (armbru@redhat.com) wrote:
> "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> writes:
>
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > 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.
It's not in master yet; it's in Wen Congyang's 'child add/delete support'
series; which I've got running with COLO.
Dave
>
> > 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");
> [...]
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-01-18 13:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-17 10:47 [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change Dr. David Alan Gilbert (git)
2015-12-17 16:43 ` Eric Blake
2015-12-17 16:48 ` Dr. David Alan Gilbert
2016-01-18 13:06 ` Markus Armbruster
2016-01-18 13:11 ` Dr. David Alan Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).