Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1494400

Summary: Run virsh domxml-to-native successfully with extra param
Product: Red Hat Enterprise Linux 7 Reporter: lcheng
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Meina Li <meili>
Severity: medium Docs Contact:
Priority: low    
Version: 7.5CC: dyuan, fjin, junli, pkrempa, rbalakri, xuzhang, yisun
Target Milestone: rcKeywords: Automation, Regression
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-3.9.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 10:57:19 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 lcheng 2017-09-22 08:02:28 UTC
Description:
Run virsh domxml-to-native successfully with extra param.  


Version:
libvirt-3.7.0-2.el7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.8.x86_64


How reproduced:
100%


Steps:

# virsh domxml-to-native qemu-argv guest.xml xyz
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name guest=avocado-vt-vm1,debug-threads=on -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-avocado-vt-vm1/master-key.aes -machine pc-i440fx-rhel7.4.0,accel=kvm,usb=off,dump-guest-core=off -cpu IvyBridge -m 1024 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid 70bc1897-fa72-4304-9215-9b68ebb1bf14 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain--1-avocado-vt-vm1/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,b!
 us=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/var/lib/avocado/data/avocado-vt/images/jeos-25-64.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=22,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:3a:01:0c,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain--1-avocado-vt-vm1/org.qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -device usb-tablet,id=input0,bus=usb.0,port=1 -vnc 127.0.0.1:0 -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -o!
 bject rng-random,id=objrng0,filename=/dev/urandom -device virtio-rng-p
ci,rng=objrng0,id=rng0,bus=pci.0,addr=0x8 -msg timestamp=on



Actual results:
convert domain XML to native config successfully


Expected results:
cannot convert domain XML to native config.


Additional info:

convert failed on libvirt-3.2.0-14.el7_4.3.x86_64.

# virsh domxml-to-native qemu-argv guest.xml xyz
error: unexpected data 'xyz'

Comment 3 Peter Krempa 2017-10-24 09:37:24 UTC
Fixed upstream:

commit f4973d1ea88b2e807fc2c52a5fc281a1c289d50e
Author: Peter Krempa <pkrempa>
Date:   Tue Oct 10 17:19:10 2017 +0200

    virsh: domain: Fix option handling in domxml-to-native
    
    Commit fdeac7a05fdf85458d72e89efcfa0f444525aaad tried to fix the output
    of 'virsh domxml-to-native --help' by switching types around. One of the
    changes broke the option parser. VSH_OT_ARGV should be used only for
    variable argument count, not to make the help generator look pretty.
    
    The correct option type in this case is VSH_OT_STRING as it's not
    mandatory now since it can be substituted by using --domain.
    
    This makes --help for this command look incorrect, but the parser works
    as it should.

Comment 5 Meina Li 2017-11-10 06:08:24 UTC
Verified on:
libvirt-3.9.0-1.el7.x86_64
qemu-kvm-rhev-2.10.0-4.el7.x86_64

Steps to verify:
1. Using --xml option with extra param:
# virsh dumpxml lmn >lmn.xml
# virsh domxml-to-native qemu-argv --xml lmn.xml 12as
error: unexpected data '12as'

2. Using --domain option with extra param:
# virsh domxml-to-native qemu-argv --domain lmn 12as
error: Options --domain and --xml are mutually exclusive


For the step 2, the extra parameter isn't a domain XML config, but libvirt check it as a xml, is it expected?

Comment 6 Peter Krempa 2017-11-13 12:00:26 UTC
Yes, that is due to the fact that --xml was an implicit argument and thus it's automatically covered by the first argument without an explicit flag.

Comment 7 Meina Li 2017-11-14 09:21:03 UTC
According to the test result and explanations,move this bug to VERIFIED.

Comment 11 errata-xmlrpc 2018-04-10 10:57:19 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, 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/RHEA-2018:0704