Bug 2221492

Summary: [hot-plug bridged interfaces] Removed (absent) interfaces should be cleared from VM spec
Product: Container Native Virtualization (CNV) Reporter: Yossi Segev <ysegev>
Component: NetworkingAssignee: omergi
Status: CLOSED ERRATA QA Contact: Nir Rozen <nrozen>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.14.0   
Target Milestone: ---   
Target Release: 4.14.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v4.14.0-334, bundle-v4.14.0.rhel9-1291 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:05:53 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 Yossi Segev 2023-07-09 13:38:58 UTC
Description of problem:
After performing hot-unplug, the interface remains in the VMI (with state: absent), and it remains like this even after migrating the VM.


Version-Release number of selected component (if applicable):
CNV 4.14.0


How reproducible:
Always

Steps to Reproduce:
1. Create and run a basic VM (no secondary NICs).
$ oc create ns yoss-ns
namespace/yoss-ns created
$ oc project yoss-ns
Now using project "yoss-ns" on server "https://api.net-ys-414o.rhos-psi.cnv-qe.rhood.us:6443".
$ oc apply -f vm-fedora.yaml 
virtualmachine.kubevirt.io/vm-fedora created
$ virtctl start vm-fedora
VM vm-fedora was scheduled to start

2. Create a bridge interface over one of the nodes secondary NICs using a NodeNetworkConfigurationPolicy.
$ oc apply -f nncp-linux-bridge.yaml 
oc get nncp -w
nodenetworkconfigurationpolicy.nmstate.io/hotplug-linux-bridge created
ysegev@ysegev-fedora (hotplug) $ oc get nncp -w
NAME                   STATUS   REASON
hotplug-linux-bridge            
hotplug-linux-bridge   Progressing   ConfigurationProgressing
hotplug-linux-bridge   Progressing   ConfigurationProgressing
...
hotplug-linux-bridge   Available     SuccessfullyConfigured

3. Create a NetworkattachmentDefinition for the bridge.
$ oc apply -f bridge-nad.yaml 
networkattachmentdefinition.k8s.cni.cncf.io/hp-br-nad created

4. Run the command to add the new interface to the VM:
$ virtctl addinterface vm-fedora --network-attachment-definition-name hp-br-nad --name hp2

5. Migrate the VM to completely apply the hot-plug action (using a VirtualMachineInstanceMigration resource).
$ cat << EOF | oc apply -f -
> apiVersion: kubevirt.io/v1
kind: VirtualMachineInstanceMigration
metadata:
  name: migration-job
spec:
  vmiName: vm-fedora
> EOF
virtualmachineinstancemigration.kubevirt.io/migration-job created
$ oc get vmim -w
NAME            PHASE        VMI
migration-job   Scheduling   vm-fedora
migration-job   Scheduled    vm-fedora
migration-job   PreparingTarget   vm-fedora
migration-job   TargetReady       vm-fedora
migration-job   Running           vm-fedora
migration-job   Succeeded         vm-fedora

6. Delete the migration job
$ oc delete vmim migration-job

7. Remove the hot-plugged interface:
$ virtctl addinterface vm-fedora --name hp2

8. Migrate again (to complete the hot-unplug):
Simply repeat step 5.

9. Check the VM spec (specifically the `networks` and `interfaces` sections).

Actual results:
<BUG>
The hot-unplugged interfaces is still there (as `absent`):
      interfaces:
      - masquerade: {}
        name: default
      - bridge: {}
        name: hp2
        state: absent
...
  networks:
  - name: default
    pod: {}
  - multus:
      networkName: hp-br-nad
    name: hp2


Expected results:
The removed interface should be completely removed from the VM spec.

Comment 4 Yossi Segev 2023-07-27 10:49:48 UTC
Verified by repeating the same scenario as in the bug description.
CNV bundle version v4.14.0.rhel9-1332 (brew.registry.redhat.io/rh-osbs/iib:542628)

Comment 6 errata-xmlrpc 2023-11-08 14:05:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Virtualization 4.14.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6817