mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Merge branch 'nsx-integration' into nsx-add-snat
This commit is contained in:
commit
954c4bc9e2
@ -1058,6 +1058,8 @@ public class ApiConstants {
|
||||
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
|
||||
public static final String HAS_RULES = "hasrules";
|
||||
|
||||
public static final String NSX_DETAIL_KEY = "forNsx";
|
||||
|
||||
/**
|
||||
* This enum specifies IO Drivers, each option controls specific policies on I/O.
|
||||
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
|
||||
|
||||
@ -114,6 +114,9 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
||||
@Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if IP range is set to system vms, false if not")
|
||||
private Boolean forSystemVms;
|
||||
|
||||
@Parameter(name = ApiConstants.FOR_NSX, type = CommandType.BOOLEAN, description = "true if the IP range is used for NSX resource", since = "4.20.0")
|
||||
private boolean forNsx;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -154,8 +157,12 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
||||
return startIp;
|
||||
}
|
||||
|
||||
public boolean isForNsx() {
|
||||
return forNsx;
|
||||
}
|
||||
|
||||
public String getVlan() {
|
||||
if (vlan == null || vlan.isEmpty()) {
|
||||
if ((vlan == null || vlan.isEmpty()) && !forNsx) {
|
||||
vlan = "untagged";
|
||||
}
|
||||
return vlan;
|
||||
|
||||
@ -123,6 +123,10 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
|
||||
@Param(description = "indicates whether VLAN IP range is dedicated to system vms or not")
|
||||
private Boolean forSystemVms;
|
||||
|
||||
@SerializedName(ApiConstants.FOR_NSX)
|
||||
@Param(description = "indicates whether IP range is dedicated to NSX resources or not")
|
||||
private Boolean forNsx;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
@ -235,4 +239,8 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
|
||||
public void setIp6Cidr(String ip6Cidr) {
|
||||
this.ip6Cidr = ip6Cidr;
|
||||
}
|
||||
|
||||
public void setForNsx(Boolean forNsx) {
|
||||
this.forNsx = forNsx;
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ public interface ConfigurationManager {
|
||||
Boolean forTungsten, Boolean forNsx, String mode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol);
|
||||
|
||||
Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, boolean forSystemVms, Long podId, String startIP, String endIP,
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr)
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, boolean forNsx)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
|
||||
|
||||
void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException;
|
||||
|
||||
@ -31,6 +31,7 @@ import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.function.Consumer;
|
||||
@ -38,6 +39,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.dc.VlanDetailsVO;
|
||||
import com.cloud.dc.dao.VlanDetailsDao;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
@ -467,6 +470,8 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
FirewallRulesDao firewallRulesDao;
|
||||
@Inject
|
||||
UserDataDao userDataDao;
|
||||
@Inject
|
||||
VlanDetailsDao vlanDetailsDao;
|
||||
|
||||
@Override
|
||||
public UserResponse createUserResponse(User user) {
|
||||
@ -937,6 +942,8 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
}
|
||||
}
|
||||
vlanResponse.setForSystemVms(isForSystemVms(vlan.getId()));
|
||||
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.NSX_DETAIL_KEY);
|
||||
vlanResponse.setForNsx(Objects.nonNull(vlanDetail) && vlanDetail.getValue().equals("true"));
|
||||
vlanResponse.setObjectName("vlan");
|
||||
return vlanResponse;
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
|
||||
@ -46,6 +46,8 @@ import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
|
||||
import com.cloud.dc.VlanDetailsVO;
|
||||
import com.cloud.dc.dao.VlanDetailsDao;
|
||||
import com.cloud.hypervisor.HypervisorGuru;
|
||||
import com.cloud.network.dao.NsxProviderDao;
|
||||
import com.cloud.network.element.NsxProviderVO;
|
||||
@ -348,6 +350,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
@Inject
|
||||
VlanDao _vlanDao;
|
||||
@Inject
|
||||
VlanDetailsDao vlanDetailsDao;
|
||||
@Inject
|
||||
IPAddressDao _publicIpAddressDao;
|
||||
@Inject
|
||||
DataCenterIpAddressDao _privateIpAddressDao;
|
||||
@ -4452,7 +4456,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
} else {
|
||||
network = _networkModel.getNetworkWithSecurityGroupEnabled(zoneId);
|
||||
if (network == null) {
|
||||
throw new InvalidParameterValueException("Nework id is required for Direct vlan creation ");
|
||||
throw new InvalidParameterValueException("Network id is required for Direct vlan creation ");
|
||||
}
|
||||
networkId = network.getId();
|
||||
zoneId = network.getDataCenterId();
|
||||
@ -4517,12 +4521,12 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
}
|
||||
|
||||
return commitVlan(zoneId, podId, startIP, endIP, newVlanGateway, newVlanNetmask, vlanId, forVirtualNetwork, forSystemVms, networkId, physicalNetworkId, startIPv6, endIPv6, ip6Gateway,
|
||||
ip6Cidr, domain, vlanOwner, network, sameSubnet);
|
||||
ip6Cidr, domain, vlanOwner, network, sameSubnet, cmd.isForNsx());
|
||||
}
|
||||
|
||||
private Vlan commitVlan(final Long zoneId, final Long podId, final String startIP, final String endIP, final String newVlanGatewayFinal, final String newVlanNetmaskFinal,
|
||||
final String vlanId, final Boolean forVirtualNetwork, final Boolean forSystemVms, final Long networkId, final Long physicalNetworkId, final String startIPv6, final String endIPv6,
|
||||
final String ip6Gateway, final String ip6Cidr, final Domain domain, final Account vlanOwner, final Network network, final Pair<Boolean, Pair<String, String>> sameSubnet) {
|
||||
final String ip6Gateway, final String ip6Cidr, final Domain domain, final Account vlanOwner, final Network network, final Pair<Boolean, Pair<String, String>> sameSubnet, boolean forNsx) {
|
||||
final GlobalLock commitVlanLock = GlobalLock.getInternLock("CommitVlan");
|
||||
commitVlanLock.lock(5);
|
||||
s_logger.debug("Acquiring lock for committing vlan");
|
||||
@ -4550,7 +4554,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
newVlanNetmask = sameSubnet.second().second();
|
||||
}
|
||||
final Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, forSystemVms, podId, startIP, endIP, newVlanGateway, newVlanNetmask, vlanId,
|
||||
false, domain, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
|
||||
false, domain, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr, forNsx);
|
||||
// create an entry in the nic_secondary table. This will be the new
|
||||
// gateway that will be configured on the corresponding routervm.
|
||||
return vlan;
|
||||
@ -4674,7 +4678,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
@Override
|
||||
@DB
|
||||
public Vlan createVlanAndPublicIpRange(final long zoneId, final long networkId, final long physicalNetworkId, final boolean forVirtualNetwork, final boolean forSystemVms, final Long podId, final String startIP, final String endIP,
|
||||
final String vlanGateway, final String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, final Account vlanOwner, final String startIPv6, final String endIPv6, final String vlanIp6Gateway, final String vlanIp6Cidr) {
|
||||
final String vlanGateway, final String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, final Account vlanOwner, final String startIPv6, final String endIPv6, final String vlanIp6Gateway, final String vlanIp6Cidr, boolean forNsx) {
|
||||
final Network network = _networkModel.getNetwork(networkId);
|
||||
|
||||
boolean ipv4 = false, ipv6 = false;
|
||||
@ -4756,11 +4760,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
} else {
|
||||
vlanId = networkVlanId;
|
||||
}
|
||||
} else if (network.getTrafficType() == TrafficType.Public && vlanId == null) {
|
||||
} else if (network.getTrafficType() == TrafficType.Public && vlanId == null && !forNsx) {
|
||||
throw new InvalidParameterValueException("Unable to determine vlan id or untagged vlan for public network");
|
||||
}
|
||||
|
||||
if (vlanId == null) {
|
||||
if (vlanId == null && !forNsx) {
|
||||
vlanId = Vlan.UNTAGGED;
|
||||
}
|
||||
|
||||
@ -4857,7 +4861,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
if (isSharedNetworkWithoutSpecifyVlan) {
|
||||
bypassVlanOverlapCheck = true;
|
||||
}
|
||||
if (!bypassVlanOverlapCheck && _zoneDao.findVnet(zoneId, physicalNetworkId, BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlanId))).size() > 0) {
|
||||
if (!bypassVlanOverlapCheck && !forNsx && _zoneDao.findVnet(zoneId, physicalNetworkId, BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlanId))).size() > 0) {
|
||||
throw new InvalidParameterValueException("The VLAN tag " + vlanId + " is already being used for dynamic vlan allocation for the guest network in zone "
|
||||
+ zone.getName());
|
||||
}
|
||||
@ -4873,7 +4877,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
|
||||
// Everything was fine, so persist the VLAN
|
||||
final VlanVO vlan = commitVlanAndIpRange(zoneId, networkId, physicalNetworkId, podId, startIP, endIP, vlanGateway, vlanNetmask, vlanId, domain, vlanOwner, vlanIp6Gateway, vlanIp6Cidr,
|
||||
ipv4, zone, vlanType, ipv6Range, ipRange, forSystemVms);
|
||||
ipv4, zone, vlanType, ipv6Range, ipRange, forSystemVms, forNsx);
|
||||
|
||||
return vlan;
|
||||
}
|
||||
@ -4895,9 +4899,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
continue;
|
||||
}
|
||||
// from here, subnet overlaps
|
||||
if (vlanId.toLowerCase().contains(Vlan.UNTAGGED) || UriUtils.checkVlanUriOverlap(
|
||||
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.NSX_DETAIL_KEY);
|
||||
if ((Objects.isNull(vlanId) && Objects.nonNull(vlanDetail) && vlanDetail.getValue().equals("true")) || Objects.nonNull(vlanId) &&
|
||||
(vlanId.toLowerCase().contains(Vlan.UNTAGGED) || UriUtils.checkVlanUriOverlap(
|
||||
BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlanId)),
|
||||
BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlan.getVlanTag())))) {
|
||||
BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlan.getVlanTag()))))) {
|
||||
// For untagged VLAN Id and overlapping URIs we need to expand and verify IP ranges
|
||||
final String[] otherVlanIpRange = vlan.getIpRange().split("\\-");
|
||||
final String otherVlanStartIP = otherVlanIpRange[0];
|
||||
@ -4942,13 +4948,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
|
||||
private VlanVO commitVlanAndIpRange(final long zoneId, final long networkId, final long physicalNetworkId, final Long podId, final String startIP, final String endIP,
|
||||
final String vlanGateway, final String vlanNetmask, final String vlanId, final Domain domain, final Account vlanOwner, final String vlanIp6Gateway, final String vlanIp6Cidr,
|
||||
final boolean ipv4, final DataCenterVO zone, final VlanType vlanType, final String ipv6Range, final String ipRange, final boolean forSystemVms) {
|
||||
final boolean ipv4, final DataCenterVO zone, final VlanType vlanType, final String ipv6Range, final String ipRange, final boolean forSystemVms, final boolean forNsx) {
|
||||
return Transaction.execute(new TransactionCallback<VlanVO>() {
|
||||
@Override
|
||||
public VlanVO doInTransaction(final TransactionStatus status) {
|
||||
VlanVO vlan = new VlanVO(vlanType, vlanId, vlanGateway, vlanNetmask, zone.getId(), ipRange, networkId, physicalNetworkId, vlanIp6Gateway, vlanIp6Cidr, ipv6Range);
|
||||
s_logger.debug("Saving vlan range " + vlan);
|
||||
vlan = _vlanDao.persist(vlan);
|
||||
vlanDetailsDao.addDetail(vlan.getId(), ApiConstants.NSX_DETAIL_KEY, String.valueOf(forNsx), true);
|
||||
|
||||
// IPv6 use a used ip map, is different from ipv4, no need to save
|
||||
// public ip range
|
||||
|
||||
@ -2119,7 +2119,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
||||
if (createVlan && network != null) {
|
||||
// Create vlan ip range
|
||||
_configMgr.createVlanAndPublicIpRange(pNtwk.getDataCenterId(), network.getId(), physicalNetworkId, false, false, null, startIP, endIP, gateway, netmask, vlanId,
|
||||
bypassVlanOverlapCheck, null, null, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
|
||||
bypassVlanOverlapCheck, null, null, startIPv6, endIPv6, ip6Gateway, ip6Cidr, ntwkOff.isForNsx());
|
||||
}
|
||||
if (associatedNetwork != null) {
|
||||
_networkDetailsDao.persist(new NetworkDetailVO(network.getId(), Network.AssociatedNetworkId, String.valueOf(associatedNetwork.getId()), true));
|
||||
|
||||
@ -23,6 +23,7 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -789,7 +790,10 @@ public class CommandSetupHelper {
|
||||
// vlan1, then all ip addresses of vlan2, etc..
|
||||
final Map<String, ArrayList<PublicIpAddress>> vlanIpMap = new HashMap<String, ArrayList<PublicIpAddress>>();
|
||||
for (final PublicIpAddress ipAddress : ips) {
|
||||
final String vlanTag = ipAddress.getVlanTag();
|
||||
String vlanTag = ipAddress.getVlanTag();
|
||||
if (Objects.isNull(vlanTag)) {
|
||||
vlanTag = "nsx-"+ipAddress.getAddress().addr();
|
||||
}
|
||||
ArrayList<PublicIpAddress> ipList = vlanIpMap.get(vlanTag);
|
||||
if (ipList == null) {
|
||||
ipList = new ArrayList<PublicIpAddress>();
|
||||
@ -840,10 +844,18 @@ public class CommandSetupHelper {
|
||||
|
||||
for (final PublicIpAddress ipAddr : ipAddrList) {
|
||||
final boolean add = ipAddr.getState() == IpAddress.State.Releasing ? false : true;
|
||||
String vlanTag = ipAddr.getVlanTag();
|
||||
String key = null;
|
||||
if (Objects.isNull(vlanTag)) {
|
||||
key = "nsx-" + ipAddr.getAddress().addr();
|
||||
} else {
|
||||
key = BroadcastDomainType.getValue(BroadcastDomainType.fromString(ipAddr.getVlanTag()));
|
||||
}
|
||||
|
||||
final String macAddress = vlanMacAddress.get(BroadcastDomainType.getValue(BroadcastDomainType.fromString(ipAddr.getVlanTag())));
|
||||
final String macAddress = vlanMacAddress.get(key);
|
||||
|
||||
final IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP, ipAddr.isSourceNat(), BroadcastDomainType.fromString(ipAddr.getVlanTag()).toString(), ipAddr.getGateway(),
|
||||
final IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP, ipAddr.isSourceNat(),
|
||||
Objects.isNull(vlanTag) ? null : BroadcastDomainType.fromString(ipAddr.getVlanTag()).toString(), ipAddr.getGateway(),
|
||||
ipAddr.getNetmask(), macAddress, networkRate, ipAddr.isOneToOneNat());
|
||||
setIpAddressNetworkParams(ip, network, router);
|
||||
if (network.getPublicMtu() != null) {
|
||||
@ -1047,6 +1059,9 @@ public class CommandSetupHelper {
|
||||
}
|
||||
for (IPAddressVO ip : userIps) {
|
||||
String vlanTag = _vlanDao.findById(ip.getVlanId()).getVlanTag();
|
||||
if (Objects.isNull(vlanTag)) {
|
||||
vlanTag = "nsx-" + ip.getAddress().addr();
|
||||
}
|
||||
Boolean lastIp = vlanLastIpMap.get(vlanTag);
|
||||
if (lastIp != null && !lastIp) {
|
||||
continue;
|
||||
|
||||
@ -711,8 +711,8 @@ public class NetworkHelperImpl implements NetworkHelper {
|
||||
defaultNic.setIsolationUri(BroadcastDomainType.Vxlan.toUri(sourceNatIp.getVlanTag()));
|
||||
} else {
|
||||
defaultNic.setBroadcastType(BroadcastDomainType.Vlan);
|
||||
defaultNic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(sourceNatIp.getVlanTag()));
|
||||
defaultNic.setIsolationUri(IsolationType.Vlan.toUri(sourceNatIp.getVlanTag()));
|
||||
defaultNic.setBroadcastUri(sourceNatIp.getVlanTag() != null ? BroadcastDomainType.Vlan.toUri(sourceNatIp.getVlanTag()) : null);
|
||||
defaultNic.setIsolationUri(sourceNatIp.getVlanTag() != null ? IsolationType.Vlan.toUri(sourceNatIp.getVlanTag()) : null);
|
||||
}
|
||||
|
||||
//If guest nic has already been added we will have 2 devices in the list.
|
||||
|
||||
@ -22,6 +22,7 @@ import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@ -86,8 +87,11 @@ public class VpcNetworkHelperImpl extends NetworkHelperImpl {
|
||||
|
||||
final TreeSet<String> publicVlans = new TreeSet<String>();
|
||||
if (vpcRouterDeploymentDefinition.isPublicNetwork()) {
|
||||
publicVlans.add(vpcRouterDeploymentDefinition.getSourceNatIP()
|
||||
.getVlanTag());
|
||||
String vlanTag = "";
|
||||
if (Objects.nonNull(vpcRouterDeploymentDefinition.getSourceNatIP().getVlanTag())) {
|
||||
vlanTag = vpcRouterDeploymentDefinition.getSourceNatIP().getVlanTag();
|
||||
}
|
||||
publicVlans.add(vlanTag);
|
||||
}
|
||||
|
||||
//1) allocate nic for control and source nat public ip
|
||||
|
||||
@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
@ -351,7 +352,12 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
} else if (network.getTrafficType() == TrafficType.Public) {
|
||||
final Pair<Nic, Network> publicNic = new Pair<Nic, Network>(routerNic, network);
|
||||
publicNics.add(publicNic);
|
||||
final String vlanTag = BroadcastDomainType.getValue(routerNic.getBroadcastUri());
|
||||
String vlanTag = null;
|
||||
if (Objects.nonNull(routerNic.getBroadcastUri())) {
|
||||
vlanTag = BroadcastDomainType.getValue(routerNic.getBroadcastUri());
|
||||
} else {
|
||||
vlanTag = "nsx-"+routerNic.getIPv4Address();
|
||||
}
|
||||
vlanMacAddress.put(vlanTag, routerNic.getMacAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,7 +556,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
||||
*/
|
||||
@Override
|
||||
public Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, boolean forSystemVms, Long podId, String startIP, String endIP,
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanGatewayv6, String vlanCidrv6)
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanGatewayv6, String vlanCidrv6, boolean forNsx)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package org.apache.cloudstack.networkoffering;
|
||||
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.dc.dao.VlanDetailsDao;
|
||||
import com.cloud.event.dao.UsageEventDao;
|
||||
import com.cloud.event.dao.UsageEventDetailsDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
@ -100,6 +101,8 @@ public class CreateNetworkOfferingTest extends TestCase {
|
||||
|
||||
@Inject
|
||||
AnnotationDao annotationDao;
|
||||
@Inject
|
||||
VlanDetailsDao vlanDetailsDao;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
|
||||
@ -73,4 +73,5 @@
|
||||
<bean id="configurationGroupDaoImpl" class="org.apache.cloudstack.framework.config.dao.ConfigurationGroupDaoImpl" />
|
||||
<bean id="configurationSubGroupDaoImpl" class="org.apache.cloudstack.framework.config.dao.ConfigurationSubGroupDaoImpl" />
|
||||
<bean id="nsxControllerDaoImpl" class="com.cloud.network.dao.NsxProviderDaoImpl" />
|
||||
<bean id="vlanDetailsDao" class="com.cloud.dc.dao.VlanDetailsDaoImpl" />
|
||||
</beans>
|
||||
|
||||
@ -1980,7 +1980,9 @@
|
||||
"label.systemvm": "System VM",
|
||||
"label.systemvmtype": "System VM type",
|
||||
"label.tag": "Tag",
|
||||
"label.tag.nsx": "nsx",
|
||||
"label.tag.key": "Tag key",
|
||||
"label.tag.systemvm": "systemvm",
|
||||
"label.tag.value": "Tag value",
|
||||
"label.tagged": "Tagged",
|
||||
"label.tags": "Tags",
|
||||
|
||||
@ -31,9 +31,15 @@
|
||||
:pagination="false"
|
||||
style="margin-bottom: 24px; width: 100%" >
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'gateway'">
|
||||
<div> {{ record.gateway }}</div>
|
||||
<div v-if="record.fornsx"> <a-tag color="processing"> {{ $t('label.tag.nsx') }} </a-tag> </div>
|
||||
<div v-else-if="isNsxZone"> <a-tag color="processing"> {{ $t('label.tag.systemvm') }} </a-tag> </div>
|
||||
</template>
|
||||
<template v-if="column.key === 'actions'">
|
||||
<tooltip-button
|
||||
:tooltip="$t('label.delete')"
|
||||
:disabled="(record.fornsx && !forNsx) || (!record.fornsx && forNsx)"
|
||||
type="primary"
|
||||
:danger="true"
|
||||
icon="delete-outlined"
|
||||
@ -70,6 +76,7 @@
|
||||
<a-form-item name="vlan" ref="vlan">
|
||||
<a-input
|
||||
v-model:value="form.vlan"
|
||||
:disabled="forNsx"
|
||||
:placeholder="$t('label.vlan')"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -160,6 +167,14 @@ export default {
|
||||
isFixError: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
forNsx: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isNsxZone: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
@ -170,6 +185,7 @@ export default {
|
||||
ipRanges: [],
|
||||
columns: [
|
||||
{
|
||||
key: 'gateway',
|
||||
title: this.$t('label.gateway'),
|
||||
dataIndex: 'gateway',
|
||||
width: 140
|
||||
@ -251,7 +267,9 @@ export default {
|
||||
netmask: values.netmask,
|
||||
vlan: values.vlan,
|
||||
startIp: values.startIp,
|
||||
endIp: values.endIp
|
||||
endIp: values.endIp,
|
||||
fornsx: this.forNsx,
|
||||
forsystemvms: this.isNsxZone && !this.forNsx
|
||||
})
|
||||
this.formRef.value.resetFields()
|
||||
}).catch(error => {
|
||||
|
||||
@ -927,6 +927,8 @@ export default {
|
||||
params.zoneId = this.stepData.zoneReturned.id
|
||||
if (publicVlanIpRange.vlan && publicVlanIpRange.vlan.length > 0) {
|
||||
params.vlan = publicVlanIpRange.vlan
|
||||
} else if (publicVlanIpRange.fornsx) {
|
||||
params.vlan = null
|
||||
} else {
|
||||
params.vlan = 'untagged'
|
||||
}
|
||||
@ -934,6 +936,8 @@ export default {
|
||||
params.netmask = publicVlanIpRange.netmask
|
||||
params.startip = publicVlanIpRange.startIp
|
||||
params.endip = publicVlanIpRange.endIp
|
||||
params.fornsx = publicVlanIpRange.fornsx
|
||||
params.forsystemvms = publicVlanIpRange.forsystemvms
|
||||
|
||||
if (this.isBasicZone) {
|
||||
params.forVirtualNetwork = true
|
||||
@ -946,39 +950,29 @@ 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()
|
||||
@ -995,7 +989,6 @@ export default {
|
||||
if (storageExists && storageExists.length > 0) {
|
||||
await this.stepConfigureStorageTraffic()
|
||||
} else {
|
||||
console.log('conf guest traffic')
|
||||
await this.stepConfigureGuestTraffic()
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
:isFixError="isFixError"
|
||||
/>
|
||||
<ip-address-range-form
|
||||
v-if="steps && steps[currentStep].formKey === 'publicTraffic'"
|
||||
v-if="steps && ['publicTraffic', 'nsxPublicTraffic'].includes(steps[currentStep].formKey)"
|
||||
@nextPressed="nextPressed"
|
||||
@backPressed="handleBack"
|
||||
@fieldsChanged="fieldsChanged"
|
||||
@ -60,6 +60,8 @@
|
||||
:description="publicTrafficDescription[zoneType.toLowerCase()]"
|
||||
:prefillContent="prefillContent"
|
||||
:isFixError="isFixError"
|
||||
:forNsx="steps[currentStep].formKey === 'nsxPublicTraffic'"
|
||||
:isNsxZone="isNsxZone"
|
||||
/>
|
||||
|
||||
<static-inputs-form
|
||||
@ -242,6 +244,13 @@ export default {
|
||||
formKey: 'publicTraffic',
|
||||
trafficType: 'public'
|
||||
})
|
||||
if (this.isNsxZone) {
|
||||
steps.push({
|
||||
title: 'label.public.traffic.nsx',
|
||||
formKey: 'nsxPublicTraffic',
|
||||
trafficType: 'public'
|
||||
})
|
||||
}
|
||||
steps.push({
|
||||
title: 'label.pod',
|
||||
formKey: 'pod'
|
||||
@ -544,7 +553,6 @@ export default {
|
||||
created () {
|
||||
this.physicalNetworks = this.prefillContent.physicalNetworks
|
||||
this.steps = this.filteredSteps()
|
||||
console.log(this.isNsxZone)
|
||||
this.currentStep = this.prefillContent?.networkStep || 0
|
||||
if (this.stepChild && this.stepChild !== '') {
|
||||
this.currentStep = this.steps.findIndex(item => item.formKey === this.stepChild)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user