Skip to content

Commit

Permalink
Merge branch 'main' into 4.20-vr-fix-binary-userdata
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache authored Mar 14, 2024
2 parents ce2517b + e87c6cf commit 03afd7d
Show file tree
Hide file tree
Showing 243 changed files with 11,969 additions and 849 deletions.
19 changes: 19 additions & 0 deletions api/src/main/java/com/cloud/agent/api/to/NicTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -127,4 +130,20 @@ public Integer getMtu() {
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -392,6 +393,14 @@ public Map<String, String> getExtraConfig() {
return extraConfig;
}

public Map<Long, String> getNetworkIdToNetworkNameMap() {
return networkIdToNetworkNameMap;
}

public void setNetworkIdToNetworkNameMap(Map<Long, String> networkIdToNetworkNameMap) {
this.networkIdToNetworkNameMap = networkIdToNetworkNameMap;
}

public String getBootType() {
return bootType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
public interface KubernetesClusterHelper extends Adapter {

ControlledEntity findByUuid(String uuid);
ControlledEntity findByVmId(long vmId);
}
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/network/IpAddress.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ enum Purpose {

void setRuleState(State ruleState);

boolean isForSystemVms();

}
4 changes: 4 additions & 0 deletions api/src/main/java/com/cloud/network/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public static class Provider {
//Add Tungsten Fabric provider
public static final Provider Tungsten = new Provider("Tungsten", false);

public static final Provider Nsx = new Provider("Nsx", false);

private final String name;
private final boolean isExternal;

Expand Down Expand Up @@ -427,6 +429,8 @@ public void setIp6Address(String ip6Address) {

long getDataCenterId();

long getAccountId();

long getNetworkOfferingId();

@Override
Expand Down
9 changes: 9 additions & 0 deletions api/src/main/java/com/cloud/network/NetworkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.List;
import java.util.Map;

import com.cloud.dc.DataCenter;
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
Expand Down Expand Up @@ -55,6 +56,7 @@
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;

/**
* The NetworkService interface is the "public" api to entities that make requests to the orchestration engine
Expand Down Expand Up @@ -87,6 +89,8 @@ IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId, Boolean displ

IpAddress reserveIpAddress(Account account, Boolean displayIp, Long ipAddressId) throws ResourceAllocationException;

IpAddress reserveIpAddressWithVlanDetail(Account account, DataCenter zone, Boolean displayIp, String vlanDetailKey) throws ResourceAllocationException;

boolean releaseReservedIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;

boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
Expand Down Expand Up @@ -254,4 +258,9 @@ Network createPrivateNetwork(String networkName, String displayText, long physic
PublicIpQuarantine updatePublicIpAddressInQuarantine(UpdateQuarantinedIpCmd cmd);

void removePublicIpAddressFromQuarantine(RemoveQuarantinedIpCmd cmd);

InternalLoadBalancerElementService getInternalLoadBalancerElementByType(VirtualRouterProvider.Type type);
InternalLoadBalancerElementService getInternalLoadBalancerElementByNetworkServiceProviderId(long networkProviderId);
InternalLoadBalancerElementService getInternalLoadBalancerElementById(long providerId);
List<InternalLoadBalancerElementService> getInternalLoadBalancerElements();
}
3 changes: 2 additions & 1 deletion api/src/main/java/com/cloud/network/Networks.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ public <T> URI toUri(T value) {
},
UnDecided(null, null),
OpenDaylight("opendaylight", String.class),
TUNGSTEN("tf", String.class);
TUNGSTEN("tf", String.class),
NSX("nsx", String.class);

private final String scheme;
private final Class<?> type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public interface VirtualRouterProvider extends InternalIdentity, Identity {
public enum Type {
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm, NetScalerVm
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm, NetScalerVm, Nsx
}

public Type getType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.Vpc;

public interface NetworkACLServiceProvider extends NetworkElement {

Expand All @@ -32,4 +33,6 @@ public interface NetworkACLServiceProvider extends NetworkElement {
*/
boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;

boolean reorderAclRules(Vpc vpc, List<? extends Network> networks, List<? extends NetworkACLItem> networkACLItems);

}
16 changes: 10 additions & 6 deletions api/src/main/java/com/cloud/network/guru/NetworkGuru.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,24 @@ public interface NetworkGuru extends Adapter {
* be used to make determination can be isolation methods, services
* provided on the guest network and the service provider that's on the
* guest network.
*
* <p>
* If a network is already fully substantiated with the necessary resources
* during this design phase, then the state should be set to Setup. If
* the resources are not allocated at this point, the state should be set
* to Allocated.
*
* @param offering network offering that contains the package of services
* the end user intends to use on that network.
* @param plan where is this network being deployed.
* @param offering network offering that contains the package of services
* the end user intends to use on that network.
* @param plan where is this network being deployed.
* @param userSpecified user specified parameters for this network.
* @param owner owner of this network.
* @param name
* @param vpcId
* @param owner owner of this network.
* @return Network
*/
Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner);
Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, String name, Long vpcId, Account owner);

void setup(Network network, long networkId);

/**
* For guest networks that are in Allocated state after the design stage,
Expand Down
34 changes: 34 additions & 0 deletions api/src/main/java/com/cloud/network/nsx/NsxProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.nsx;

import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;

public interface NsxProvider extends InternalIdentity, Identity {
String getHostname();

String getPort();
String getProviderName();
String getUsername();
long getZoneId();

String getTier0Gateway();
String getEdgeCluster();

String getTransportZone();
}
26 changes: 26 additions & 0 deletions api/src/main/java/com/cloud/network/nsx/NsxService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.nsx;

import com.cloud.network.IpAddress;
import com.cloud.network.vpc.Vpc;

public interface NsxService {

boolean createVpcNetwork(Long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled);
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
}
6 changes: 6 additions & 0 deletions api/src/main/java/com/cloud/network/vpc/VpcOffering.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public enum State {
public static final String defaultVPCOfferingName = "Default VPC offering";
public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
public static final String redundantVPCOfferingName = "Redundant VPC offering";
public static final String DEFAULT_VPC_NAT_NSX_OFFERING_NAME = "VPC offering with NSX - NAT Mode";
public static final String DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME = "VPC offering with NSX - Route Mode";

/**
*
Expand All @@ -53,6 +55,10 @@ public enum State {
*/
boolean isDefault();

boolean isForNsx();

String getNsxMode();

/**
* @return service offering id used by VPC virtual router
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public interface VpcProvisioningService {
VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
Map<String, List<String>> serviceProviders,
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
Long serviceOfferingId, List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state);
Long serviceOfferingId, Boolean forNsx, String mode,
List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state);

Pair<List<? extends VpcOffering>,Integer> listVpcOfferings(ListVPCOfferingsCmd cmd);

Expand Down
14 changes: 14 additions & 0 deletions api/src/main/java/com/cloud/offering/NetworkOffering.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public enum Detail {
InternalLbProvider, PublicLbProvider, servicepackageuuid, servicepackagedescription, PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RelatedNetworkOffering, domainid, zoneid, pvlanType, internetProtocol
}

public enum NsxMode {
NATTED,
ROUTED
}

public final static String SystemPublicNetwork = "System-Public-Network";
public final static String SystemControlNetwork = "System-Control-Network";
public final static String SystemManagementNetwork = "System-Management-Network";
Expand All @@ -52,6 +57,11 @@ public enum Detail {

public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService";
public static final String DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE = "DefaultTungstenSharedNetworkOfferingWithSGService";
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC = "DefaultNATNSXNetworkOfferingForVpc";
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC_WITH_ILB = "DefaultNATNSXNetworkOfferingForVpcWithInternalLB";
public static final String DEFAULT_ROUTED_NSX_OFFERING_FOR_VPC = "DefaultRoutedNSXNetworkOfferingForVpc";
public static final String DEFAULT_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering";
public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering";
public final static String QuickCloudNoServices = "QuickCloudNoServices";
public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService";
public final static String OvsIsolatedNetworkOfferingWithSourceNatService = "OvsIsolatedNetworkOfferingWithSourceNatService";
Expand Down Expand Up @@ -90,6 +100,10 @@ public enum Detail {

boolean isForTungsten();

boolean isForNsx();

String getNsxMode();

TrafficType getTrafficType();

boolean isSpecifyVlan();
Expand Down
20 changes: 18 additions & 2 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ public class ApiConstants {
public static final String MIGRATIONS = "migrations";
public static final String MEMORY = "memory";
public static final String MODE = "mode";
public static final String NSX_MODE = "nsxmode";
public static final String NSX_ENABLED = "isnsxenabled";
public static final String NAME = "name";
public static final String METHOD_NAME = "methodname";
public static final String NETWORK_DOMAIN = "networkdomain";
Expand Down Expand Up @@ -704,6 +706,12 @@ public class ApiConstants {
public static final String VSWITCH_TYPE_PUBLIC_TRAFFIC = "publicvswitchtype";
public static final String VSWITCH_NAME_GUEST_TRAFFIC = "guestvswitchname";
public static final String VSWITCH_NAME_PUBLIC_TRAFFIC = "publicvswitchname";

// 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";
Expand Down Expand Up @@ -825,6 +833,9 @@ public class ApiConstants {
public static final String FORCE_ENCAP = "forceencap";
public static final String SPLIT_CONNECTIONS = "splitconnections";
public static final String FOR_VPC = "forvpc";
public static final String FOR_NSX = "fornsx";
public static final String NSX_SUPPORT_LB = "nsxsupportlb";
public static final String NSX_SUPPORTS_INTERNAL_LB = "nsxsupportsinternallb";
public static final String FOR_TUNGSTEN = "fortungsten";
public static final String SHRINK_OK = "shrinkok";
public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
Expand All @@ -834,6 +845,11 @@ public class ApiConstants {
public static final String NICIRA_NVP_L2_GATEWAYSERVICE_UUID = "l2gatewayserviceuuid";
public static final String NSX_LOGICAL_SWITCH = "nsxlogicalswitch";
public static final String NSX_LOGICAL_SWITCH_PORT = "nsxlogicalswitchport";
public static final String NSX_PROVIDER_UUID = "nsxprovideruuid";
public static final String NSX_PROVIDER_HOSTNAME = "nsxproviderhostname";

public static final String NSX_PROVIDER_PORT = "nsxproviderport";
public static final String NSX_CONTROLLER_ID = "nsxcontrollerid";
public static final String S3_ACCESS_KEY = "accesskey";
public static final String S3_SECRET_KEY = "secretkey";
public static final String S3_END_POINT = "endpoint";
Expand Down Expand Up @@ -958,6 +974,7 @@ public class ApiConstants {
public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc";
public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet";
public static final String SUPPORTS_PUBLIC_ACCESS = "supportspublicaccess";
public static final String SUPPORTS_INTERNAL_LB = "supportsinternallb";
public static final String SUPPORTS_VM_AUTOSCALING = "supportsvmautoscaling";
public static final String REGION_LEVEL_VPC = "regionlevelvpc";
public static final String STRECHED_L2_SUBNET = "strechedl2subnet";
Expand Down Expand Up @@ -1076,14 +1093,13 @@ public class ApiConstants {
public static final String SOURCE_NAT_IP = "sourcenatipaddress";
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
public static final String HAS_RULES = "hasrules";
public static final String NSX_DETAIL_KEY = "forNsx";
public static final String DISK_PATH = "diskpath";
public static final String IMPORT_SOURCE = "importsource";
public static final String TEMP_PATH = "temppath";
public static final String OBJECT_STORAGE = "objectstore";

public static final String HEURISTIC_RULE = "heuristicrule";
public static final String HEURISTIC_TYPE_VALID_OPTIONS = "Valid options are: ISO, SNAPSHOT, TEMPLATE and VOLUME.";

public static final String MANAGEMENT = "management";
public static final String IS_VNF = "isvnf";
public static final String VNF_NICS = "vnfnics";
Expand Down
3 changes: 0 additions & 3 deletions api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.cloudstack.alert.AlertService;
import org.apache.cloudstack.annotation.AnnotationService;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
import org.apache.cloudstack.query.QueryService;
Expand Down Expand Up @@ -201,8 +200,6 @@ public static enum CommandType {
@Inject
public AffinityGroupService _affinityGroupService;
@Inject
public InternalLoadBalancerElementService _internalLbElementSvc;
@Inject
public InternalLoadBalancerVMService _internalLbSvc;
@Inject
public NetworkModel _ntwkModel;
Expand Down
Loading

0 comments on commit 03afd7d

Please sign in to comment.