[libvirt] [PATCH] qemu: Error prompt when managed save a shutoff domain

The problem was intrduced by commit 4303c91, which removed the checking of domain state, this patch is to fix it. Otherwise, improper error will be throwed, e.g. # virsh managedsave rhel6 error: Failed to save domain rhel6 state error: cannot resolve symlink /var/lib/libvirt/qemu/save/rhel6.save: No such file or directory --- src/qemu/qemu_driver.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 34cc29f..575dbd3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4640,6 +4640,12 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags) goto cleanup; } + if (!virDomainObjIsActive(vm)) { + qemuReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto cleanup; + } + name = qemuDomainManagedSavePath(driver, vm); if (name == NULL) goto cleanup; -- 1.7.3.2

On Tue, Jan 25, 2011 at 03:49:51PM +0800, Osier Yang wrote:
The problem was intrduced by commit 4303c91, which removed the checking of domain state, this patch is to fix it.
Otherwise, improper error will be throwed, e.g.
# virsh managedsave rhel6 error: Failed to save domain rhel6 state error: cannot resolve symlink /var/lib/libvirt/qemu/save/rhel6.save: No such file or directory
--- src/qemu/qemu_driver.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 34cc29f..575dbd3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4640,6 +4640,12 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags) goto cleanup; }
+ if (!virDomainObjIsActive(vm)) { + qemuReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto cleanup; + } + name = qemuDomainManagedSavePath(driver, vm); if (name == NULL) goto cleanup;
Ahhh, yes it makes sense, ACK Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 01/25/2011 12:58 AM, Daniel Veillard wrote:
On Tue, Jan 25, 2011 at 03:49:51PM +0800, Osier Yang wrote:
The problem was intrduced by commit 4303c91, which removed the checking
s/intrduced/introduced/
of domain state, this patch is to fix it.
Otherwise, improper error will be throwed, e.g.
s/throwed/thrown/
Ahhh, yes it makes sense,
ACK
I made those tweaks, and pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

于 2011年01月26日 00:54, Eric Blake 写道:
On 01/25/2011 12:58 AM, Daniel Veillard wrote:
On Tue, Jan 25, 2011 at 03:49:51PM +0800, Osier Yang wrote:
The problem was intrduced by commit 4303c91, which removed the checking
s/intrduced/introduced/
of domain state, this patch is to fix it.
Otherwise, improper error will be throwed, e.g.
s/throwed/thrown/
Ahhh, yes it makes sense,
ACK
I made those tweaks, and pushed.
Thanks. Regarads Osier
participants (3)
-
Daniel Veillard
-
Eric Blake
-
Osier Yang