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 1254152 - error should be improved when use some virsh command get failure
Summary: error should be improved when use some virsh command get failure
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-17 09:49 UTC by Luyao Huang
Modified: 2016-11-03 18:22 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:22:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Luyao Huang 2015-08-17 09:49:26 UTC
Description of problem:
the error should be improved when use some virsh command get failure

Version-Release number of selected component (if applicable):
libvirt-1.2.17-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a guest which use a name which is number:

# virsh list
 Id    Name                           State
----------------------------------------------------
 2     123                            running


2. chose a command which need pass guest name:

# virsh domiflist 123
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet0      network    default    rtl8139     52:54:00:59:d5:b8

# virsh domif-setlink 123 vnet1 up
error: interface (target: vnet1) not found
error: Domain not found: no domain with matching id 123


3.

Actual results:

virsh output an extra error "error: Domain not found: no domain with matching id 123"


Expected results:

# virsh domif-setlink 123 vnet1 up
error: interface (target: vnet1) not found

we should not output this error, since it is just a try of virsh function virsh/vshLookupDomainInternal, and we get the correct guest pointer after try id,uuid,name, so this error should be reset after these tries.

Additional info:

Comment 1 Luyao Huang 2015-08-17 09:58:02 UTC
Send a patch to list:

https://www.redhat.com/archives/libvir-list/2015-August/msg00639.html

Comment 2 Erik Skultety 2015-08-18 12:58:44 UTC
fixed upstream:

commit 70f56dd72cdca309005c8234a8945721badbcfff
Author: Luyao Huang <lhuang>
Date:   Mon Aug 17 17:56:48 2015 +0800

    virsh: Reset global error after successfull domain lookup
    
    When looking up a domain, we try to look up by ID, UUID and NAME
    consequently while not really caring which of those lookups succeeds.
    The problem is that if any of them fails, we dispatch the error from the
    driver and that means setting both threadlocal and global error. Let's
    say the last lookup (by NAME) succeeds and resets the threadlocal error as any
    other API does, however leaving the global error unchanged. If the underlying
    virsh command does not succeed afterwards, our cleanup routine in
    vshCommandRun ensures that no libvirt error will be forgotten and that's
    exactly where this global error comes in incorrectly.
    
     # virsh domif-setlink 123 vnet1 up
     error: interface (target: vnet1) not found
     error: Domain not found: no domain with matching id 123
    
    This patch also resets the global error which would otherwise cause some
    minor confusion in reported error messages.

v1.2.18-135-g70f56dd

Comment 4 yalzhang@redhat.com 2016-03-01 06:40:19 UTC
Verified as below, the error message is excepted.Modify the bug to verified.

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 16    123                            running

# virsh domiflist 123
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet0      network    default    rtl8139     52:54:00:bb:25:71

# virsh domiflist 1234
error: failed to get domain '1234'
error: Domain not found: no domain with matching name '1234'

# virsh domif-setlink 123 vnet1 up
error: interface (target: vnet1) not found

# virsh domif-setlink 16 vnet1 up
error: interface (target: vnet1) not found

# virsh domifstat 123 vnet1
error: Failed to get interface stats 123 vnet1
error: invalid argument: invalid path, 'vnet1' is not a known interface

# virsh domiftune 123 vnet5
error: Unable to get interface parameters
error: invalid argument: Can't find device vnet5

Comment 5 yalzhang@redhat.com 2016-03-01 06:44:22 UTC
Comment 4 is verified on libvirt-1.3.1-1.el7.x86_64.

Comment 7 errata-xmlrpc 2016-11-03 18:22:56 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://rhn.redhat.com/errata/RHSA-2016-2577.html


Note You need to log in before you can comment on or make changes to this bug.