Bug 2035006

Summary: interface availability is wrong on a restored machine
Product: Red Hat Enterprise Linux 9 Reporter: smitterl
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
libvirt sub component: General QA Contact: yalzhang <yalzhang>
Status: CLOSED DUPLICATE Docs Contact:
Severity: high    
Priority: unspecified CC: pkrempa, virt-maint, xuzhang, yafu, yanghliu, yanqzhan
Version: 9.0Keywords: Automation
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: 2022-01-18 15:01:27 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 smitterl 2021-12-22 17:24:10 UTC
Description of problem:
If a vm with a hotplugged iface is saved/restored, then after hotunplugging it, it's still listed although the interface is not available in the guest anymore.

This is reproducible only w/ QEMU 6.2, not with QEMU 6.1.


Version-Release number of selected component (if applicable):
libvirt-7.10.0-1.el9.s390x
qemu-kvm-6.2.0-1.el9.s390x


How reproducible:
100%

Steps to Reproduce:
1. Hotplug iface
 a. virsh start avocado-vt-vm1
 b. virsh attach-interface --domain avocado-vt-vm1  --type 'direct' --source 'enc9c0' --mac '9a:38:94:28:5f:e2' --target 'test' --model 'virtio' --inbound '100,200,100' --outbound '200,300,200'
 c. virsh domiflist avocado-vt-vm1
>>
# virsh domiflist avocado-vt-vm1 
 Interface   Type      Source    Model    MAC
-------------------------------------------------------------
 vnet1       network   default   virtio   52:54:00:fe:81:59
 test        direct    enc9c0    virtio   9a:38:94:28:5f:e2

 d. log into guest and list interfaces (ip link show)
==> the additional interface is listed

2. Save and restore vm
 a. virsh save avocado-vt-vm1 /root/avocado-vt-vm1.save
 b. virsh domiflist avocado-vt-vm1
>>
# virsh domiflist avocado-vt-vm1 
 Interface   Type      Source    Model    MAC
-------------------------------------------------------------
 vnet1       network   default   virtio   52:54:00:fe:81:59

 c. virsh restore /root/avocado-vt-vm1.save
 d. virsh domiflist avocado-vt-vm1
>>
# virsh domiflist avocado-vt-vm1 
 Interface   Type      Source    Model    MAC
-------------------------------------------------------------
 vnet1       network   default   virtio   52:54:00:fe:81:59
 test        direct    enc9c0    virtio   9a:38:94:28:5f:e2

3. Detach the interface
 a. virsh detach-interface --domain avocado-vt-vm1 --type direct --mac 9a:38:94:28:5f:e2

4. Check interface availability
 a. virsh domiflist avocado-vt-vm1
 b. virsh dumpmxml avocado-vt-vm1
 c. log into guest and list available interfaces

Actual results:
Ad a.
-----
 Interface   Type      Source    Model    MAC
-------------------------------------------------------------
 vnet1       network   default   virtio   52:54:00:fe:81:59
 test        direct    enc9c0    virtio   9a:38:94:28:5f:e2

Ad b.
-----
Still dumps the second interface

Ad c.
-----
The additional interface is not listed anymore.

Expected results:
virsh domiflist and virsh dumpxml correctly report only the one initial interface.

Additional info:
[1] This does not reproduce with qemu-kvm-6.1.0-8.el9.s390x
[2] This does not reproduce if step 2. (restore/save) is skipped
[3] This was hit by tp-libvirt/libvirt case virsh.attach_detach_interface.normal_test.vm_running.direct.default.domname - passing. The test passes if the restore/save is skipped (--vt-extra-params save_restore=no).

Comment 1 yalzhang@redhat.com 2022-01-04 05:22:35 UTC
I think this is the same issue in bug 2035237(libvirt) and 2036669(qemu-kvm)

Comment 2 yalzhang@redhat.com 2022-01-04 05:56:57 UTC
The hotplugged interface do not exists in the qemu cmd line, while after save-> restore, the hotplugged interface will also included into the qemu cmd line. This is why it can not reproduce if save/restore is skipped. (refer to https://bugzilla.redhat.com/show_bug.cgi?id=2035237#c2)

Comment 3 Peter Krempa 2022-01-18 15:01:27 UTC

*** This bug has been marked as a duplicate of bug 2035237 ***