Search in sources :

Example 6 with VirtualSwitchType

use of com.cloud.hypervisor.vmware.mo.VirtualSwitchType in project cloudstack by apache.

the class VmwareManagerImpl method prepareHost.

private void prepareHost(HostMO hostMo, String privateTrafficLabel) throws Exception {
    // For ESX host, we need to enable host firewall to allow VNC access
    HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO();
    if (firewallMo != null) {
        if (hostMo.getHostType() == VmwareHostType.ESX) {
            firewallMo.enableRuleset("vncServer");
            firewallMo.refreshFirewall();
        }
    }
    // prepare at least one network on the vswitch to enable OVF importing
    String vSwitchName;
    String vlanId;
    String vSwitchType;
    VmwareTrafficLabel mgmtTrafficLabelObj = new VmwareTrafficLabel(privateTrafficLabel, TrafficType.Management);
    vSwitchName = mgmtTrafficLabelObj.getVirtualSwitchName();
    vlanId = mgmtTrafficLabelObj.getVlanId();
    vSwitchType = mgmtTrafficLabelObj.getVirtualSwitchType().toString();
    s_logger.info("Preparing network on host " + hostMo.getContext().toString() + " for " + privateTrafficLabel);
    VirtualSwitchType vsType = VirtualSwitchType.getType(vSwitchType);
    //The management network is probably always going to be a physical network with islation type of vlans, so assume BroadcastDomainType VLAN
    if (VirtualSwitchType.StandardVirtualSwitch == vsType) {
        HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false, BroadcastDomainType.Vlan, null);
    } else {
        HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId, null, null, null, 180000, vsType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, null);
    }
}
Also used : VmwareTrafficLabel(com.cloud.network.VmwareTrafficLabel) HostFirewallSystemMO(com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO) VirtualSwitchType(com.cloud.hypervisor.vmware.mo.VirtualSwitchType)

Aggregations

VirtualSwitchType (com.cloud.hypervisor.vmware.mo.VirtualSwitchType)6 VmwareTrafficLabel (com.cloud.network.VmwareTrafficLabel)3 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)3 CloudException (com.cloud.exception.CloudException)2 HostMO (com.cloud.hypervisor.vmware.mo.HostMO)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ConfigurationException (javax.naming.ConfigurationException)2 ClusterVO (com.cloud.dc.ClusterVO)1 NetworkType (com.cloud.dc.DataCenter.NetworkType)1 DataCenterVO (com.cloud.dc.DataCenterVO)1 DiscoveredWithErrorException (com.cloud.exception.DiscoveredWithErrorException)1 DiscoveryException (com.cloud.exception.DiscoveryException)1 InternalErrorException (com.cloud.exception.InternalErrorException)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 ResourceInUseException (com.cloud.exception.ResourceInUseException)1 HostVO (com.cloud.host.HostVO)1 ClusterMO (com.cloud.hypervisor.vmware.mo.ClusterMO)1 DatacenterMO (com.cloud.hypervisor.vmware.mo.DatacenterMO)1 HostFirewallSystemMO (com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO)1 VmwareResource (com.cloud.hypervisor.vmware.resource.VmwareResource)1