Bug 2127834

Summary: Updating portgroup of ovs interface should fail
Product: Red Hat Enterprise Linux 9 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
libvirt sub component: Networking QA Contact: yalzhang <yalzhang>
Status: CLOSED MIGRATED Docs Contact:
Severity: medium    
Priority: medium CC: jsuchane, lmen, lvivier, mprivozn, virt-maint, yalzhang
Version: 9.1Keywords: MigratedToJIRA, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-22 15:52:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fangge Jin 2022-09-19 08:18:30 UTC
Description of problem:
Update portgroup of ovs interface, the port tag is cleared unexpectedly.

Version-Release number of selected component (if applicable):
libvirt-8.5.0-6.el9.x86_64
openvswitch2.15-2.15.0-70.el9fdp.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Create an openvswitch bridge
# ovs-vsctl show
ce606951-de6b-4515-9280-44b2a6766a57
    Bridge "ovsbr0"
        Port "ovsbr0"
            Interface "ovsbr0"
                type: internal
        Port "eno8303"
            Interface "eno8303"
    ovs_version: "2.15.6"

2. Create an openvswitch network:
<network>
  <name>ovs-net</name>
  <uuid>1546c287-e22f-41c5-8eef-12ccb8a54af6</uuid>
  <forward mode='bridge'/>
  <bridge name='ovsbr0'/>
  <vlan trunk='yes'>
    <tag id='42' nativeMode='untagged'/>
    <tag id='47'/>
  </vlan>
  <virtualport type='openvswitch'>
    <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
  </virtualport>
  <portgroup name='dontpanic'>
    <vlan>
      <tag id='42'/>
    </vlan>
  </portgroup>
</network>

3. Start a vm

4. Attach a openvswitch interface to vm:
# virsh attach-interface vm111 --type network --source ovs-net --model virtio
Interface attached successfully

# virsh dumpxml vm111 --xpath //interface
<interface type="bridge">
  <mac address="52:54:00:07:7e:14"/>
  <source network="ovs-net" portid="555b1703-8f01-4f74-b15d-674b0c5e695a" bridge="ovsbr0"/>
  <vlan trunk="yes">
    <tag id="42" nativeMode="untagged"/>
    <tag id="47"/>
  </vlan>
  <virtualport type="openvswitch">
    <parameters interfaceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"/>
  </virtualport>
  <target dev="vnet3"/>
  <model type="virtio"/>
  <alias name="net0"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>

# ovs-vsctl show
ce606951-de6b-4515-9280-44b2a6766a57
    Bridge ovsbr0
        Port ovsbr0
            Interface ovsbr0
                type: internal
        Port vnet3
            tag: 42
            trunks: [42, 47]
            Interface vnet3
        Port eno8303
            Interface eno8303
    ovs_version: "2.15.6"

5. Update interface portgroup:
# cat ovs-inc.xml
<interface type="network">
  <mac address="52:54:00:e9:a0:ba"/>
  <source network='ovs-net' portgroup='dontpanic'/>
  <model type="virtio"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>


# virsh update-device vm111 ovs-inc.xml
Device updated successfully

6. Check the updated interface:
# virsh dumpxml vm111 --xpath //interface
<interface type="bridge">
  <mac address="52:54:00:e9:a0:ba"/>
  <source network="ovs-net" portgroup="dontpanic" portid="a31b4f86-cfe7-4951-b23a-1f6465df7345" bridge="ovsbr0"/>
  <vlan>
    <tag id="42"/>
  </vlan>
  <virtualport type="openvswitch">
    <parameters interfaceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"/>
  </virtualport>
  <target dev="vnet4"/>
  <model type="virtio"/>
  <alias name="net0"/>
  <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>

# ovs-vsctl show                       
ce606951-de6b-4515-9280-44b2a6766a57
    Bridge ovsbr0
        Port ovsbr0
            Interface ovsbr0
                type: internal
        Port eno8303
            Interface eno8303
        Port vnet4
            Interface vnet4
    ovs_version: "2.15.6"


Actual results:
When updating interface portgroup, ovs port tag is cleared.

Expected results:
Updating interface portgroup should fail like:
# virsh update-device rhel interface.xml 
error: Failed to update device from interface.xml
error: internal error: Unable to set vlan configuration on port vnet4

Additional info:
1. Check the syslog:
ovs-vsctl[286450]: ovs|00001|vsctl|INFO|Called as ovs-vsctl --timeout=5 -- --if-exists clear Port vnet4 tag -- --if-exists clear Port vnet4 trunk -- --if-exists clear Port vnet4 vlan_mode

Comment 1 Michal Privoznik 2022-09-19 10:54:46 UTC
Oh, I see the problem: the vlan setting is inherited from the network, it's not part of the interface XML and yet, libvirt clears the the vlan setting.

Comment 2 RHEL Program Management 2023-09-22 15:51:09 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 3 RHEL Program Management 2023-09-22 15:52:54 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.