cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/4.2 to a247be7
Date Wed, 14 Aug 2013 23:57:35 GMT
Updated Branches:
  refs/heads/4.2 1260b9737 -> a247be70d


CLOUDSTACK-4315: add code to clean up libvirt data structure after plug/unplug, that's the
only thing I can do to fix this kind of libvirt issue


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

Branch: refs/heads/4.2
Commit: a247be70d8483609f42d6ba8edfb444e8ccefdb4
Parents: 1260b97
Author: Edison Su <sudison@gmail.com>
Authored: Wed Aug 14 16:56:58 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Wed Aug 14 16:57:14 2013 -0700

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java  | 22 ++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a247be70/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 d2534d1..53d4a64 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
@@ -1741,9 +1741,10 @@ ServerResource {
     private PlugNicAnswer execute(PlugNicCommand cmd) {
         NicTO nic = cmd.getNic();
         String vmName = cmd.getVmName();
+        Domain vm = null;
         try {
             Connect conn = LibvirtConnection.getConnectionByVmName(vmName);
-            Domain vm = getDomain(conn, vmName);
+            vm = getDomain(conn, vmName);
             List<InterfaceDef> pluggedNics = getInterfaces(conn, vmName);
             Integer nicnum = 0;
             for (InterfaceDef pluggedNic : pluggedNics) {
@@ -1763,6 +1764,14 @@ ServerResource {
             String msg = " Plug Nic failed due to " + e.toString();
             s_logger.warn(msg, e);
             return new PlugNicAnswer(cmd, false, msg);
+        } finally {
+            if (vm != null) {
+                try {
+                    vm.free();
+                } catch (LibvirtException l) {
+                    s_logger.trace("Ignoring libvirt error.", l);
+                }
+            }
         }
     }
 
@@ -1770,9 +1779,10 @@ ServerResource {
         Connect conn;
         NicTO nic = cmd.getNic();
         String vmName = cmd.getVmName();
+        Domain vm = null;
         try {
             conn = LibvirtConnection.getConnectionByVmName(vmName);
-            Domain vm = getDomain(conn, vmName);
+            vm = getDomain(conn, vmName);
             List<InterfaceDef> pluggedNics = getInterfaces(conn, vmName);
             for (InterfaceDef pluggedNic : pluggedNics) {
                 if (pluggedNic.getMacAddress().equalsIgnoreCase(nic.getMac())) {
@@ -1790,6 +1800,14 @@ ServerResource {
             String msg = " Unplug Nic failed due to " + e.toString();
             s_logger.warn(msg, e);
             return new UnPlugNicAnswer(cmd, false, msg);
+        } finally {
+            if (vm != null) {
+                try {
+                    vm.free();
+                } catch (LibvirtException l) {
+                    s_logger.trace("Ignoring libvirt error.", l);
+                }
+            }
         }
     }
 


Mime
View raw message