Bug 2000075

Summary: [embed qemu] Failed to start vm by virt-qemu-run if vm has network interface
Product: Red Hat Enterprise Linux 9 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
libvirt sub component: General QA Contact: yafu <yafu>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: low CC: jdenemar, jsuchane, lmen, mkletzan, smitterl, virt-maint, xuzhang, yafu
Version: 9.0Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-8.10.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:26:10 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: 8.10.0
Embargoed:
Attachments:
Description Flags
vm xml none

Description Fangge Jin 2021-09-01 10:30:38 UTC
Created attachment 1819631 [details]
vm xml

Description of problem:
Failed to start vm by virt-qemu-run

Version-Release number of selected component:
libvirt-7.6.0-2.module+el8.5.0+12219+a5ea13d2.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Set selinux to permissive mode(this is a temporary workaround)

2. Start service virtnetworkd

3. Try to start vm by virt-qemu-run, the vm xml includes network interface:
# virt-qemu-run -d -v vm1.xml
virt-qemu-run: 13: initializing libvirt 558442
virt-qemu-run: 1120: initializing signal handlers
virt-qemu-run: 1172: preparing event loop thread
virt-qemu-run: 1212: opening qemu:///embed?root=%2Ftmp%2Fvirt-qemu-run-5W5J80
virt-qemu-run: 30337: fetching guest config vm1.xml
virt-qemu-run: 30384: starting guest vm1.xml
2021-09-01 06:17:03.147+0000: 558442: info : libvirt version: 7.6.0, package: 2.module+el8.5.0+12219+a5ea13d2 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2021-08-12-05:59:49, )
2021-09-01 06:17:03.147+0000: 558442: info : hostname: dell-per750-03.lab.eng.pek2.redhat.com
2021-09-01 06:17:03.147+0000: 558442: warning : qemuProcessStop:7965 : Unable to release network device '<null>'
virt-qemu-run: cannot start VM: An error occurred, but the cause is unknown
virt-qemu-run: 360759: cleaned up, exiting


4. Check syslog:
Sep 01 02:10:26 dell-per750-03.lab.eng.pek2.redhat.com virtlogd[84306]: Unable to open file: /tmp/virt-qemu-run-8S8N80/log/qemu/vm1.log: No such file or directory

5. Remove the network interface from vm xml, try again, vm can start successfully:
# virt-qemu-run vm1.xml   -d -v
virt-qemu-run: 27: initializing libvirt 106001
virt-qemu-run: 1987: initializing signal handlers
virt-qemu-run: 2310: preparing event loop thread
virt-qemu-run: 2403: opening qemu:///embed?root=%2Ftmp%2Fvirt-qemu-run-ZI4Y80
virt-qemu-run: 15547: fetching guest config vm1.xml
virt-qemu-run: 15636: starting guest vm1.xml
virt-qemu-run: 943151: guest running, Ctrl-C to stop now
virt-qemu-run: XML: <domain type='kvm' id='1'>
  <name>vm1</name>
  <uuid>f2d17ae3-dc8b-40f3-97e8-093faeca75ed</uuid>
......


Actual results:
Failed to start vm by virt-qemu-run when vm has network interface

Expected results:
It should succeed


Additional info:

Comment 1 Martin Kletzander 2022-11-11 13:34:42 UTC
Patch proposed upstream:

https://listman.redhat.com/archives/libvir-list/2022-November/235751.html

Comment 2 Martin Kletzander 2022-11-15 10:24:21 UTC
Fixed upstream with v8.9.0-238-g8e527dd65381:

commit 8e527dd653814fa0c6266228ae46f1aed0159608
Author: Martin Kletzander <mkletzan>
Date:   Fri Nov 11 14:19:50 2022 +0100

    virGetConnectGeneric: Only delegate existing identities

Comment 3 yafu 2022-12-07 08:42:24 UTC
Tested pass with libvirt-8.10.0-2.el9.x86_64.

Comment 7 yafu 2022-12-08 09:30:31 UTC
Verified with libvirt-8.10.0-2.el9.x86_64.

Test steps:
1.Set selinux to permissive mode:
#setenforce 0

2.Start a vm with network type interface by virt-qemu-run, the vm start successfully:
# virt-qemu-run -d -v vm.xml 
virt-qemu-run: 19: initializing libvirt 47541
virt-qemu-run: 856: initializing signal handlers
virt-qemu-run: 956: preparing event loop thread
virt-qemu-run: 1380: opening qemu:///embed?root=%2Ftmp%2Fvirt-qemu-run-59YXW1
virt-qemu-run: 20380: fetching guest config vm.xml
virt-qemu-run: 20523: starting guest vm.xml
virt-qemu-run: 1354073: guest running, Ctrl-C to stop now
virt-qemu-run: XML: <domain type='kvm' id='1'>
  <name>test</name>
  <uuid>50c64d95-c84a-4bed-a6d4-4426e2883a30</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://redhat.com/rhel/9.0"/>
    </libosinfo:libosinfo>
  </metadata>
...
<interface type='bridge'>
      <mac address='52:54:00:24:74:07'/>
      <source bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
...

Comment 9 errata-xmlrpc 2023-05-09 07:26:10 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 (libvirt bug fix and enhancement 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/RHBA-2023:2171