On Wed, Sep 03, 2025 at 06:14:36PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> On 03.09.25 17:47, Daniel P. Berrangé wrote:
> > On Wed, Sep 03, 2025 at 04:37:05PM +0300, Vladimir Sementsov-Ogievskiy
> > wrote:
> > > Add test for a new feature of local TAP migration with fd passing
> > > through unix socket.
> > >
> > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
> > > ---
> > > .../test_x86_64_tap_fd_migration.py | 347 ++++++++++++++++++
> > > 1 file changed, 347 insertions(+)
> > > create mode 100644 tests/functional/test_x86_64_tap_fd_migration.py
> > >
> > > diff --git a/tests/functional/test_x86_64_tap_fd_migration.py
> > > b/tests/functional/test_x86_64_tap_fd_migration.py
> > > new file mode 100644
> > > index 0000000000..f6d18fe39f
> > > --- /dev/null
> > > +++ b/tests/functional/test_x86_64_tap_fd_migration.py
> > > +def init_tap() -> None:
> > > + run(f"ip tuntap add dev {TAP_ID} mode tap multi_queue")
> > > + run(f"ip link set dev {TAP_ID} address {TAP_MAC}")
> > > + run(f"ip addr add {HOST_IP_MASK} dev {TAP_ID}")
> > > + run(f"ip link set {TAP_ID} up")
> >
> > $ ip tuntap add dev foo mode tap multi_queue
> > ioctl(TUNSETIFF): Operation not permitted
> >
> >
> > The functional tests run as the developer's normal unprivileged user
> > account, so it doesn't look like this can work ?
> >
> > Were you testing this as root ?
>
> Yes I run the test with sudo..
>
> Do we have any tests in QEMU that requires root? Or anyway to do this for
> functional tests? I'm afraid there is no way to setup TAP interface in
> unprivileged user account :(
There are a variety of iotests that include calls to sudo.
These automatically mark themselves as skipped if
password-less sudo fails to work. So in practice the tests
will rarely get run, but its better than nothing I guess.
We should add a skipUnlesPasswordlessSudo() method to the
tests/functional/qemu_test/decorators.py class, and you
then then annotate this test with that. Then just add sudo
to the "ip" calls.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|