cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject git commit: updated refs/heads/master to 95b9be0
Date Mon, 27 Oct 2014 18:08:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 4f4595cef -> 95b9be0cb


allow reentrance of disassociate ip , if vif is gone, return success


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

Branch: refs/heads/master
Commit: 95b9be0cb60212850b7e7a66326ce5c0040225cd
Parents: 4f4595c
Author: Anthony Xu <anthony.xu@citrix.com>
Authored: Mon Oct 27 11:06:38 2014 -0700
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Mon Oct 27 11:07:51 2014 -0700

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java  | 42 ++++++++++----------
 1 file changed, 20 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/95b9be0c/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index a1067f4..0dde4cc 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -2097,12 +2097,13 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
                     networkUsage(conn, routerIp, "addVif", "eth" + correctVif.getDevice(conn));
                 }
 
-                if (correctVif == null) {
+                if (ip.isAdd() && correctVif == null) {
                     throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate
IP with.");
                 }
-
-                ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
-                ip.setNewNic(addVif);
+                if (correctVif != null ) {
+                    ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
+                    ip.setNewNic(addVif);
+                }
             }
         } catch (InternalErrorException e) {
             s_logger.error("Ip Assoc failure on applying one ip due to exception:  ", e);
@@ -2140,9 +2141,6 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
 
                 Network network = getNetwork(conn, nic);
 
-                // Determine the correct VIF on DomR to associate/disassociate the
-                // IP address with
-                VIF correctVif = getCorrectVif(conn, router, network);
 
                 // If we are disassociating the last IP address in the VLAN, we need
                 // to remove a VIF
@@ -2153,28 +2151,28 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
                     removeVif = true;
                 }
 
-                if (correctVif == null) {
-                    throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate
IP with.");
-                }
-
                 if (removeVif) {
-                    network = correctVif.getNetwork(conn);
 
-                    // Mark this vif to be removed from network usage
-                    networkUsage(conn, routerIp, "deleteVif", "eth" + correctVif.getDevice(conn));
+                    // Determine the correct VIF on DomR to associate/disassociate the
+                    // IP address with
+                    VIF correctVif = getCorrectVif(conn, router, network);
+                    if (correctVif != null) {
+                         network = correctVif.getNetwork(conn);
 
-                    // Remove the VIF from DomR
-                    correctVif.unplug(conn);
-                    correctVif.destroy(conn);
+                        // Mark this vif to be removed from network usage
+                        networkUsage(conn, routerIp, "deleteVif", "eth" + correctVif.getDevice(conn));
 
-                    // Disable the VLAN network if necessary
-                    disableVlanNetwork(conn, network);
+                        // Remove the VIF from DomR
+                        correctVif.unplug(conn);
+                        correctVif.destroy(conn);
+
+                        // Disable the VLAN network if necessary
+                        disableVlanNetwork(conn, network);
+                    }
                 }
             }
-        } catch (InternalErrorException e) {
-            s_logger.error("Ip Assoc failure on applying one ip due to exception:  ", e);
-            return new ExecutionResult(false, e.getMessage());
         } catch (Exception e) {
+            s_logger.debug("Ip Assoc failure on applying one ip due to exception:  ", e);
             return new ExecutionResult(false, e.getMessage());
         }
         return new ExecutionResult(true, null);


Mime
View raw message