incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject [2/5] git commit: refs/heads/master - CLOUDSTACK-657 VMware vNetwork Distributed Virtual Switch support in CloudStack
Date Wed, 27 Feb 2013 13:09:05 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/a9446a98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a9446a98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a9446a98

Branch: refs/heads/master
Commit: a9446a9811bd9ffb3323210ac3a1ee7a4a891e8f
Parents: 03cde72
Author: sateesh <sateesh.chodapuneedi@citrix.com>
Authored: Mon Feb 25 16:56:47 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Wed Feb 27 18:37:15 2013 +0530

----------------------------------------------------------------------
 .../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/a9446a98/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/a9446a98/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/a9446a98/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