Red Hat Bugzilla – Bug 1281707
some virsh cmd get failure without set error message
Last modified: 2016-11-03 14:30:37 EDT
Description of problem: some virsh cmd get failure without set error message Version-Release number of selected component (if applicable): libvirt-1.2.17-13.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. # virsh blockcopy RHEL71-lhuang --dest '' --path vda # echo $? 1 2. # virsh event RHEL71-lhuang --event '' # echo $? 1 3. # virsh net-event default --event '' # echo $? 1 4. # virsh net-dhcp-leases default --mac '' # echo $? 1 5. # virsh domifaddr RHEL71-lhuang --interface '' # echo $? 1 Actual results: some virsh cmd get failure without set error message Expected results: error like "invalid strings" Additional info:
*** Bug 1261432 has been marked as a duplicate of this bug. ***
Upstream patches: https://www.redhat.com/archives/libvir-list/2015-December/msg00100.html
Pushed as: commit 45138725cf2a14575aa5204fe55efd6668b9b03a Author: Ján Tomko <jtomko@redhat.com> CommitDate: 2015-12-03 13:58:52 +0100 virsh: report errors for empty strings Several callers were using vshCommandOptString without setting an error. Use vshCommandOptStringReq which sets the error. https://bugzilla.redhat.com/show_bug.cgi?id=1281707 git describe: v1.3.0-rc1-4-g4513872
Verified on libvirt-1.3.1-1.el7.x86_64, the results as expected. All the command on the bug will get a fail information. 1. [root@work images]# virsh blockcopy test --dest /var/lib/libvirt/images/bak vda Block Copy started [root@work images]# virsh blockcopy test --dest ' ' vda Block Copy started [root@work images]# virsh blockcopy test --dest '' vda error: Failed to get option 'dest': Option argument is empty [root@work images]# virsh blockcopy test --dest /var/lib/libvirt/images/bbk --path '' error: Failed to get option 'path': Option argument is empty [root@work images]# virsh blockcopy test --dest /var/lib/libvirt/images/bbk error: command 'blockcopy' requires <path> option [root@work images]# virsh blockcopy test vda error: need either --dest or --xml 2. [root@work Desktop]# virsh event rhel7.2 --event '' error: Failed to get option 'event': Option argument is empty [root@work Desktop]# virsh event rhel7.2 --event 'ss' error: unknown event type ss [root@work Desktop]# virsh event rhel7.2 --event "lifecycle" event 'lifecycle' for domain rhel7.2: Resumed Unpaused events received: 1 [root@work Desktop]# virsh event rhel7.2 --event error: expected syntax: --event <string> 3. [root@work images]# virsh net-event default --event '' error: Failed to get option 'event': Option argument is empty [root@work images]# virsh net-event default --event ' ' error: unknown event type [root@work images]# virsh net-event default --event ss error: unknown event type ss 4. see bug 1261432 [root@work images]# virsh net-dhcp-leases default --mac '' error: Failed to get option 'mac': Option argument is empty [root@work images]# virsh net-dhcp-leases default --mac ' ' error: Failed to get leases info for default error: invalid MAC address: [root@work images]# virsh net-dhcp-leases default --mac 99 error: Failed to get leases info for default error: invalid MAC address: 99 5. [root@test /]# virsh domifaddr rhel7.2 '' error: Failed to get option 'interface': Option argument is empty [root@test /]# virsh domifaddr rhel7.2 Name MAC address Protocol Address ------------------------------------------------------------------------------- vnet0 52:54:00:1b:6f:e5 ipv4 192.168.122.159/24 [root@test /]# virsh domifaddr rhel7.2 vnet1 Name MAC address Protocol Address ------------------------------------------------------------------------------- [root@test /]# virsh destroy rhel7.2 Domain rhel7.2 destroyed [root@test /]# virsh domifaddr rhel7.2 error: Failed to query for interfaces addresses error: Requested operation is not valid: domain is not running Modify the bug status to verified.
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://rhn.redhat.com/errata/RHSA-2016-2577.html