Bug 2210287 - The "dev" setting is ignored when it is used without address for passt interface
Summary: The "dev" setting is ignored when it is used without address for passt interface
Keywords:
Status: ON_QA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-26 13:09 UTC by yalzhang@redhat.com
Modified: 2023-08-10 03:16 UTC (History)
7 users (show)

Fixed In Version: libvirt-9.5.0-0rc1.1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version: 9.5.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-158301 0 None None None 2023-05-26 13:10:16 UTC

Description yalzhang@redhat.com 2023-05-26 13:09:24 UTC
Description of problem:
The "dev" setting is ignored unexpectedly when it is used without
address for passt interface

Version-Release number of selected component (if applicable):
libvirt-9.3.0-2.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a vm of user type interface with passt backend as below:
# virsh dumpxml rhel --xpath //interface
<interface type="user">
  <mac address="52:54:00:49:84:12"/>
  <source dev="eno1"/>
  <portForward proto="tcp" dev="eno1">
    <range start="41335"/>
  </portForward>
  <model type="virtio"/>
  <backend type="passt"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>

2. Start vm and check the passt process
# ps aux | grep 'bin/passt' | grep -v grep
qemu        9303  0.0  0.0  76344 33524 ?        Ss   08:59   0:00
/usr/bin/passt --one-off --socket
/run/libvirt/qemu/passt/7-rhel-net0.socket --mac-addr
52:54:00:49:84:12 --pid /run/libvirt/qemu/passt/7-rhel-net0-passt.pid
--interface eno1 --tcp-ports 41335

The "dev" setting is ignored unexpectedly, it should be like "--tcp-ports %eno1/41335"

Actual results:
The "dev" setting is ignored unexpectedly when it is used without address

Expected results:
The "dev" setting should be effective in the cmd line "--tcp-ports %eno1/41335"

Additional info:
And suggest to mention the "dev" attribute in the docs/formatdomain.rst

Comment 1 Michal Privoznik 2023-06-01 11:48:59 UTC
Patch posted on the list:

https://listman.redhat.com/archives/libvir-list/2023-June/240148.html

Comment 2 Michal Privoznik 2023-06-01 12:32:52 UTC
To POST:

commit 1c7335add9e28637d8a8b5039f487e5dc6a591c2
Author:     Michal Prívozník <mprivozn>
AuthorDate: Thu Jun 1 10:37:04 2023 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Thu Jun 1 14:25:08 2023 +0200

    qemu_passt: Format portForward device even without address
    
    It's almost like we've anticipated this. Our XML parser and
    formatter handles @address and @dev attributes of <portForward/>
    element completely independent of each other. And as of commit
    2023_03_29.b10b983~3 passt allows handling these two separately
    too. All that's left is generate the cmd line according to this
    new fact.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2210287
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Ján Tomko <jtomko>

v9.4.0-3-g1c7335add9

Comment 5 yalzhang@redhat.com 2023-06-30 05:26:48 UTC
Hi Michal, the vm can not start successfully(See S3 below). Maybe it depends on a new passt build. Could you please help to confirm? Thank you!

S1: with both dev and address:
$ virsh dumpxml test1 --xpath //interface 
<interface type="user">
  <mac address="52:54:00:26:44:e5"/>
  <source dev="eno1"/>
  <portForward proto="tcp" dev="eno1" address='10.73.178.71'>
    <range start="41335"/>
  </portForward>
  <model type="virtio"/>
  <backend type="passt"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>

will come up with:
$ ps aux | grep '/usr/bin/passt'
test       13544  0.0  0.2  76344 38124 ?        Ss   01:20   0:00 /usr/bin/passt --one-off --socket /run/user/1000/libvirt/qemu/run/passt/2-test1-net0.socket --mac-addr 52:54:00:26:44:e5 --pid /run/user/1000/libvirt/qemu/run/passt/2-test1-net0-passt.pid --interface eno1 --tcp-ports 10.73.178.71%eno1/41335

S2: only address
 <portForward proto="tcp" address='10.73.178.71'>
    <range start="41335"/>
  </portForward>

VM start successfully and the passt process is like this:
$ ps aux | grep '/usr/bin/passt'
test       13622  0.0  0.2  76344 38828 ?        Ss   01:21   0:00 /usr/bin/passt --one-off --socket /run/user/1000/libvirt/qemu/run/passt/3-test1-net0.socket --mac-addr 52:54:00:26:44:e5 --pid /run/user/1000/libvirt/qemu/run/passt/3-test1-net0-passt.pid --interface eno1 --tcp-ports 10.73.178.71/41335

S3: only dev, vm can not start successfully
<portForward proto="tcp" dev="eno1">
    <range start="41335"/>
  </portForward>

$ virsh start test1
error: Failed to start domain 'test1'
error: internal error: Child process (/usr/bin/passt --one-off --socket /run/user/1000/libvirt/qemu/run/passt/4-test1-net0.socket --mac-addr 52:54:00:26:44:e5 --pid /run/user/1000/libvirt/qemu/run/passt/4-test1-net0-passt.pid --interface eno1 --tcp-ports %eno1/41335) unexpected exit status 1: Invalid port specifier %eno1/41335

Comment 9 Jiri Denemark 2023-07-24 10:48:30 UTC
This BZ (it's pre-verification actually) is blocking libvirt packages from
making it into a RHEL compose. Could this be pre-verified earlier than after
the passt rebase in mid August? For example using passt from upstream or using
a scratch build (aka rebase pre-release) or something similar?

Comment 10 yalzhang@redhat.com 2023-07-26 06:57:56 UTC
Test with upstream passt and libvirt, the result is as expected:
# rpm -q passt libvirt
passt-g023d684-1.x86_64
libvirt-9.5.0-3.el9.x86_64

# getenforce 
Permissive

1) with address and interface:
# virsh dumpxml rhel --xpath //portForward
<portForward proto="tcp" address="10.73.178.37" dev="eno1">
  <range start="41335"/>
</portForward>

the passt cmdline:
# ps aux | grep 'usr/bin/passt' | grep -v grep 
qemu        5574  0.0  0.0  72936 37628 ?        Ss   02:54   0:00 /usr/bin/passt --one-off --socket /run/libvirt/qemu/passt/7-rhel-net0.socket --mac-addr 52:54:00:49:84:12 --pid /run/libvirt/qemu/passt/7-rhel-net0-passt.pid --interface eno1 --tcp-ports 10.73.178.37%eno1/41335

2) with address only:
# virsh dumpxml rhel --xpath //portForward
<portForward proto="tcp" address="10.73.178.37">
  <range start="41335"/>
</portForward>

the passt cmd line:
# ps aux | grep 'usr/bin/passt' | grep -v grep 
qemu        5692  0.0  0.0  72932 36628 ?        Ss   02:55   0:00 /usr/bin/passt --one-off --socket /run/libvirt/qemu/passt/8-rhel-net0.socket --mac-addr 52:54:00:49:84:12 --pid /run/libvirt/qemu/passt/8-rhel-net0-passt.pid --interface eno1 --tcp-ports 10.73.178.37/41335

3) with interface only:
# virsh dumpxml rhel --xpath //portForward
<portForward proto="tcp" dev="eno1">
  <range start="41335"/>
</portForward>

the passt cmdline:
# ps aux | grep 'usr/bin/passt' | grep -v grep 
qemu        5779  0.0  0.0  72932 36632 ?        Ss   02:56   0:00 /usr/bin/passt --one-off --socket /run/libvirt/qemu/passt/9-rhel-net0.socket --mac-addr 52:54:00:49:84:12 --pid /run/libvirt/qemu/passt/9-rhel-net0-passt.pid --interface eno1 --tcp-ports %eno1/41335


Note You need to log in before you can comment on or make changes to this bug.