"Dr. David Alan Gilbert (git)" <dgilb...@redhat.com> writes:
> From: "Dr. David Alan Gilbert" <dgilb...@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"); [...]