Bug 1948433

Summary: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid machine name
Product: Red Hat Enterprise Linux 9 Reporter: Xiaodai Wang <xiaodwan>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED CURRENTRELEASE QA Contact: zhentang <zhetang>
Severity: low Docs Contact:
Priority: low    
Version: 9.0CC: fjin, jdenemar, jsuchane, juzhou, lcheng, mprivozn, mxie, tyan, tzheng, virt-maint, xuzhang, yafu
Target Milestone: betaKeywords: Automation, Regression, Triaged, Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.6.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:57: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: 7.6.0
Embargoed:

Description Xiaodai Wang 2021-04-12 07:33:39 UTC
Description of problem:
GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid machine name

Version-Release number of selected component (if applicable):
dbus-1.12.20-3.el9.x86_64
libvirt-client-7.0.0-4.el9.x86_64
libvirt-daemon-7.0.0-4.el9.x86_64
qemu-kvm-5.2.0-11.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
# virt-v2v -i libvirt -ic vpx://xxx -o libvirt -of raw -os default 'Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\-m' -it vddk -io vddk-libdir=/root/vddk_libdir/latest -io vddk-thumbprint=xxx -on 'Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\\-mpJWE' -ip /root/v2v_vpx_passwd
[   0.0] Opening the source -i libvirt -ic vpx://xxx Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\-m -it vddk  -io vddk-libdir=/root/vddk_libdir/latest -io vddk-thumbprint=xxx
[   1.7] Creating an overlay to protect the source from being modified
[   2.5] Opening the overlay
[   7.0] Inspecting the overlay
[  23.2] Checking for sufficient free disk space in the guest
[  23.2] Estimating space required on target for each disk
[  23.2] Converting Red Hat Enterprise Linux Server 7.9 (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 107.7] Mapping filesystem data to avoid copying unused and blank areas
[ 108.2] Closing the overlay
[ 108.5] Assigning disks to buses
[ 108.5] Checking if the guest needs BIOS or UEFI to boot
[ 108.5] Initializing the target -o libvirt -os default
[ 108.5] Copying disk 1/1 to /var/lib/libvirt/images/Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\\-mpJWE-sda (raw)
    (100.00/100%)
[ 383.3] Creating output metadata
[ 383.4] Finishing off
[root@ibm-x3250m6-10 ~]# virsh list --all
 Id   Name                                                                       State
-------------------------------------------------------------------------------------------
 -    Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\\-mpJWE   shut off

[root@ibm-x3250m6-10 ~]# virsh dumpxml 'Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\\-mpJWE'
<domain type='kvm'>
  <name>Auto-esx7.0-rhel7.9-special-characters~!@#$%^&amp;*_=+,?&gt;&lt;:;|.&quot;[]()`\\-mpJWE</name>
  <uuid>401570ea-1bd1-4f46-907d-38dc8ed6bd3c</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://redhat.com/rhel/7.9"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-q35-rhel8.4.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>qemu64</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='volume' device='disk'>
      <driver name='qemu' type='raw'/>
      <source pool='default' volume='Auto-esx7.0-rhel7.9-special-characters~!@#$%^&amp;*_=+,?&gt;&lt;:;|.&quot;[]()`\\-mpJWE-sda'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    ......
  </devices>
</domain>
# virsh start 'Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\\-mpJWE'
error: Failed to start domain 'Auto-esx7.0-rhel7.9-special-characters~!@#$%^&*_=+,?><:;|."[]()`\\-mpJWE'
error: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid machine name

Actual results:
GDbus error happens and vm starts failure.

Expected results:
VM should start successfully.

Additional info:
1) The same VM name can be started successfully on rhel8.
2) The bug can be reproduced by a simpler name '|.-m'.

Comment 1 Michal Privoznik 2021-06-25 14:11:18 UTC
Patch proposed upstream:

https://listman.redhat.com/archives/libvir-list/2021-June/msg00758.html

Comment 3 Michal Privoznik 2021-07-07 14:26:34 UTC
Merged upstream as:

cda47bac25 virDomainMachineNameAppendValid: Handle special characters better

v7.5.0-29-gcda47bac25

Comment 5 zhentang 2021-07-20 06:53:13 UTC
Tested on libvirt v7.5.0-128-g8ad2882cb6 and it works as expected.

Comment 10 zhentang 2021-08-18 03:08:48 UTC
Verified
libvirt libvirt-7.6.0-2.el9
dbus-1.12.20-4.el9
qemu-kvm-6.0.0-11.el9.1





# virsh destroy '|.-m'
Domain '|.-m' destroyed

# virsh start '|.-m'
Domain '|.-m' started

# virsh list
 Id   Name       State
--------------------------
 2    fedora34   running
 4    |.-m       running


# virsh dumpxml '|.-m'
<domain type='kvm' id='4'>
  <name>|.-m</name>
  <uuid>d081192c-e9ea-40e6-ac1e-88491e3584e4</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
......