mirror of https://github.com/apache/cloudstack.git
add ui changes + update nsx_provider table transport zones + use NSX broadcast domain for add nics to router
This commit is contained in:
parent
755ebba443
commit
61bc513d6f
|
|
@ -32,6 +32,9 @@ public class NicTO extends NetworkTO {
|
|||
Map<NetworkOffering.Detail, String> details;
|
||||
boolean dpdkEnabled;
|
||||
Integer mtu;
|
||||
Long networkId;
|
||||
|
||||
String networkSegmentName;
|
||||
|
||||
public NicTO() {
|
||||
super();
|
||||
|
|
@ -127,4 +130,20 @@ public class NicTO extends NetworkTO {
|
|||
public void setMtu(Integer mtu) {
|
||||
this.mtu = mtu;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public void setNetworkId(Long networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public String getNetworkSegmentName() {
|
||||
return networkSegmentName;
|
||||
}
|
||||
|
||||
public void setNetworkSegmentName(String networkSegmentName) {
|
||||
this.networkSegmentName = networkSegmentName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public class VirtualMachineTO {
|
|||
|
||||
Map<String, String> guestOsDetails = new HashMap<String, String>();
|
||||
Map<String, String> extraConfig = new HashMap<>();
|
||||
Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
|
||||
DeployAsIsInfoTO deployAsIsInfo;
|
||||
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
|
||||
|
|
@ -392,6 +393,14 @@ public class VirtualMachineTO {
|
|||
return extraConfig;
|
||||
}
|
||||
|
||||
public Map<Long, String> getNetworkIdToNetworkNameMap() {
|
||||
return networkIdToNetworkNameMap;
|
||||
}
|
||||
|
||||
public void setNetworkIdToNetworkNameMap(Map<Long, String> networkIdToNetworkNameMap) {
|
||||
this.networkIdToNetworkNameMap = networkIdToNetworkNameMap;
|
||||
}
|
||||
|
||||
public String getBootType() {
|
||||
return bootType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,6 @@ public interface NsxProvider extends InternalIdentity, Identity {
|
|||
|
||||
String getTier0Gateway();
|
||||
String getEdgeCluster();
|
||||
|
||||
String getTransportZone();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -683,6 +683,8 @@ public class ApiConstants {
|
|||
// NSX
|
||||
public static final String EDGE_CLUSTER = "edgecluster";
|
||||
public static final String TIER0_GATEWAY = "tier0gateway";
|
||||
|
||||
public static final String TRANSPORT_ZONE = "transportzone";
|
||||
// Tungsten-Fabric
|
||||
public static final String TUNGSTEN_VIRTUAL_ROUTER_UUID = "tungstenvirtualrouteruuid";
|
||||
public static final String TUNGSTEN_PROVIDER_HOSTNAME = "tungstenproviderhostname";
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
|
|
@ -47,6 +48,9 @@ import javax.inject.Inject;
|
|||
import javax.naming.ConfigurationException;
|
||||
import javax.persistence.EntityExistsException;
|
||||
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
import com.cloud.network.vpc.dao.VpcDao;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import org.apache.cloudstack.annotation.AnnotationService;
|
||||
import org.apache.cloudstack.annotation.dao.AnnotationDao;
|
||||
|
|
@ -383,6 +387,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
private DomainRouterJoinDao domainRouterJoinDao;
|
||||
@Inject
|
||||
private AnnotationDao annotationDao;
|
||||
@Inject
|
||||
private AccountDao accountDao;
|
||||
@Inject
|
||||
private VpcDao vpcDao;
|
||||
|
||||
VmWorkJobHandlerProxy _jobHandlerProxy = new VmWorkJobHandlerProxy(this);
|
||||
|
||||
|
|
@ -1277,6 +1285,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
checkAndSetEnterSetupMode(vmTO, params);
|
||||
|
||||
handlePath(vmTO.getDisks(), vm.getHypervisorType());
|
||||
setVmNetworkDetails(vm, vmTO);
|
||||
|
||||
|
||||
Commands cmds = new Commands(Command.OnError.Stop);
|
||||
final Map<String, String> sshAccessDetails = _networkMgr.getSystemVMAccessDetails(vm);
|
||||
|
|
@ -1459,6 +1469,28 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
}
|
||||
|
||||
private void setVmNetworkDetails(VMInstanceVO vm, VirtualMachineTO vmTO) {
|
||||
if (VirtualMachine.Type.User.equals(vm.getType())) {
|
||||
List<UserVmJoinVO> userVmJoinVOs = userVmJoinDao.searchByIds(vm.getId());
|
||||
Map<Long, String> networkToNetworkNameMap = new HashMap<>();
|
||||
if (userVmJoinVOs != null && !userVmJoinVOs.isEmpty()) {
|
||||
for (UserVmJoinVO userVmJoinVO : userVmJoinVOs) {
|
||||
NetworkVO networkVO = _networkDao.findById(userVmJoinVO.getNetworkId());
|
||||
Account acc = accountDao.findById(networkVO.getAccountId());
|
||||
String networkName = acc.getAccountName() + "-" ;
|
||||
if (Objects.isNull(networkVO.getVpcId())) {
|
||||
networkName += networkVO.getName();
|
||||
} else {
|
||||
VpcVO vpc = vpcDao.findById(networkVO.getVpcId());
|
||||
networkName += (vpc.getName() + "-" + networkVO.getName());
|
||||
}
|
||||
networkToNetworkNameMap.put(networkVO.getId(), networkName);
|
||||
}
|
||||
vmTO.setNetworkIdToNetworkNameMap(networkToNetworkNameMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void logBootModeParameters(Map<VirtualMachineProfile.Param, Object> params) {
|
||||
if (params == null) {
|
||||
return;
|
||||
|
|
@ -2712,6 +2744,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
|
||||
final VirtualMachineTO to = toVmTO(profile);
|
||||
final PrepareForMigrationCommand pfmc = new PrepareForMigrationCommand(to);
|
||||
setVmNetworkDetails(vm, to);
|
||||
|
||||
ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Migrating, vm.getType(), vm.getId());
|
||||
work.setStep(Step.Prepare);
|
||||
|
|
|
|||
|
|
@ -1704,7 +1704,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
}
|
||||
|
||||
//apply network ACLs
|
||||
if (!_networkACLMgr.applyACLToNetwork(networkId)) {
|
||||
// TODO: remove check for NSX
|
||||
if (!offering.isForNsx() && !_networkACLMgr.applyACLToNetwork(networkId)) {
|
||||
s_logger.warn("Failed to reapply network ACLs as a part of of network id=" + networkId + " restart");
|
||||
success = false;
|
||||
}
|
||||
|
|
@ -3855,7 +3856,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
|
||||
private boolean cleanupNetworkResources(final long networkId, final Account caller, final long callerUserId) {
|
||||
boolean success = true;
|
||||
final Network network = _networksDao.findById(networkId);
|
||||
final NetworkVO network = _networksDao.findById(networkId);
|
||||
final NetworkOfferingVO networkOffering= _networkOfferingDao.findById(network.getNetworkOfferingId());
|
||||
|
||||
//remove all PF/Static Nat rules for the network
|
||||
try {
|
||||
|
|
@ -3895,8 +3897,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
}
|
||||
|
||||
//revoke all network ACLs for network
|
||||
// TODO: Change this when ACLs are supported for NSX
|
||||
try {
|
||||
if (_networkACLMgr.revokeACLItemsForNetwork(networkId)) {
|
||||
if (networkOffering.isForNsx() || _networkACLMgr.revokeACLItemsForNetwork(networkId)) {
|
||||
s_logger.debug("Successfully cleaned up NetworkACLs for network id=" + networkId);
|
||||
} else {
|
||||
success = false;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
|
|
@ -67,6 +68,14 @@ public class NsxProviderVO implements NsxProvider {
|
|||
@Column(name = "edge_cluster")
|
||||
private String edgeCluster;
|
||||
|
||||
@Column(name = "transport_zone")
|
||||
private String transportZone;
|
||||
|
||||
@Column(name = "created")
|
||||
private Date created;
|
||||
|
||||
@Column(name = "removed")
|
||||
private Date removed;
|
||||
public NsxProviderVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
@ -166,6 +175,30 @@ public class NsxProviderVO implements NsxProvider {
|
|||
this.edgeCluster = edgeCluster;
|
||||
}
|
||||
|
||||
public String getTransportZone() {
|
||||
return transportZone;
|
||||
}
|
||||
|
||||
public void setTransportZone(String transportZone) {
|
||||
this.transportZone = transportZone;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
public void setRemoved(Date removed) {
|
||||
this.removed = removed;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private long zoneId;
|
||||
private long hostId;
|
||||
|
|
@ -176,6 +209,8 @@ public class NsxProviderVO implements NsxProvider {
|
|||
private String password;
|
||||
private String tier0Gateway;
|
||||
private String edgeCluster;
|
||||
private String transportZone;
|
||||
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
|
@ -224,6 +259,11 @@ public class NsxProviderVO implements NsxProvider {
|
|||
this.edgeCluster = edgeCluster;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTransportZone(String transportZone) {
|
||||
this.transportZone = transportZone;
|
||||
return this;
|
||||
}
|
||||
public NsxProviderVO build() {
|
||||
NsxProviderVO provider = new NsxProviderVO();
|
||||
provider.setZoneId(this.zoneId);
|
||||
|
|
@ -236,6 +276,8 @@ public class NsxProviderVO implements NsxProvider {
|
|||
provider.setPassword(this.password);
|
||||
provider.setTier0Gateway(this.tier0Gateway);
|
||||
provider.setEdgeCluster(this.edgeCluster);
|
||||
provider.setTransportZone(this.transportZone);
|
||||
provider.setCreated(new Date());
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ CREATE TABLE `cloud`.`nsx_providers` (
|
|||
`password` varchar(255) NOT NULL,
|
||||
`tier0_gateway` varchar(255),
|
||||
`edge_cluster` varchar(255),
|
||||
`transport_zone` varchar(255),
|
||||
`created` datetime NOT NULL COMMENT 'date created',
|
||||
`removed` datetime COMMENT 'date removed if not null',
|
||||
PRIMARY KEY (`id`),
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||
}
|
||||
}
|
||||
HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId, null, null, null, 180000,
|
||||
vsType, portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, null, null);
|
||||
vsType, portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
HostMO hostMO = new HostMO(context, host.getMor());
|
||||
|
||||
try {
|
||||
prepareNetworkFromNicInfo(hostMO, cmd.getNic(), false, null);
|
||||
prepareNetworkFromNicInfo(hostMO, cmd.getNic(), false, null, null);
|
||||
hostname = host.getHyperHostName();
|
||||
} catch (Exception e) {
|
||||
return new SetupPersistentNetworkAnswer(cmd, false, "failed to setup port-group due to: "+ e.getLocalizedMessage());
|
||||
|
|
@ -1475,7 +1475,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
deviceNumber++;
|
||||
|
||||
VirtualDevice nic;
|
||||
Pair<ManagedObjectReference, String> networkInfo = prepareNetworkFromNicInfo(vmMo.getRunningHost(), nicTo, false, vmType);
|
||||
Pair<ManagedObjectReference, String> networkInfo = prepareNetworkFromNicInfo(vmMo.getRunningHost(), nicTo, false, nicTo.getNetworkSegmentName(), vmType);
|
||||
String dvSwitchUuid = null;
|
||||
if (VmwareHelper.isDvPortGroup(networkInfo.first())) {
|
||||
ManagedObjectReference dcMor = hyperHost.getHyperHostDatacenter();
|
||||
|
|
@ -1537,7 +1537,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
return new ReplugNicAnswer(cmd, false, "Nic to replug not found");
|
||||
}
|
||||
|
||||
Pair<ManagedObjectReference, String> networkInfo = prepareNetworkFromNicInfo(vmMo.getRunningHost(), nicTo, false, cmd.getVMType());
|
||||
Pair<ManagedObjectReference, String> networkInfo = prepareNetworkFromNicInfo(vmMo.getRunningHost(), nicTo, false, null, cmd.getVMType());
|
||||
String dvSwitchUuid = null;
|
||||
if (VmwareHelper.isDvPortGroup(networkInfo.first())) {
|
||||
ManagedObjectReference dcMor = hyperHost.getHyperHostDatacenter();
|
||||
|
|
@ -1619,7 +1619,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
} else {
|
||||
networkInfo =
|
||||
HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public", vmMo.getRunningHost(), vlanId, null, ipAddressTO.getNetworkRate(), null,
|
||||
_opsTimeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, _vsmCredentials, null);
|
||||
_opsTimeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, _vsmCredentials, null, null);
|
||||
}
|
||||
|
||||
int nicIndex = allocPublicNicIndex(vmMo);
|
||||
|
|
@ -2528,7 +2528,8 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
}
|
||||
boolean configureVServiceInNexus = (nicTo.getType() == TrafficType.Guest) && (vmSpec.getDetails().containsKey("ConfigureVServiceInNexus"));
|
||||
VirtualMachine.Type vmType = cmd.getVirtualMachine().getType();
|
||||
Pair<ManagedObjectReference, String> networkInfo = prepareNetworkFromNicInfo(vmMo.getRunningHost(), nicTo, configureVServiceInNexus, vmType);
|
||||
Pair<ManagedObjectReference, String> networkInfo = prepareNetworkFromNicInfo(vmMo.getRunningHost(), nicTo, configureVServiceInNexus,
|
||||
vmSpec.getNetworkIdToNetworkNameMap().getOrDefault(nicTo.getNetworkId(), null), vmType);
|
||||
if ((nicTo.getBroadcastType() != BroadcastDomainType.Lswitch)
|
||||
|| (nicTo.getBroadcastType() == BroadcastDomainType.Lswitch && NiciraNvpApiVersion.isApiVersionLowerThan("4.2"))) {
|
||||
if (VmwareHelper.isDvPortGroup(networkInfo.first())) {
|
||||
|
|
@ -3984,7 +3985,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
return defaultVlan;
|
||||
}
|
||||
|
||||
private Pair<ManagedObjectReference, String> prepareNetworkFromNicInfo(HostMO hostMo, NicTO nicTo, boolean configureVServiceInNexus, VirtualMachine.Type vmType)
|
||||
private Pair<ManagedObjectReference, String> prepareNetworkFromNicInfo(HostMO hostMo, NicTO nicTo, boolean configureVServiceInNexus, String networkName, VirtualMachine.Type vmType)
|
||||
throws Exception {
|
||||
|
||||
Ternary<String, String, String> switchDetails = getTargetSwitch(nicTo);
|
||||
|
|
@ -4014,7 +4015,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
}
|
||||
networkInfo = HypervisorHostHelper.prepareNetwork(switchName, namePrefix, hostMo, vlanId, svlanId,
|
||||
nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _opsTimeout, switchType,
|
||||
_portsPerDvPortGroup, nicTo.getGateway(), configureVServiceInNexus, nicTo.getBroadcastType(), _vsmCredentials, nicTo.getDetails());
|
||||
_portsPerDvPortGroup, nicTo.getGateway(), configureVServiceInNexus, nicTo.getBroadcastType(), _vsmCredentials, nicTo.getDetails(), networkName);
|
||||
}
|
||||
|
||||
return networkInfo;
|
||||
|
|
@ -4605,7 +4606,8 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
NicTO[] nics = vm.getNics();
|
||||
for (NicTO nic : nics) {
|
||||
// prepare network on the host
|
||||
prepareNetworkFromNicInfo(new HostMO(getServiceContext(), _morHyperHost), nic, false, cmd.getVirtualMachine().getType());
|
||||
prepareNetworkFromNicInfo(new HostMO(getServiceContext(), _morHyperHost), nic, false,
|
||||
vm.getNetworkIdToNetworkNameMap().getOrDefault(nic.getNetworkId(), null), cmd.getVirtualMachine().getType());
|
||||
}
|
||||
|
||||
List<Pair<String, Long>> secStoreUrlAndIdList = mgr.getSecondaryStorageStoresUrlAndIdList(Long.parseLong(_dcId));
|
||||
|
|
@ -5673,7 +5675,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
}
|
||||
|
||||
protected Answer execute(MaintainCommand cmd) {
|
||||
return new MaintainAnswer(cmd, "Put host in maintaince");
|
||||
return new MaintainAnswer(cmd, "Put host in maintenance");
|
||||
}
|
||||
|
||||
protected Answer execute(PingTestCommand cmd) {
|
||||
|
|
@ -7576,7 +7578,8 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
|||
NicTO[] nics = vmTo.getNics();
|
||||
for (NicTO nic : nics) {
|
||||
// prepare network on the host
|
||||
prepareNetworkFromNicInfo((HostMO)targetHyperHost, nic, false, vmTo.getType());
|
||||
prepareNetworkFromNicInfo((HostMO)targetHyperHost, nic, false,
|
||||
vmTo.getNetworkIdToNetworkNameMap().get(nic.getNetworkId()), vmTo.getType());
|
||||
}
|
||||
|
||||
if (targetHyperHost == null) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.apache.cloudstack.agent.api;
|
|||
import com.cloud.network.dao.NetworkVO;
|
||||
|
||||
public class DeleteNsxSegmentCommand extends CreateNsxSegmentCommand {
|
||||
public DeleteNsxSegmentCommand(String accountName, NetworkVO network) {
|
||||
super(null, network.getDataCenterId(), accountName, network.getAccountId(), null, network);
|
||||
public DeleteNsxSegmentCommand(String accountName, String vpcName, NetworkVO network) {
|
||||
super(null, network.getDataCenterId(), accountName, network.getAccountId(), vpcName, network);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ public class AddNsxControllerCmd extends BaseCmd {
|
|||
@Parameter(name = ApiConstants.EDGE_CLUSTER, type = CommandType.STRING, required = true, description = "Edge Cluster name")
|
||||
private String edgeCluster;
|
||||
|
||||
@Parameter(name = ApiConstants.TRANSPORT_ZONE, type = CommandType.STRING, required = true, description = "Transport Zone controls to which hosts a logical switch can reach")
|
||||
private String transportZone;
|
||||
|
||||
public NsxProviderService getNsxProviderService() {
|
||||
return nsxProviderService;
|
||||
}
|
||||
|
|
@ -102,6 +105,10 @@ public class AddNsxControllerCmd extends BaseCmd {
|
|||
return edgeCluster;
|
||||
}
|
||||
|
||||
public String getTransportZone() {
|
||||
return transportZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ServerApiException {
|
||||
NsxProvider nsxProvider = nsxProviderService.addProvider(this);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ public class NsxControllerResponse extends BaseResponse {
|
|||
@Param(description = "The name of the edge cluster. An edge cluster is a logical grouping of edge nodes in NSX")
|
||||
private String edgeCluster;
|
||||
|
||||
@SerializedName(ApiConstants.TRANSPORT_ZONE)
|
||||
@Param(description = "The name of the transport zone. A transport zone controls to which hosts a logical switch can reach")
|
||||
private String transportZone;
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
|
@ -121,4 +125,12 @@ public class NsxControllerResponse extends BaseResponse {
|
|||
public void setEdgeCluster(String edgeCluster) {
|
||||
this.edgeCluster = edgeCluster;
|
||||
}
|
||||
|
||||
public String getTransportZone() {
|
||||
return transportZone;
|
||||
}
|
||||
|
||||
public void setTransportZone(String transportZone) {
|
||||
this.transportZone = transportZone;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.resource;
|
||||
|
||||
import com.amazonaws.util.CollectionUtils;
|
||||
import com.cloud.agent.IAgentControl;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
|
|
@ -27,14 +28,21 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||
import com.cloud.host.Host;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
import com.vmware.nsx.model.TransportZone;
|
||||
import com.vmware.nsx.model.TransportZoneListResult;
|
||||
import com.vmware.nsx_policy.infra.Segments;
|
||||
import com.vmware.nsx_policy.infra.Sites;
|
||||
import com.vmware.nsx_policy.infra.Tier1s;
|
||||
import com.vmware.nsx_policy.infra.sites.EnforcementPoints;
|
||||
import com.vmware.nsx_policy.infra.tier_0s.LocaleServices;
|
||||
import com.vmware.nsx_policy.model.ApiError;
|
||||
import com.vmware.nsx_policy.model.ChildLocaleServices;
|
||||
import com.vmware.nsx_policy.model.EnforcementPointListResult;
|
||||
import com.vmware.nsx_policy.model.LocaleServicesListResult;
|
||||
import com.vmware.nsx_policy.model.Segment;
|
||||
import com.vmware.nsx_policy.model.SegmentSubnet;
|
||||
import com.vmware.nsx_policy.model.SiteListResult;
|
||||
import com.vmware.nsx_policy.model.Tier1;
|
||||
import com.vmware.vapi.bindings.Service;
|
||||
import com.vmware.vapi.std.errors.Error;
|
||||
|
|
@ -53,11 +61,13 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Objects.isNull;
|
||||
import static org.apache.cloudstack.utils.NsxApiClientUtils.HAMode.ACTIVE_STANDBY;
|
||||
import static org.apache.cloudstack.utils.NsxApiClientUtils.FailoverMode.PREEMPTIVE;
|
||||
import static org.apache.cloudstack.utils.NsxApiClientUtils.PoolAllocation.ROUTING;
|
||||
import static org.apache.cloudstack.utils.NsxApiClientUtils.TransportType.OVERLAY;
|
||||
import static org.apache.cloudstack.utils.NsxApiClientUtils.createApiClient;
|
||||
|
||||
public class NsxResource implements ServerResource {
|
||||
|
|
@ -75,6 +85,7 @@ public class NsxResource implements ServerResource {
|
|||
protected String port;
|
||||
protected String tier0Gateway;
|
||||
protected String edgeCluster;
|
||||
protected String transportZone;
|
||||
protected String zoneId;
|
||||
|
||||
protected NsxApi nsxApi;
|
||||
|
|
@ -211,6 +222,11 @@ public class NsxResource implements ServerResource {
|
|||
throw new ConfigurationException("Missing NSX edgeCluster");
|
||||
}
|
||||
|
||||
transportZone = (String) params.get("transportZone");
|
||||
if (transportZone == null) {
|
||||
throw new ConfigurationException("Missing NSX transportZone");
|
||||
}
|
||||
|
||||
nsxApi = new NsxApi();
|
||||
nsxApi.setApiClient(createApiClient(hostname, port, username, password.toCharArray()));
|
||||
return true;
|
||||
|
|
@ -270,6 +286,36 @@ public class NsxResource implements ServerResource {
|
|||
|
||||
private Answer executeRequest(CreateNsxSegmentCommand cmd) {
|
||||
try {
|
||||
SiteListResult sites = getSites();
|
||||
String errorMsg = null;
|
||||
if (CollectionUtils.isNullOrEmpty(sites.getResults())) {
|
||||
errorMsg = String.format("Failed to create network: %s as no sites are found in the linked NSX infrastructure", cmd.getTierNetwork().getName());
|
||||
LOGGER.error(errorMsg);
|
||||
return new NsxAnswer(cmd, new CloudRuntimeException(errorMsg));
|
||||
}
|
||||
String siteId = sites.getResults().get(0).getId();
|
||||
|
||||
EnforcementPointListResult epList = getEnforcementPoints(siteId);
|
||||
if (CollectionUtils.isNullOrEmpty(epList.getResults())) {
|
||||
errorMsg = String.format("Failed to create network: %s as no enforcement points are found in the linked NSX infrastructure", cmd.getTierNetwork().getName());
|
||||
LOGGER.error(errorMsg);
|
||||
return new NsxAnswer(cmd, new CloudRuntimeException(errorMsg));
|
||||
}
|
||||
String enforcementPointPath = epList.getResults().get(0).getPath();
|
||||
|
||||
TransportZoneListResult transportZoneListResult = getTransportZones();
|
||||
if (CollectionUtils.isNullOrEmpty(transportZoneListResult.getResults())) {
|
||||
errorMsg = String.format("Failed to create network: %s as no transport zones were found in the linked NSX infrastructure", cmd.getTierNetwork().getName());
|
||||
LOGGER.error(errorMsg);
|
||||
return new NsxAnswer(cmd, new CloudRuntimeException(errorMsg));
|
||||
}
|
||||
List<TransportZone> transportZones = transportZoneListResult.getResults().stream().filter(tz -> tz.getDisplayName().equals(transportZone)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNullOrEmpty(transportZones)) {
|
||||
errorMsg = String.format("Failed to create network: %s as no transport zone of name %s was found in the linked NSX infrastructure", cmd.getTierNetwork().getName(), transportZone);
|
||||
LOGGER.error(errorMsg);
|
||||
return new NsxAnswer(cmd, new CloudRuntimeException(errorMsg));
|
||||
}
|
||||
|
||||
String segmentName = getSegmentName(cmd);
|
||||
Segments segmentService = (Segments) nsxService.apply(Segments.class);
|
||||
SegmentSubnet subnet = new SegmentSubnet.Builder()
|
||||
|
|
@ -282,6 +328,7 @@ public class NsxResource implements ServerResource {
|
|||
: TIER_1_GATEWAY_PATH_PREFIX + getTier1GatewayName(cmd))
|
||||
.setAdminState(NsxApiClientUtils.AdminState.UP.name())
|
||||
.setSubnets(List.of(subnet))
|
||||
.setTransportZonePath(enforcementPointPath + "/transport-zones/" + transportZones.get(0).getId())
|
||||
.build();
|
||||
segmentService.patch(segmentName, segment);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -323,12 +370,43 @@ public class NsxResource implements ServerResource {
|
|||
return null;
|
||||
}
|
||||
|
||||
private SiteListResult getSites() {
|
||||
try {
|
||||
Sites sites = (Sites) nsxService.apply(Sites.class);
|
||||
return sites.list(null, false, null, null, null, null);
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException(String.format("Failed to fetch service segment list due to %s", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private EnforcementPointListResult getEnforcementPoints(String siteId) {
|
||||
try {
|
||||
EnforcementPoints enforcementPoints = (EnforcementPoints) nsxService.apply(EnforcementPoints.class);
|
||||
return enforcementPoints.list(siteId, null, false, null, null, null, null);
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException(String.format("Failed to fetch service segment list due to %s", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private TransportZoneListResult getTransportZones() {
|
||||
try {
|
||||
com.vmware.nsx.TransportZones transportZones = (com.vmware.nsx.TransportZones) nsxService.apply(com.vmware.nsx.TransportZones.class);
|
||||
return transportZones.list(null, null, true, null, false, null, null, null, OVERLAY.name(), null);
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException(String.format("Failed to fetch service segment list due to %s", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private String getTier1GatewayName(CreateNsxTier1GatewayCommand cmd) {
|
||||
return cmd.getZoneName() + "-" + cmd.getAccountName() + "-" + cmd.getVpcName();
|
||||
}
|
||||
|
||||
private String getSegmentName(CreateNsxSegmentCommand cmd) {
|
||||
return cmd.getAccountName() + "-" + cmd.getTierNetwork().getName();
|
||||
String segmentName = cmd.getAccountName() + "-";
|
||||
if (isNull(cmd.getVpcName())) {
|
||||
return segmentName + cmd.getTierNetwork().getName();
|
||||
}
|
||||
return segmentName + cmd.getVpcName() + "-" + cmd.getTierNetwork().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ public class NsxElement extends AdapterBase implements DhcpServiceProvider, DnsS
|
|||
|
||||
@Override
|
||||
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -293,7 +293,7 @@ public class NsxElement extends AdapterBase implements DhcpServiceProvider, DnsS
|
|||
if (CollectionUtils.isNullOrEmpty(physicalNetworks) || physicalNetworks.size() > 1 ) {
|
||||
throw new InvalidConfigurationException(String.format("Desired number of physical networks is not present in the zone %s for traffic type %s. ", zone.getName(), Networks.TrafficType.Guest.name()));
|
||||
}
|
||||
if (physicalNetworks.get(0).getIsolationMethods().contains(Network.Provider.Nsx.getName())) {
|
||||
if (physicalNetworks.get(0).getIsolationMethods().contains("NSX")) {
|
||||
account = accountMgr.getAccount(vpc.getAccountId());
|
||||
forNsx = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ import com.cloud.deploy.DeploymentPlan;
|
|||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.NetworkMigrationResponder;
|
||||
import com.cloud.network.NetworkProfile;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Networks;
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
|
|
@ -86,7 +86,7 @@ public class NsxGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
|
|||
}
|
||||
|
||||
NetworkVO network = (NetworkVO) super.design(offering, plan, userSpecified, owner);
|
||||
|
||||
network.setBroadcastDomainType(Networks.BroadcastDomainType.NSX);
|
||||
if (network == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ public class NsxGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
|
|||
}
|
||||
|
||||
private void createNsxSegment(NetworkVO networkVO, DataCenter zone) {
|
||||
String vpcName = null;
|
||||
String vpcName = null;
|
||||
if (nonNull(networkVO.getVpcId())) {
|
||||
VpcVO vpc = _vpcDao.findById(networkVO.getVpcId());
|
||||
if (isNull(vpc)) {
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public class NsxProviderServiceImpl implements NsxProviderService {
|
|||
final String password = cmd.getPassword();
|
||||
final String tier0Gateway = cmd.getTier0Gateway();
|
||||
final String edgeCluster = cmd.getEdgeCluster();
|
||||
final String transportZone = cmd.getTransportZone();
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("guid", UUID.randomUUID().toString());
|
||||
|
|
@ -92,6 +93,7 @@ public class NsxProviderServiceImpl implements NsxProviderService {
|
|||
params.put("password", password);
|
||||
params.put("tier0Gateway", tier0Gateway);
|
||||
params.put("edgeCluster", edgeCluster);
|
||||
params.put("transportZone", transportZone);
|
||||
|
||||
Map<String, Object> hostdetails = new HashMap<>(params);
|
||||
NsxProvider nsxProvider;
|
||||
|
|
@ -112,6 +114,7 @@ public class NsxProviderServiceImpl implements NsxProviderService {
|
|||
.setPassword(password)
|
||||
.setTier0Gateway(tier0Gateway)
|
||||
.setEdgeCluster(edgeCluster)
|
||||
.setTransportZone(transportZone)
|
||||
.build();
|
||||
|
||||
nsxProviderDao.persist(nsxProviderVO);
|
||||
|
|
@ -145,7 +148,8 @@ public class NsxProviderServiceImpl implements NsxProviderService {
|
|||
response.setZoneId(zone.getUuid());
|
||||
response.setZoneName(zone.getName());
|
||||
response.setTier0Gateway(nsxProvider.getTier0Gateway());
|
||||
response.setTier0Gateway(nsxProvider.getEdgeCluster());
|
||||
response.setEdgeCluster(nsxProvider.getEdgeCluster());
|
||||
response.setTransportZone(nsxProvider.getTransportZone());
|
||||
response.setObjectName("nsxController");
|
||||
return response;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,16 +17,22 @@
|
|||
package org.apache.cloudstack.service;
|
||||
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
import com.cloud.network.vpc.dao.VpcDao;
|
||||
import org.apache.cloudstack.NsxAnswer;
|
||||
import org.apache.cloudstack.agent.api.CreateNsxTier1GatewayCommand;
|
||||
import org.apache.cloudstack.agent.api.DeleteNsxSegmentCommand;
|
||||
import org.apache.cloudstack.agent.api.DeleteNsxTier1GatewayCommand;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Objects;
|
||||
|
||||
public class NsxServiceImpl implements NsxService {
|
||||
@Inject
|
||||
private NsxControllerUtils nsxControllerUtils;
|
||||
@Inject
|
||||
private VpcDao vpcDao;
|
||||
|
||||
public boolean createVpcNetwork(Long zoneId, String zoneName, Long accountId, String accountName, String vpcName) {
|
||||
CreateNsxTier1GatewayCommand createNsxTier1GatewayCommand =
|
||||
new CreateNsxTier1GatewayCommand(zoneName, zoneId, accountName, accountId, vpcName);
|
||||
|
|
@ -42,7 +48,12 @@ public class NsxServiceImpl implements NsxService {
|
|||
}
|
||||
|
||||
public boolean deleteNetwork(String accountName, NetworkVO network) {
|
||||
DeleteNsxSegmentCommand deleteNsxSegmentCommand = new DeleteNsxSegmentCommand(accountName, network);
|
||||
String vpcName = null;
|
||||
if (Objects.nonNull(network.getVpcId())) {
|
||||
VpcVO vpc = vpcDao.findById(network.getVpcId());
|
||||
vpcName = Objects.nonNull(vpc) ? vpc.getName() : null;
|
||||
}
|
||||
DeleteNsxSegmentCommand deleteNsxSegmentCommand = new DeleteNsxSegmentCommand(accountName, vpcName, network);
|
||||
NsxAnswer result = nsxControllerUtils.sendNsxCommand(deleteNsxSegmentCommand, network.getDataCenterId());
|
||||
return result.getResult();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,11 @@ public class NsxApiClientUtils {
|
|||
UP,
|
||||
DOWN
|
||||
}
|
||||
|
||||
public enum TransportType {
|
||||
OVERLAY,
|
||||
VLAN
|
||||
}
|
||||
public static ApiClient createApiClient(String hostname, String port, String username, char[] password) {
|
||||
String controllerUrl = String.format("https://%s:%s", hostname, port);
|
||||
HttpConfiguration.SslConfiguration.Builder sslConfigBuilder = new HttpConfiguration.SslConfiguration.Builder();
|
||||
|
|
|
|||
|
|
@ -2532,7 +2532,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
// we should actually find the mapping and remove if it exists
|
||||
// but we don't know about vmware/plugin/hypervisors at this point
|
||||
NsxProviderVO nsxProvider = nsxProviderDao.findByZoneId(zoneId);
|
||||
nsxProviderDao.remove(nsxProvider.getId());
|
||||
if (Objects.nonNull(nsxProvider)) {
|
||||
nsxProviderDao.remove(nsxProvider.getId());
|
||||
}
|
||||
|
||||
final boolean success = _zoneDao.remove(zoneId);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,15 @@ package com.cloud.hypervisor;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
import com.cloud.network.vpc.dao.VpcDao;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.backup.Backup;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
|
|
@ -77,6 +82,10 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
|
|||
protected
|
||||
NetworkDao networkDao;
|
||||
@Inject
|
||||
protected VpcDao vpcDao;
|
||||
@Inject
|
||||
protected AccountManager accountManager;
|
||||
@Inject
|
||||
private NetworkOfferingDetailsDao networkOfferingDetailsDao;
|
||||
@Inject
|
||||
protected
|
||||
|
|
@ -146,9 +155,16 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
|
|||
to.setMtu(profile.getMtu());
|
||||
to.setIp6Dns1(profile.getIPv6Dns1());
|
||||
to.setIp6Dns2(profile.getIPv6Dns2());
|
||||
to.setNetworkId(profile.getNetworkId());
|
||||
|
||||
NetworkVO network = networkDao.findById(profile.getNetworkId());
|
||||
to.setNetworkUuid(network.getUuid());
|
||||
Account account = accountManager.getAccount(network.getAccountId());
|
||||
VpcVO vpc = null;
|
||||
if (Objects.nonNull(network) && Objects.nonNull(network.getVpcId())) {
|
||||
vpc = vpcDao.findById(network.getVpcId());
|
||||
}
|
||||
to.setNetworkSegmentName(getNetworkName(account.getAccountName(), vpc, network.getName()));
|
||||
|
||||
// Workaround to make sure the TO has the UUID we need for Nicira integration
|
||||
NicVO nicVO = nicDao.findById(profile.getId());
|
||||
|
|
@ -177,6 +193,14 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
|
|||
return to;
|
||||
}
|
||||
|
||||
private String getNetworkName(String accountName, VpcVO vpc, String networkName) {
|
||||
if (Objects.isNull(vpc)) {
|
||||
return accountName + "-" + networkName;
|
||||
}
|
||||
return accountName + "-" + vpc.getName() + "-" + networkName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add extra configuration from VM details. Extra configuration is stored as details starting with 'extraconfig'
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import java.util.Map;
|
|||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.network.vpc.dao.VpcDao;
|
||||
import com.cloud.utils.validation.ChecksumUtil;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
|
@ -172,6 +173,8 @@ public class NetworkHelperImpl implements NetworkHelper {
|
|||
Ipv6Service ipv6Service;
|
||||
@Inject
|
||||
CapacityManager capacityMgr;
|
||||
@Inject
|
||||
VpcDao vpcDao;
|
||||
|
||||
protected final Map<HypervisorType, ConfigKey<String>> hypervisorsMap = new HashMap<>();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ import java.util.Map;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.vpc.dao.VpcDao;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -128,6 +130,10 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
private EntityManager _entityMgr;
|
||||
@Inject
|
||||
protected HypervisorGuruManager _hvGuruMgr;
|
||||
@Inject
|
||||
protected NetworkDao networkDao;
|
||||
@Inject
|
||||
protected VpcDao vpcDao;
|
||||
|
||||
@Override
|
||||
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
|
||||
|
|
|
|||
|
|
@ -1789,7 +1789,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
|
||||
// 5) When aclId is provided, verify that ACLProvider is supported by
|
||||
// network offering
|
||||
if (aclId != null && !_ntwkModel.areServicesSupportedByNetworkOffering(guestNtwkOff.getId(), Service.NetworkACL)) {
|
||||
if (aclId != null && !_ntwkModel.areServicesSupportedByNetworkOffering(guestNtwkOff.getId(), Service.NetworkACL) && !guestNtwkOff.isForNsx()) {
|
||||
throw new InvalidParameterValueException("Cannot apply NetworkACL. Network Offering does not support NetworkACL service");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1000,7 +1000,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
defaultTungstenSharedSGNetworkOfferingProviders.put(Service.SecurityGroup, Provider.Tungsten);
|
||||
|
||||
final Map<Network.Service, Network.Provider> defaultNSXNetworkOfferingProviders = new HashMap<>();
|
||||
defaultNSXNetworkOfferingProviders.put(Service.Connectivity, Provider.Nsx);
|
||||
//defaultNSXNetworkOfferingProviders.put(Service.Connectivity, Provider.Nsx);
|
||||
defaultNSXNetworkOfferingProviders.put(Service.Dhcp, Provider.Nsx);
|
||||
defaultNSXNetworkOfferingProviders.put(Service.Dns, Provider.Nsx);
|
||||
|
||||
|
|
|
|||
|
|
@ -1383,6 +1383,7 @@
|
|||
"label.nsx.provider.password": "NSX provider password",
|
||||
"label.nsx.provider.edgecluster": "NSX provider edge cluster",
|
||||
"label.nsx.provider.tier0gateway": "NSX provider tier-0 gateway",
|
||||
"label.nsx.provider.transportzone": "NSX provider transport zone",
|
||||
"label.num.cpu.cores": "# of CPU cores",
|
||||
"label.number": "#Rule",
|
||||
"label.numretries": "Number of retries",
|
||||
|
|
@ -2362,6 +2363,7 @@
|
|||
"message.remove.ip.v6.firewall.rule.failed": "Failed to remove IPv6 firewall rule",
|
||||
"message.remove.ip.v6.firewall.rule.processing": "Removing IPv6 firewall rule...",
|
||||
"message.remove.ip.v6.firewall.rule.success": "Removed IPv6 firewall rule",
|
||||
"message.add.nsx.controller": "Add NSX Provider",
|
||||
"message.add.network": "Add a new network for zone: <b><span id=\"zone_name\"></span></b>",
|
||||
"message.add.network.acl.failed": "Adding network ACL list failed.",
|
||||
"message.add.network.acl.processing": "Adding network ACL list...",
|
||||
|
|
@ -2777,6 +2779,12 @@
|
|||
"message.installwizard.tooltip.configureguesttraffic.guestgateway": "The gateway that the guests should use.",
|
||||
"message.installwizard.tooltip.configureguesttraffic.guestnetmask": "The netmask in use on the subnet that the guests should use.",
|
||||
"message.installwizard.tooltip.configureguesttraffic.gueststartip": "The range of IP addresses that will be available for allocation to guests in this zone. If one NIC is used, these IPs should be in the same CIDR as the pod CIDR.",
|
||||
"message.installwizard.tooltip.nsx.provider.hostname": "NSX Provider hostname / IP address not provided",
|
||||
"message.installwizard.tooltip.nsx.provider.username": "NSX Provider username not provided",
|
||||
"message.installwizard.tooltip.nsx.provider.password": "NSX Provider password not provided",
|
||||
"message.installwizard.tooltip.nsx.provider.edgecluster": "NSX Provider edge cluster information not provided",
|
||||
"message.installwizard.tooltip.nsx.provider.tier0gateway": "NSX Provider tier-0 gateway information not provided",
|
||||
"message.installwizard.tooltip.nsx.provider.transportZone": "NSX Provider transport zone information not provided",
|
||||
"message.installwizard.tooltip.tungsten.provider.gateway": "Tungsten provider gateway is required",
|
||||
"message.installwizard.tooltip.tungsten.provider.hostname": "Tungsten provider hostname is required",
|
||||
"message.installwizard.tooltip.tungsten.provider.introspectport": "Tungsten provider introspect port is required",
|
||||
|
|
|
|||
|
|
@ -1097,7 +1097,7 @@ export default {
|
|||
value: (record) => { return record.zoneid }
|
||||
}
|
||||
},
|
||||
columns: ['name', 'hostname', 'port', 'tier0gateway', 'edgecluster']
|
||||
columns: ['name', 'hostname', 'port', 'tier0gateway', 'edgecluster', 'transportzone']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,6 @@ export default {
|
|||
this.stepData.tasks = []
|
||||
this.stepData.stepMove = this.stepData.stepMove.filter(item => item.indexOf('createStorageNetworkIpRange') === -1)
|
||||
}
|
||||
console.log('step-data', this.stepData)
|
||||
// this.handleSubmit()
|
||||
}
|
||||
},
|
||||
|
|
@ -947,30 +946,39 @@ export default {
|
|||
}
|
||||
|
||||
try {
|
||||
console.log('is nsx zone: ', this.stepData.isNsxZone)
|
||||
console.log('value of this.stepData.stepMove.includes(createPublicVlanIpRange)', this.stepData.stepMove.includes('createPublicVlanIpRange' + index))
|
||||
// for not add vlan ; next phase add the check: && this.stepData.isNsxZone
|
||||
if (!this.stepData.stepMove.includes('createPublicVlanIpRange' + index)) {
|
||||
const vlanIpRangeItem = await this.createVlanIpRange(params)
|
||||
this.stepData.returnedPublicTraffic.push(vlanIpRangeItem)
|
||||
console.log('create public vlan ip range')
|
||||
this.stepData.stepMove.push('createPublicVlanIpRange' + index)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('error')
|
||||
this.messageError = e
|
||||
this.processStatus = STATUS_FAILED
|
||||
this.setStepStatus(STATUS_FAILED)
|
||||
stopNow = true
|
||||
}
|
||||
console.log('added public vlan range')
|
||||
|
||||
if (stopNow) {
|
||||
console.log('stop now - break')
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (stopNow) {
|
||||
console.log('stop now - return')
|
||||
return
|
||||
}
|
||||
|
||||
if (this.stepData.isTungstenZone) {
|
||||
await this.stepCreateTungstenFabricPublicNetwork()
|
||||
} else if (this.stepData.isNsxZone) {
|
||||
console.log('added nsx controller')
|
||||
await this.stepAddNsxController()
|
||||
} else {
|
||||
await this.stepConfigureStorageTraffic()
|
||||
|
|
@ -987,6 +995,7 @@ export default {
|
|||
if (storageExists && storageExists.length > 0) {
|
||||
await this.stepConfigureStorageTraffic()
|
||||
} else {
|
||||
console.log('conf guest traffic')
|
||||
await this.stepConfigureGuestTraffic()
|
||||
}
|
||||
}
|
||||
|
|
@ -1043,6 +1052,13 @@ export default {
|
|||
}
|
||||
},
|
||||
async stepAddNsxController () {
|
||||
this.setStepStatus(STATUS_FINISH)
|
||||
this.currentStep++
|
||||
this.addStep('message.add.nsx.controller', 'nsx')
|
||||
if (this.stepData.stepMove.includes('nsx')) {
|
||||
await this.stepConfigureStorageTraffic()
|
||||
return
|
||||
}
|
||||
try {
|
||||
if (!this.stepData.stepMove.includes('addNsxController')) {
|
||||
const providerParams = {}
|
||||
|
|
@ -1054,10 +1070,13 @@ export default {
|
|||
providerParams.zoneid = this.stepData.zoneReturned.id
|
||||
providerParams.tier0gateway = this.prefillContent?.tier0Gateway || ''
|
||||
providerParams.edgecluster = this.prefillContent?.edgeCluster || ''
|
||||
providerParams.transportzone = this.prefillContent?.transportZone || ''
|
||||
|
||||
await this.addNsxController(providerParams)
|
||||
this.stepData.stepMove.push('addNsxController')
|
||||
}
|
||||
this.stepData.stepMove.push('nsx')
|
||||
await this.stepConfigureStorageTraffic()
|
||||
} catch (e) {
|
||||
this.messageError = e
|
||||
this.processStatus = STATUS_FAILED
|
||||
|
|
@ -1074,7 +1093,7 @@ export default {
|
|||
}
|
||||
})
|
||||
|
||||
if (!targetNetwork) {
|
||||
if (!targetNetwork && !this.isNsxZone) {
|
||||
await this.stepConfigureGuestTraffic()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@
|
|||
/>
|
||||
|
||||
<div v-if="guestTrafficRangeMode">
|
||||
<div>{{ isNsxZone }}</div>
|
||||
<static-inputs-form
|
||||
v-if="steps && steps[currentStep].formKey === 'guestTraffic'"
|
||||
@nextPressed="nextPressed"
|
||||
|
|
@ -113,7 +114,7 @@
|
|||
</div>
|
||||
<div v-else>
|
||||
<advanced-guest-traffic-form
|
||||
v-if="steps && steps[currentStep].formKey === 'guestTraffic'"
|
||||
v-if="steps && steps[currentStep].formKey === 'guestTraffic' && !isNsxZone"
|
||||
@nextPressed="nextPressed"
|
||||
@backPressed="handleBack"
|
||||
@fieldsChanged="fieldsChanged"
|
||||
|
|
@ -212,6 +213,7 @@ export default {
|
|||
return isNsx
|
||||
},
|
||||
allSteps () {
|
||||
console.log(this.isNsxZone)
|
||||
const steps = []
|
||||
steps.push({
|
||||
title: 'label.physical.network',
|
||||
|
|
@ -244,7 +246,7 @@ export default {
|
|||
title: 'label.pod',
|
||||
formKey: 'pod'
|
||||
})
|
||||
if (!this.isTungstenZone) {
|
||||
if (!this.isTungstenZone && !this.isNsxZone) {
|
||||
steps.push({
|
||||
title: 'label.guest.traffic',
|
||||
formKey: 'guestTraffic',
|
||||
|
|
@ -418,6 +420,12 @@ export default {
|
|||
key: 'tier0Gateway',
|
||||
placeHolder: 'message.installwizard.tooltip.nsx.provider.tier0gateway',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
title: 'label.nsx.provider.transportzone',
|
||||
key: 'transportZone',
|
||||
placeHolder: 'message.installwizard.tooltip.nsx.provider.transportZone',
|
||||
required: true
|
||||
}
|
||||
]
|
||||
return fields
|
||||
|
|
@ -542,7 +550,7 @@ export default {
|
|||
}
|
||||
this.scrollToStepActive()
|
||||
if (this.zoneType === 'Basic' ||
|
||||
(this.zoneType === 'Advanced' && this.sgEnabled)) {
|
||||
(this.zoneType === 'Advanced' && (this.sgEnabled || this.isNsxZone))) {
|
||||
this.skipGuestTrafficStep = false
|
||||
} else {
|
||||
this.fetchConfiguration()
|
||||
|
|
|
|||
|
|
@ -627,6 +627,7 @@ export default {
|
|||
this.formRef.value.validate().then(() => {
|
||||
const formRaw = toRaw(this.form)
|
||||
const values = this.handleRemoveFields(formRaw)
|
||||
console.log(values)
|
||||
this.actionLoading = true
|
||||
var params = {
|
||||
zoneId: this.selectedZone.id,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
|
@ -549,7 +550,8 @@ public class HypervisorHostHelper {
|
|||
|
||||
public static Pair<ManagedObjectReference, String> prepareNetwork(String physicalNetwork, String namePrefix, HostMO hostMo, String vlanId, String secondaryvlanId,
|
||||
Integer networkRateMbps, Integer networkRateMulticastMbps, long timeOutMs, VirtualSwitchType vSwitchType, int numPorts, String gateway,
|
||||
boolean configureVServiceInNexus, BroadcastDomainType broadcastDomainType, Map<String, String> vsmCredentials, Map<NetworkOffering.Detail, String> details) throws Exception {
|
||||
boolean configureVServiceInNexus, BroadcastDomainType broadcastDomainType, Map<String, String> vsmCredentials,
|
||||
Map<NetworkOffering.Detail, String> details, String netName) throws Exception {
|
||||
ManagedObjectReference morNetwork = null;
|
||||
VmwareContext context = hostMo.getContext();
|
||||
ManagedObjectReference dcMor = hostMo.getHyperHostDatacenter();
|
||||
|
|
@ -573,7 +575,7 @@ public class HypervisorHostHelper {
|
|||
*/
|
||||
BroadcastDomainType[] supportedBroadcastTypes =
|
||||
new BroadcastDomainType[] {BroadcastDomainType.Lswitch, BroadcastDomainType.LinkLocal, BroadcastDomainType.Native, BroadcastDomainType.Pvlan,
|
||||
BroadcastDomainType.Storage, BroadcastDomainType.UnDecided, BroadcastDomainType.Vlan};
|
||||
BroadcastDomainType.Storage, BroadcastDomainType.UnDecided, BroadcastDomainType.Vlan, BroadcastDomainType.NSX};
|
||||
|
||||
if (!Arrays.asList(supportedBroadcastTypes).contains(broadcastDomainType)) {
|
||||
throw new InvalidParameterException("BroadcastDomainType " + broadcastDomainType + " it not supported on a VMWare hypervisor at this time.");
|
||||
|
|
@ -636,6 +638,9 @@ public class HypervisorHostHelper {
|
|||
throw new InvalidParameterException("NVP integration port-group " + networkName + " does not exist on the DVS " + dvSwitchName);
|
||||
}
|
||||
bWaitPortGroupReady = false;
|
||||
} else if (BroadcastDomainType.NSX == broadcastDomainType && Objects.nonNull(netName)){
|
||||
networkName = netName;
|
||||
bWaitPortGroupReady = false;
|
||||
} else {
|
||||
boolean dvSwitchSupportNewPolicies = (isFeatureSupportedInVcenterApiVersion(vcApiVersion, MINIMUM_VCENTER_API_VERSION_WITH_DVS_NEW_POLICIES_SUPPORT)
|
||||
&& isVersionEqualOrHigher(dvSwitchVersion, MINIMUM_DVS_VERSION_WITH_NEW_POLICIES_SUPPORT));
|
||||
|
|
@ -1281,7 +1286,8 @@ public class HypervisorHostHelper {
|
|||
}
|
||||
|
||||
public static Pair<ManagedObjectReference, String> prepareNetwork(String vSwitchName, String namePrefix, HostMO hostMo, String vlanId, Integer networkRateMbps,
|
||||
Integer networkRateMulticastMbps, long timeOutMs, boolean syncPeerHosts, BroadcastDomainType broadcastDomainType, String nicUuid, Map<NetworkOffering.Detail, String> nicDetails) throws Exception {
|
||||
Integer networkRateMulticastMbps, long timeOutMs, boolean syncPeerHosts, BroadcastDomainType broadcastDomainType,
|
||||
String nicUuid, Map<NetworkOffering.Detail, String> nicDetails) throws Exception {
|
||||
|
||||
HostVirtualSwitch vSwitch;
|
||||
if (vSwitchName == null) {
|
||||
|
|
@ -1305,7 +1311,7 @@ public class HypervisorHostHelper {
|
|||
*/
|
||||
BroadcastDomainType[] supportedBroadcastTypes =
|
||||
new BroadcastDomainType[] {BroadcastDomainType.Lswitch, BroadcastDomainType.LinkLocal, BroadcastDomainType.Native, BroadcastDomainType.Pvlan,
|
||||
BroadcastDomainType.Storage, BroadcastDomainType.UnDecided, BroadcastDomainType.Vlan};
|
||||
BroadcastDomainType.Storage, BroadcastDomainType.UnDecided, BroadcastDomainType.Vlan, BroadcastDomainType.NSX};
|
||||
|
||||
if (!Arrays.asList(supportedBroadcastTypes).contains(broadcastDomainType)) {
|
||||
throw new InvalidParameterException("BroadcastDomainType " + broadcastDomainType + " it not supported on a VMWare hypervisor at this time.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue