From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL9b2-0007S8-G3 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 08:11:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL9b1-000576-I0 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 08:11:48 -0500 Date: Mon, 18 Jan 2016 13:11:38 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20160118131138.GB2399@work-vm> References: <1450349251-10326-1-git-send-email-dgilbert@redhat.com> <87egdfnik0.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87egdfnik0.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH 1/1] HMP: Add equivalent to x-blockdev-change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-block@nongnu.org, zhang.zhanghailiang@huawei.com, qemu-devel@nongnu.org * Markus Armbruster (armbru@redhat.com) wrote: > "Dr. David Alan Gilbert (git)" writes: > > > From: "Dr. David Alan Gilbert" > > > > 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