incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [14/50] [abbrv] git commit: commit review request https://reviews.apache.org/r/6502/#
Date Sun, 12 Aug 2012 20:20:33 GMT
commit review request https://reviews.apache.org/r/6502/#


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

Branch: refs/heads/master
Commit: 340b086df484ce27df6bbb12926ade6934e5aa2e
Parents: 42a9fd6
Author: Kelven Yang <kelven.yang@citrix.com>
Authored: Fri Aug 10 13:37:43 2012 -0700
Committer: Kelven Yang <kelven.yang@citrix.com>
Committed: Fri Aug 10 13:38:47 2012 -0700

----------------------------------------------------------------------
 .../src/com/cloud/hypervisor/vmware/mo/HostMO.java |    9 +++++++--
 .../hypervisor/vmware/mo/HypervisorHostHelper.java |   14 +++++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/340b086d/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
index c8e0ca1..fd30399 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
@@ -41,6 +41,7 @@ import com.vmware.vim25.HostIpRouteEntry;
 import com.vmware.vim25.HostListSummaryQuickStats;
 import com.vmware.vim25.HostNetworkInfo;
 import com.vmware.vim25.HostNetworkPolicy;
+import com.vmware.vim25.HostNetworkSecurityPolicy;
 import com.vmware.vim25.HostNetworkTrafficShapingPolicy;
 import com.vmware.vim25.HostPortGroup;
 import com.vmware.vim25.HostPortGroupSpec;
@@ -365,7 +366,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
 		return false;
 	}
 	
-	public void createPortGroup(HostVirtualSwitch vSwitch, String portGroupName, Integer vlanId,
HostNetworkTrafficShapingPolicy shapingPolicy) throws Exception {
+	public void createPortGroup(HostVirtualSwitch vSwitch, String portGroupName, Integer vlanId,
HostNetworkSecurityPolicy secPolicy, HostNetworkTrafficShapingPolicy shapingPolicy) throws
Exception {
 		assert(portGroupName != null);
 		HostNetworkSystemMO hostNetMo = getHostNetworkSystemMO();
 		assert(hostNetMo != null);
@@ -376,13 +377,15 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
 		if(vlanId != null)
 			spec.setVlanId(vlanId.intValue());
 		HostNetworkPolicy policy = new HostNetworkPolicy();
+		if (secPolicy != null)
+			policy.setSecurity(secPolicy);
 		policy.setShapingPolicy(shapingPolicy);
 		spec.setPolicy(policy);
 		spec.setVswitchName(vSwitch.getName());
 		hostNetMo.addPortGroup(spec);
 	}
 	
-	public void updatePortGroup(HostVirtualSwitch vSwitch, String portGroupName, Integer vlanId,
HostNetworkTrafficShapingPolicy shapingPolicy) throws Exception {
+	public void updatePortGroup(HostVirtualSwitch vSwitch, String portGroupName, Integer vlanId,
HostNetworkSecurityPolicy secPolicy, HostNetworkTrafficShapingPolicy shapingPolicy) throws
Exception {
 		assert(portGroupName != null);
 		HostNetworkSystemMO hostNetMo = getHostNetworkSystemMO();
 		assert(hostNetMo != null);
@@ -393,6 +396,8 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
 		if(vlanId != null)
 			spec.setVlanId(vlanId.intValue());
 		HostNetworkPolicy policy = new HostNetworkPolicy();
+		if (secPolicy != null)
+			policy.setSecurity(secPolicy);
 		policy.setShapingPolicy(shapingPolicy);
 		spec.setPolicy(policy);
 		spec.setVswitchName(vSwitch.getName());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/340b086d/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index 944d66c..50f9541 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -43,6 +43,8 @@ import com.vmware.vim25.BoolPolicy;
 import com.vmware.vim25.DVPortgroupConfigInfo;
 import com.vmware.vim25.DVSTrafficShapingPolicy;
 import com.vmware.vim25.DynamicProperty;
+import com.vmware.vim25.HostNetworkPolicy;
+import com.vmware.vim25.HostNetworkSecurityPolicy;
 import com.vmware.vim25.HostNetworkTrafficShapingPolicy;
 import com.vmware.vim25.HostPortGroupSpec;
 import com.vmware.vim25.HostVirtualSwitch;
@@ -563,7 +565,13 @@ public class HypervisorHostHelper {
         }
         
         networkName = composeCloudNetworkName(namePrefix, vlanId, networkRateMbps, vSwitchName);
-
+        HostNetworkSecurityPolicy secPolicy = null;
+        if (namePrefix.equalsIgnoreCase("cloud.private")) {
+            secPolicy = new HostNetworkSecurityPolicy();
+            secPolicy.setAllowPromiscuous(Boolean.TRUE);
+            secPolicy.setForgedTransmits(Boolean.TRUE);
+            secPolicy.setMacChanges(Boolean.TRUE);
+        }
         HostNetworkTrafficShapingPolicy shapingPolicy = null;
         if(networkRateMbps != null && networkRateMbps.intValue() > 0) {
             shapingPolicy = new HostNetworkTrafficShapingPolicy();
@@ -583,12 +591,12 @@ public class HypervisorHostHelper {
 
         boolean bWaitPortGroupReady = false;
         if (!hostMo.hasPortGroup(vSwitch, networkName)) {
-            hostMo.createPortGroup(vSwitch, networkName, vid, shapingPolicy);
+            hostMo.createPortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
             bWaitPortGroupReady = true;
         } else {
             HostPortGroupSpec spec = hostMo.getPortGroupSpec(networkName);
             if(!isSpecMatch(spec, vid, shapingPolicy)) {
-                hostMo.updatePortGroup(vSwitch, networkName, vid, shapingPolicy);
+                hostMo.updatePortGroup(vSwitch, networkName, vid, secPolicy, shapingPolicy);
                 bWaitPortGroupReady = true;
             }
         }


Mime
View raw message