Bug 489283 - virsh save $shutted-off-domain will get invalid domain pointer in no domain with matching id -1
virsh save $shutted-off-domain will get invalid domain pointer in no domain w...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
5.4
All Linux
low Severity medium
: rc
: ---
Assigned To: Daniel Veillard
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-09 06:33 EDT by Vivian Bian
Modified: 2016-04-26 11:13 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-02 05:23:33 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Vivian Bian 2009-03-09 06:33:59 EDT
Description of problem:
try to save a domain which is shutted off will get an error

Version-Release number of selected component (if applicable):
ovirt-node-image-1.0-1.snap3.el5ovirt

How reproducible:
Always

Steps to Reproduce:
1. # virsh define xxx.xml
2. # virsh save $domain_name $file_name (this domain is a shut off one)
  
Actual results:
libvir: QEMU error: invalid domain pointer in no domain with matching id -1
error: Failed to save domain super_disk5 to example

Expected results:
the domain could be saved successfully

Additional info:
a running domain could be saved well
Comment 1 Daniel Berrange 2009-03-09 07:09:54 EDT
This is merely a mis-leading error message. The 'save' operation is intended to fail for inactive domains, since there is no VM to save. We should give a better error message though.

The problem is in the QEMU driver which does

    qemuDriverLock(driver);
    vm = virDomainFindByID(&driver->domains, dom->id);

    if (!vm) {
        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
                         _("no domain with matching id %d"), dom->id);
        goto cleanup;
    }

    if (!virDomainIsActive(vm)) {
        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
                         "%s", _("domain is not running"));
        goto cleanup;
    }

It never gets to the 'IsActive' check because the lookup-by-ID fails first. We should really never do a lookup-by-ID in the driver. If we switched this code to use virDomainFindByUUID, then the second more useful error message would be returned.
Comment 2 Perry Myers 2009-03-30 23:19:38 EDT
Moving to RHEL since libvirt is not supported in RHEV1.0 production builds and this problem will need to be addressed in RHEL5.4 release
Comment 3 Daniel Veillard 2009-04-23 11:23:42 EDT
Note that with Xen as the hypervisor the output is correct:

[root@test2 ~]# virsh save test /tmp/test.mem
error: Failed to save domain test to /tmp/test.mem
error: invalid argument in Domain test isn't running.

[root@test2 ~]# 

Once rebooted to use KVM instead the error shows up:

[root@test2 ~]# virsh save kvmtest /tmp/kvmtest.mem
error: Failed to save domain kvmtest to /tmp/kvmtest.mem
error: invalid domain pointer in no domain with matching id -1

[root@test2 ~]# 

but the ID -> UUID lookup has been implemented upstream so in
the final version with libvirt-0.6.3 this should be fixed:


[root@test2 ~]# virsh save kvmtest /tmp/kvmtest.mem
error: Failed to save domain kvmtest to /tmp/kvmtest.mem
error: operation failed: domain is not running

[root@test2 ~]# 

  This will be modified as soon as 0.6.3 is pushed,

Daniel
Comment 4 Daniel Veillard 2009-04-28 06:06:16 EDT
Modified with push of libvirt-0.6.3-1.el5 in dist-5E-qu-candidate

Daniel
Comment 7 Nan Zhang 2009-05-27 07:50:09 EDT
This has been verified in libvirt 0.6.3-3 on rhel-5.4. Already fixed.

Verified steps:

# virsh list --all
 Id Name                 State
----------------------------------
  - demo                 shut off

# virsh save demo test123
error: Failed to save domain demo to test123
error: operation failed: domain is not running
Comment 9 errata-xmlrpc 2009-09-02 05:23:33 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1269.html

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