Hello,
Can someone take a look at this patch? Thx in advance :)
--
Best regards / Pozdrawiam
Sławek Kapłoński
slawek(a)kaplonski.pl
On Sat, 22 Oct 2016, Sławek Kapłoński wrote:
When user tries to resume already running domain (Qemu or LXC)
there is VIR_ERR_OPERATION_INVALID error raised now with
message that domain is already running.
Closes-Bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1009008
---
src/lxc/lxc_driver.c | 8 +++++++-
src/qemu/qemu_driver.c | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 466e67f..4a0165a 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3156,6 +3156,7 @@ static int lxcDomainResume(virDomainPtr dom)
virDomainObjPtr vm;
virObjectEventPtr event = NULL;
int ret = -1;
+ int state;
virLXCDomainObjPrivatePtr priv;
virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
@@ -3176,7 +3177,12 @@ static int lxcDomainResume(virDomainPtr dom)
goto endjob;
}
- if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
+ state = virDomainObjGetState(vm, NULL);
+ if (state == VIR_DOMAIN_RUNNING) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is already running"));
+ goto endjob;
+ } else if (state == VIR_DOMAIN_PAUSED) {
if (virCgroupSetFreezerState(priv->cgroup, "THAWED") < 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Resume operation failed"));
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 93ea5e2..c99186a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1919,6 +1919,10 @@ static int qemuDomainResume(virDomainPtr dom)
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is pmsuspended"));
goto endjob;
+ } else if (state == VIR_DOMAIN_RUNNING) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is already running"));
+ goto endjob;
} else if ((state == VIR_DOMAIN_CRASHED &&
reason == VIR_DOMAIN_CRASHED_PANICKED) ||
state == VIR_DOMAIN_PAUSED) {
--
2.10.1
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list