From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL9Vy-00055X-B1 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 08:06:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL9Vx-0003PO-DZ for qemu-devel@nongnu.org; Mon, 18 Jan 2016 08:06:34 -0500 From: Markus Armbruster References: <1450349251-10326-1-git-send-email-dgilbert@redhat.com> Date: Mon, 18 Jan 2016 14:06:23 +0100 In-Reply-To: <1450349251-10326-1-git-send-email-dgilbert@redhat.com> (David Alan Gilbert's message of "Thu, 17 Dec 2015 10:47:31 +0000") Message-ID: <87egdfnik0.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: "Dr. David Alan Gilbert (git)" Cc: qemu-block@nongnu.org, zhang.zhanghailiang@huawei.com, qemu-devel@nongnu.org "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. > 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"); [...]