cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chipchild...@apache.org
Subject [3/3] git commit: refs/heads/4.1 - Summary: KVM - remove harmless message about domain not found on VM stop
Date Fri, 15 Mar 2013 14:01:03 GMT
Updated Branches:
  refs/heads/4.1 9e1d5931e -> 186fb9ff5


Summary: KVM - remove harmless message about domain not found on VM stop

Detail: When we stop a VM, it's definition is no longer valid. Therefore, we
need to catch the exception thrown from libvirt in trying to lookup a
non-existent domain by UUID while trying to check if it's shut down.

BUG-ID:CLOUDSTACK-600
Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1363201066 -0600


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/186fb9ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/186fb9ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/186fb9ff

Branch: refs/heads/4.1
Commit: 186fb9ff51c2084a5ca514eeac387158f1cb5cf6
Parents: 6df107b
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Wed Mar 13 12:57:46 2013 -0600
Committer: Chip Childers <chip.childers@gmail.com>
Committed: Fri Mar 15 09:56:19 2013 -0400

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java     |   23 ++++++++++----
 1 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/186fb9ff/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 59691d3..1c25321 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3931,23 +3931,32 @@ ServerResource {
                     .getBytes()));
             int persist = dm.isPersistent();
             if (force) {
-                if (dm.getInfo().state != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF) {
+                if (dm.isActive() == 1) {
                     dm.destroy();
                     if (persist == 1) {
                         dm.undefine();
                     }
                 }
             } else {
-                if (dm.getInfo().state == DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF) {
+                if (dm.isActive() == 0) {
                     return null;
                 }
                 dm.shutdown();
                 int retry = _stopTimeout / 2000;
-                /* Wait for the domain gets into shutoff state */
-                while ((dm.getInfo().state != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF)
-                        && (retry >= 0)) {
-                    Thread.sleep(2000);
-                    retry--;
+                /* Wait for the domain gets into shutoff state. When it does
+                   the dm object will no longer work, so we need to catch it. */
+                try {
+                    while ( dm.isActive() == 1 && (retry >= 0)) {
+                        Thread.sleep(2000);
+                        retry--;
+                    }
+                } catch (LibvirtException e) {
+                    String error = e.toString();
+                    if (error.contains("Domain not found")) {
+                        s_logger.debug("successfully shut down vm " + vmName);
+                    } else {
+                        s_logger.debug("Error in waiting for vm shutdown:" + error);
+                    }
                 }
                 if (retry < 0) {
                     s_logger.warn("Timed out waiting for domain " + vmName


Mime
View raw message