cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject git commit: updated refs/heads/master to ddfdc9a
Date Mon, 03 Jun 2013 22:50:37 GMT
Updated Branches:
  refs/heads/master b325f7d3b -> ddfdc9af6


KVM - Don't fail to start due to old VM definition. On rare occasion we see
inactive VM definitions block a new VM starting. Definitions aren't supposed to
be persistent, but sometimes a crash or failed migration can leave behind a
definition.

Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1370299734 -0600


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

Branch: refs/heads/master
Commit: ddfdc9af6316c91a5b6f5f269a05a45bba0006df
Parents: b325f7d
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Mon Jun 3 16:48:54 2013 -0600
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Mon Jun 3 16:48:54 2013 -0600

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java     |   18 +++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ddfdc9af/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 46fce24..e1ad7c2 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
@@ -1094,6 +1094,24 @@ ServerResource {
                 This also makes sure we never have any old "garbage" defined
                 in libvirt which might haunt us.
             */
+
+            // check for existing inactive vm definition and remove it
+            // this can sometimes happen during crashes, etc
+            Domain dm = null;
+            try {
+                dm = conn.domainLookupByName(vmName);
+                if (dm != null && dm.isPersistent() == 1) {
+                    // this is safe because it doesn't stop running VMs
+                    dm.undefine();
+                }
+            } catch (LibvirtException e) {
+                // this is what we want, no domain found
+            } finally {
+                if (dm != null) {
+                    dm.free();
+                }
+            }
+
             conn.domainCreateXML(domainXML, 0);
         } catch (final LibvirtException e) {
             throw e;


Mime
View raw message