[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modify NetdevUserOptions through QMP in QEMU 6 - how?

From: Thomas Huth
Subject: Re: modify NetdevUserOptions through QMP in QEMU 6 - how?
Date: Wed, 15 Dec 2021 08:03:50 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0

On 15/12/2021 04.31, Jason Wang wrote:
On Tue, Dec 14, 2021 at 10:53 PM Michael S. Tsirkin <mst@redhat.com> wrote:

On Mon, Dec 13, 2021 at 09:02:15AM +0100, Thomas Huth wrote:

On 10/12/2021 18.02, Alexander Sosedkin wrote:
With QEMU 5 I could totally issue a QMP netdev_add
with the same ID to adjust the NetdevUserOptions I want,
such as restrict or hostfwd. No deleting needed,
just a netdev_add with what I want changed as a param.

I'm a little bit surprised that this worked, since AFAIK there is no code in
QEMU to *change* the parameters of a running netdev... likely the code added
a new netdev with the same ID, replacing the old one?

With QEMU 6 it started failing, claiming the ID is already used.
And if I do netdev_del + netdev_add, I just lose connectivity.
What's even stranger, I still see old netdev attached in info network:

netdev_del {'id': 'net0'}
human-monitor-command {'command-line': 'info network'}
   \ net0: index=0,type=user,net=,restrict=off

I think that's "normal" - there used to be problems in the past that the
devices (virtio-net-pci in this case) did not like the netdevs to be removed
on the fly. So the netdevs are kept around until you remove the device, too
(i.e. issue a device_del for the virtio-net-pci device).

netdev_add {'type': 'user', 'id': 'net0', 'restrict': False, 'hostfwd': 
[{'str': 'tcp:'}]}
human-monitor-command {'command-line': 'info network'}
unseal: virtio-net-pci.0:
   \ net0: index=0,type=user,net=,restrict=off
net0: index=0,type=user,net=,restrict=off

What's the correct QMP command sequence to modify NetdevUserOptions?

AFAIK there is no way to modify running netdevs - you'd have to delete the
netdev and the device, and then add both again. But I might have missed
something here, so I CC:-ed some people who might be more familiar with the
details here.


Please CC me on replies.

Wow this really goes to show how wide our feature matrix is.

Yes it's probably an unintended side effect but yes it
did work it seems, so we really should not just break it
without warning.

Probably this one:

commit 831734cce6494032e9233caff4d8442b3a1e7fef
Author: Markus Armbruster <armbru@redhat.com>
Date:   Wed Nov 25 11:02:20 2020 +0100

     net: Fix handling of id in netdev_add and netdev_del

Jason, what is your take here?

I might be wrong, but I agree with Thomas. Adding a netdev with the
same ID looks wrong, if it works, it looks like a bug.

It certainly calls for trouble as soon as you try to delete the netdev again - does it delete the first (inactive) instance? Does it delete the second active one? Does it delete both? (Otherwise it will leave a dangling instance behind) ... So if changing netdev parameters on the fly is something that we want, we should implement this properly instead indeed, and not via such an accidental bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]