cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [25/50] [abbrv] git commit: refs/heads/affinity_groups - CLOUDSTACK-657 VMware vNetwork Distributed Virtual Switch support in CloudStack
Date Thu, 14 Mar 2013 22:35:17 GMT
CLOUDSTACK-657 VMware vNetwork Distributed Virtual Switch support in CloudStack

This is 3rd patch for feature 'Support for VMware dvSwitch in CloudStack'.

This patch contains few helper functions (get dvswitch reference, check the type of a port
group). Also added method getType() to VirtualSwitchType enum.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>


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

Branch: refs/heads/affinity_groups
Commit: b667cf7352f19bb6ffb131d65630b3b65b247ff7
Parents: 3798854
Author: sateesh <sateesh.chodapuneedi@citrix.com>
Authored: Mon Feb 25 16:56:47 2013 +0530
Committer: Prachi Damle <prachi@cloud.com>
Committed: Thu Mar 14 15:12:59 2013 -0700

----------------------------------------------------------------------
 .../cloud/hypervisor/vmware/mo/DatacenterMO.java   |    8 +++
 .../hypervisor/vmware/mo/VirtualSwitchType.java    |   37 +++++++++++++-
 .../cloud/hypervisor/vmware/util/VmwareHelper.java |    4 ++
 3 files changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b667cf73/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
index eb10e16..9f75bd6 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
@@ -470,4 +470,12 @@ public class DatacenterMO extends BaseMO {
                 + dvSwitchUuid);
         return dvPortBacking;
     }
+
+    public ManagedObjectReference getDvSwitchMor(String dvSwitchName) throws Exception {
+        ManagedObjectReference dvSwitchMor = null;
+        ManagedObjectReference networkFolderMor = null;
+        networkFolderMor = _context.getServiceUtil().getMoRefProp(_mor, "networkFolder");
+        dvSwitchMor = _context.getServiceUtil().getDecendentMoRef(networkFolderMor, "VmwareDistributedVirtualSwitch",
dvSwitchName);
+        return dvSwitchMor;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b667cf73/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualSwitchType.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualSwitchType.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualSwitchType.java
index d6226ff..bcfc64b 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualSwitchType.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualSwitchType.java
@@ -17,8 +17,39 @@
 
 package com.cloud.hypervisor.vmware.mo;
 
+
 public enum VirtualSwitchType {
-	StandardVirtualSwitch,
-	VMwareDistributedVirtualSwitch,
-	NexusDistributedVirtualSwitch,
+    None,
+    StandardVirtualSwitch,
+    VMwareDistributedVirtualSwitch,
+    NexusDistributedVirtualSwitch;
+
+    public final static String vmwareStandardVirtualSwitch = "vmwaresvs";
+    public final static String vmwareDistributedVirtualSwitch = "vmwaredvs";
+    public final static String nexusDistributedVirtualSwitch = "nexusdvs";
+
+    public static VirtualSwitchType getType(String vSwitchType) {
+        if (vSwitchType == null) {
+            return VirtualSwitchType.StandardVirtualSwitch;
+        } else if (vSwitchType.equalsIgnoreCase(vmwareStandardVirtualSwitch)) {
+            return VirtualSwitchType.VMwareDistributedVirtualSwitch;
+        } else if (vSwitchType.equalsIgnoreCase(vmwareDistributedVirtualSwitch)) {
+            return VirtualSwitchType.NexusDistributedVirtualSwitch;
+        } else if (vSwitchType.equalsIgnoreCase(nexusDistributedVirtualSwitch)) {
+            return VirtualSwitchType.StandardVirtualSwitch;
+        }
+        return VirtualSwitchType.None;
+    }
+
+    @Override
+    public String toString() {
+        if (this == VirtualSwitchType.StandardVirtualSwitch) {
+            return vmwareStandardVirtualSwitch;
+        } else if (this == VirtualSwitchType.VMwareDistributedVirtualSwitch) {
+            return vmwareDistributedVirtualSwitch;
+        } else if (this == VirtualSwitchType.NexusDistributedVirtualSwitch) {
+            return nexusDistributedVirtualSwitch;
+        }
+        return "";
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b667cf73/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
index 352c584..72b4714 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
@@ -632,4 +632,8 @@ public class VmwareHelper {
     	Random random = new Random();
     	return candidates.get(random.nextInt(candidates.size()));
 	}
+
+    public static boolean isDvPortGroup(ManagedObjectReference networkMor) {
+         return "DistributedVirtualPortgroup".equalsIgnoreCase(networkMor.getType());
+    }
 }


Mime
View raw message