Bug 2232361

Summary: The network interface could not be hot-detached in ppc64le
Product: Red Hat Enterprise Linux 8 Reporter: YunmingYang <yunyang>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
Status: NEW --- QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.9CC: hhan, pkrempa, virt-maint
Target Milestone: rcFlags: pkrempa: needinfo? (yunyang)
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 YunmingYang 2023-08-16 13:37:12 UTC
Description of problem:
Create a VM by "virt-install --name test --import --disk /var/lib/libvirt/images/fedora38.qcow2 --os-variant fedora38 --memory 2048 --vcpus 2 --noautoconsole --os-variant fedora38 --print-xml > xml && virsh define xml && virsh start test"(Use fedora 38 cloud base image), then wait until the VM boot completely, then detach the network interface by "virsh detach-interface test network --mac ${mac} --live", the network interface is not detached

Version-Release number of selected components (if applicable):
libvirt-libs-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-dbus-1.3.0-2.module+el8.9.0+18724+20190c23.ppc64le
libvirt-daemon-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-driver-network-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-driver-storage-disk-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-driver-nodedev-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-driver-storage-iscsi-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-glib-3.0.0-1.el8.ppc64le
python3-libvirt-8.0.0-2.module+el8.9.0+18724+20190c23.ppc64le
libvirt-client-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-driver-storage-core-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-config-network-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-driver-interface-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le
libvirt-daemon-driver-qemu-8.0.0-22.module+el8.9.0+19544+b3045133.ppc64le

How reproducible:
100%

Steps to Reproduce:
1 Create a VM by "virt-install --name test --import --disk /var/lib/libvirt/images/fedora38.qcow2 --os-variant fedora38 --memory 2048 --vcpus 2 --noautoconsole --os-variant fedora38 --print-xml > xml && virsh define xml && virsh start test"(Use fedora 38 cloud base image)
2 Wait until the VM boot completely
3 Detach the network interface by "virsh detach-interface test network --mac ${mac} --live"

Actual results:
1 After step 3, the network is not detached

Expected results:
2 After step 3, the network interface should be detached

Additional info:

Comment 1 Han Han 2023-08-17 02:19:57 UTC
Tested on libvirt-9.6.0-1.fc39.x86_64 qemu-system-ppc-core-8.0.0-4.fc39.x86_64. No problem
# virsh dumpxml rhel-ppc64 --xpath //interface
<interface type="network">
  <mac address="52:54:00:a1:a5:96"/>
  <source network="default" portid="2aa31b6f-16d5-4fa2-bc04-d644afee71c9" bridge="virbr0"/>
  <target dev="vnet0"/>
  <model type="virtio"/>
  <alias name="net0"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</interface>

# virsh detach-interface rhel-ppc64 network --mac 52:54:00:a1:a5:96
Interface detached successfully


# virsh dumpxml rhel-ppc64 --xpath //interface

Comment 2 Peter Krempa 2023-08-17 11:56:26 UTC
If device is not detached after a hot-unplug request it's usually caused by the guest OS not allowing the unplug. This can be either because the device is in use, or the OS is not responding. Since active cooperation with the guest OS is needed there is no way to force removal.

If you're able to reproduce the problem please attach debug logs of libvirtd, but based on my experience it'll be caused by the guest not allowing the removal. (Libvirt will sucessfully request the removal in qemu, which will also forward it to the OS but no acknowledgement will be seen).