229229import com .cloud .network .LoadBalancerConfigurator ;
230230import com .cloud .network .Networks ;
231231import com .cloud .network .Networks .BroadcastDomainType ;
232+ import com .cloud .network .Networks .IsolationType ;
232233import com .cloud .network .Networks .TrafficType ;
233234import com .cloud .network .VmwareTrafficLabel ;
234235import com .cloud .network .rules .FirewallRule ;
@@ -1787,12 +1788,15 @@ private void plugPublicNic(VirtualMachineMO vmMo, final String vlanId, final Str
17871788 if (_publicTrafficInfo != null ) {
17881789 vSwitchType = _publicTrafficInfo .getVirtualSwitchType ();
17891790 }
1791+ /** FIXME We have no clue which network this nic is on and that means that we can't figure out the BroadcastDomainType
1792+ * so we assume that it's VLAN for now
1793+ */
17901794 if (VirtualSwitchType .StandardVirtualSwitch == vSwitchType ) {
17911795 networkInfo = HypervisorHostHelper .prepareNetwork (_publicTrafficInfo .getVirtualSwitchName (), "cloud.public" ,
1792- vmMo .getRunningHost (), vlanId , null , null , _ops_timeout , true );
1796+ vmMo .getRunningHost (), vlanId , null , null , _ops_timeout , true , BroadcastDomainType . Vlan );
17931797 } else {
1794- networkInfo = HypervisorHostHelper .prepareNetwork (this . _publicTrafficInfo .getVirtualSwitchName (), "cloud.public" ,
1795- vmMo .getRunningHost (), vlanId , null , null , null , this . _ops_timeout , vSwitchType , _portsPerDvPortGroup , null , false );
1798+ networkInfo = HypervisorHostHelper .prepareNetwork (_publicTrafficInfo .getVirtualSwitchName (), "cloud.public" ,
1799+ vmMo .getRunningHost (), vlanId , null , null , null , _ops_timeout , vSwitchType , _portsPerDvPortGroup , null , false , BroadcastDomainType . Vlan );
17961800 }
17971801
17981802 int nicIndex = allocPublicNicIndex (vmMo );
@@ -2953,7 +2957,7 @@ private Pair<ManagedObjectReference, String> prepareNetworkFromNicInfo(HostMO ho
29532957 if (VirtualSwitchType .StandardVirtualSwitch == switchType ) {
29542958 networkInfo = HypervisorHostHelper .prepareNetwork (switchName .first (), namePrefix ,
29552959 hostMo , getVlanInfo (nicTo , switchName .second ()), nicTo .getNetworkRateMbps (), nicTo .getNetworkRateMulticastMbps (), _ops_timeout ,
2956- !namePrefix .startsWith ("cloud.private" ));
2960+ !namePrefix .startsWith ("cloud.private" ), nicTo . getBroadcastType () );
29572961 }
29582962 else {
29592963 String vlanId = getVlanInfo (nicTo , switchName .second ());
@@ -2967,7 +2971,8 @@ hostMo, getVlanInfo(nicTo, switchName.second()), nicTo.getNetworkRateMbps(), nic
29672971 svlanId = getPvlanInfo (nicTo );
29682972 }
29692973 networkInfo = HypervisorHostHelper .prepareNetwork (switchName .first (), namePrefix , hostMo , vlanId , svlanId ,
2970- nicTo .getNetworkRateMbps (), nicTo .getNetworkRateMulticastMbps (), _ops_timeout , switchType , _portsPerDvPortGroup , nicTo .getGateway (), configureVServiceInNexus );
2974+ nicTo .getNetworkRateMbps (), nicTo .getNetworkRateMulticastMbps (), _ops_timeout , switchType ,
2975+ _portsPerDvPortGroup , nicTo .getGateway (), configureVServiceInNexus , nicTo .getBroadcastType ());
29712976 }
29722977
29732978 return networkInfo ;
@@ -5329,73 +5334,6 @@ private VirtualMachineGuestOsIdentifier translateGuestOsIdentifier(String cpuArc
53295334 return VirtualMachineGuestOsIdentifier .OTHER_GUEST ;
53305335 }
53315336
5332- private void prepareNetworkForVmTargetHost (HostMO hostMo , VirtualMachineMO vmMo ) throws Exception {
5333- assert (vmMo != null );
5334- assert (hostMo != null );
5335-
5336- String [] networks = vmMo .getNetworks ();
5337- for (String networkName : networks ) {
5338- HostPortGroupSpec portGroupSpec = hostMo .getHostPortGroupSpec (networkName );
5339- HostNetworkTrafficShapingPolicy shapingPolicy = null ;
5340- if (portGroupSpec != null ) {
5341- shapingPolicy = portGroupSpec .getPolicy ().getShapingPolicy ();
5342- }
5343-
5344- if (networkName .startsWith ("cloud.private" )) {
5345- String [] tokens = networkName .split ("\\ ." );
5346- if (tokens .length == 3 ) {
5347- Integer networkRateMbps = null ;
5348- if (shapingPolicy != null && shapingPolicy .isEnabled () != null && shapingPolicy .isEnabled ().booleanValue ()) {
5349- networkRateMbps = (int ) (shapingPolicy .getPeakBandwidth ().longValue () / (1024 * 1024 ));
5350- }
5351- String vlanId = null ;
5352- if (!"untagged" .equalsIgnoreCase (tokens [2 ]))
5353- vlanId = tokens [2 ];
5354-
5355- HypervisorHostHelper .prepareNetwork (_privateNetworkVSwitchName , "cloud.private" ,
5356- hostMo , vlanId , networkRateMbps , null , _ops_timeout , false );
5357- } else {
5358- s_logger .info ("Skip suspecious cloud network " + networkName );
5359- }
5360- } else if (networkName .startsWith ("cloud.public" )) {
5361- String [] tokens = networkName .split ("\\ ." );
5362- if (tokens .length == 3 ) {
5363- Integer networkRateMbps = null ;
5364- if (shapingPolicy != null && shapingPolicy .isEnabled () != null && shapingPolicy .isEnabled ().booleanValue ()) {
5365- networkRateMbps = (int ) (shapingPolicy .getPeakBandwidth ().longValue () / (1024 * 1024 ));
5366- }
5367- String vlanId = null ;
5368- if (!"untagged" .equalsIgnoreCase (tokens [2 ]))
5369- vlanId = tokens [2 ];
5370-
5371- HypervisorHostHelper .prepareNetwork (_publicTrafficInfo .getVirtualSwitchName (), "cloud.public" ,
5372- hostMo , vlanId , networkRateMbps , null , _ops_timeout , false );
5373- } else {
5374- s_logger .info ("Skip suspecious cloud network " + networkName );
5375- }
5376- } else if (networkName .startsWith ("cloud.guest" )) {
5377- String [] tokens = networkName .split ("\\ ." );
5378- if (tokens .length >= 3 ) {
5379- Integer networkRateMbps = null ;
5380- if (shapingPolicy != null && shapingPolicy .isEnabled () != null && shapingPolicy .isEnabled ().booleanValue ()) {
5381- networkRateMbps = (int ) (shapingPolicy .getPeakBandwidth ().longValue () / (1024 * 1024 ));
5382- }
5383-
5384- String vlanId = null ;
5385- if (!"untagged" .equalsIgnoreCase (tokens [2 ]))
5386- vlanId = tokens [2 ];
5387-
5388- HypervisorHostHelper .prepareNetwork (_guestTrafficInfo .getVirtualSwitchName (), "cloud.guest" ,
5389- hostMo , vlanId , networkRateMbps , null , _ops_timeout , false );
5390- } else {
5391- s_logger .info ("Skip suspecious cloud network " + networkName );
5392- }
5393- } else {
5394- s_logger .info ("Skip non-cloud network " + networkName + " when preparing target host" );
5395- }
5396- }
5397- }
5398-
53995337 private HashMap <String , State > getVmStates () throws Exception {
54005338 VmwareHypervisorHost hyperHost = getHyperHost (getServiceContext ());
54015339 ObjectContent [] ocs = hyperHost .getVmPropertiesOnHyperHost (new String [] { "name" , "runtime.powerState" , "config.template" });
0 commit comments