Ping On Thu, Jul 16, 2020 at 6:26 AM <and...@daynix.com> wrote:
> From: Andrew Melnychenko <and...@daynix.com> > > There is an issue, that netdev can't be removed if it was added using hmp. > The bug appears after 08712fcb851034228b61f75bd922863a984a4f60 commit. > It happens because of unclear QemuOpts that was created during > hmp_netdev_add(), now it uses qmp analog function - > qmp_marshal_netdev_add(). > > Signed-off-by: Andrew Melnychenko <and...@daynix.com> > --- > monitor/hmp-cmds.c | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) > > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c > index 2b0b58a336..b747935687 100644 > --- a/monitor/hmp-cmds.c > +++ b/monitor/hmp-cmds.c > @@ -1597,19 +1597,10 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) > void hmp_netdev_add(Monitor *mon, const QDict *qdict) > { > Error *err = NULL; > - QemuOpts *opts; > - > - opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err); > - if (err) { > - goto out; > - } > + QDict *non_constant_dict = qdict_clone_shallow(qdict); > > - netdev_add(opts, &err); > - if (err) { > - qemu_opts_del(opts); > - } > - > -out: > + qmp_marshal_netdev_add(non_constant_dict, NULL, &err); > + qobject_unref(non_constant_dict); > hmp_handle_error(mon, err); > } > > -- > 2.27.0 > >