Search in sources :

Example 1 with HostFirewallSystemMO

use of com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO 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

HostFirewallSystemMO (com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO)1 VirtualSwitchType (com.cloud.hypervisor.vmware.mo.VirtualSwitchType)1 VmwareTrafficLabel (com.cloud.network.VmwareTrafficLabel)1