Skip to content

Commit

Permalink
Merge branch 'main' into guest-os-mappings-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanHoogland authored Jan 9, 2023
2 parents 4141667 + cc52752 commit 231dfb3
Show file tree
Hide file tree
Showing 152 changed files with 9,697 additions and 583 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

name: Maven Build (noredist)
name: Build

on: [push, pull_request]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

name: RAT License Check
name: License Check

on: [push, pull_request]

Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Apache CloudStack [![Maven Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) [![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [![RAT License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml) [![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack) [![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack)
# Apache CloudStack [![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) [![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [![License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml) [![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack) [![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack)

![Apache CloudStack](tools/logo/acsxmas.jpg)
![Apache CloudStack](tools/logo/apache_cloudstack.png)

Apache CloudStack is open source software designed to deploy and manage large
networks of virtual machines, as a highly available, highly scalable
Expand Down Expand Up @@ -101,8 +101,9 @@ developer [page](https://cloudstack.apache.org/developers.html) for contributing
## Reporting Security Vulnerabilities

If you've found an issue that you believe is a security vulnerability in a
released version of CloudStack, please report it to `security@cloudstack.apache.org` with details about the vulnerability, how it
might be exploited, and any additional information that might be useful.
released version of CloudStack, please report it to `security@apache.org` with
details about the vulnerability, how it might be exploited, and any additional
information that might be useful.

For more details, please visit our security [page](http://cloudstack.apache.org/security.html).

Expand Down
18 changes: 17 additions & 1 deletion api/src/main/java/com/cloud/agent/api/to/IpAddressTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ public class IpAddressTO {
private boolean newNic;
private boolean isPrivateGateway;
private NicTO nicTO;

private Integer mtu;
Map<String, String> details;

public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String broadcastUri, String vlanGateway, String vlanNetmask,
String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
this.accountId = accountId;
this.publicIp = ipAddress;
this.add = add;
Expand All @@ -56,6 +58,12 @@ public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstI
this.oneToOneNat = isOneToOneNat;
}

public IpAddressTO(String ipAddress, Integer mtu, String vlanNetmask ) {
this.publicIp = ipAddress;
this.mtu = mtu;
this.vlanNetmask = vlanNetmask;
}

protected IpAddressTO() {
}

Expand Down Expand Up @@ -155,6 +163,14 @@ public void setNicTO(NicTO nicTO) {
this.nicTO = nicTO;
}

public Integer getMtu() {
return mtu;
}

public void setMtu(Integer mtu) {
this.mtu = mtu;
}


public Map<String, String> getDetails() {
return details;
Expand Down
9 changes: 9 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 @@ -31,6 +31,7 @@ public class NicTO extends NetworkTO {
List<String> nicSecIps;
Map<NetworkOffering.Detail, String> details;
boolean dpdkEnabled;
Integer mtu;

public NicTO() {
super();
Expand Down Expand Up @@ -118,4 +119,12 @@ public boolean isDpdkEnabled() {
public void setDpdkEnabled(boolean dpdkEnabled) {
this.dpdkEnabled = dpdkEnabled;
}

public Integer getMtu() {
return mtu;
}

public void setMtu(Integer mtu) {
this.mtu = mtu;
}
}
41 changes: 41 additions & 0 deletions api/src/main/java/com/cloud/host/ControlState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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.host;

import com.cloud.resource.ResourceState;

public enum ControlState {
Enabled,
Disabled,
Offline,
Maintenance,
Unknown;

public static ControlState getControlState(Status hostStatus, ResourceState hostResourceState) {
if (hostStatus == null || Status.Unknown.equals(hostStatus) || hostResourceState == null) {
return ControlState.Unknown;
} else if (hostStatus.lostConnection()) {
return Offline;
} else if (ResourceState.isMaintenanceState(hostResourceState)) {
return Maintenance;
} else if (ResourceState.Enabled.equals(hostResourceState)) {
return Enabled;
} else {
return Disabled;
}
}
}
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 @@ -493,4 +493,8 @@ public void setIp6Address(String ip6Address) {
String getIp6Dns2();

Date getCreated();

Integer getPublicMtu();

Integer getPrivateMtu();
}
12 changes: 12 additions & 0 deletions api/src/main/java/com/cloud/network/NetworkProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import org.apache.log4j.Logger;

public class NetworkProfile implements Network {
static final Logger s_logger = Logger.getLogger(NetworkProfile.class);
private final long id;
private final String uuid;
private final long dataCenterId;
Expand Down Expand Up @@ -357,4 +359,14 @@ public Date getCreated() {
return null;
}

@Override
public Integer getPublicMtu() {
return null;
}

@Override
public Integer getPrivateMtu() {
return null;
}

}
16 changes: 16 additions & 0 deletions api/src/main/java/com/cloud/network/NetworkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd;
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
import org.apache.cloudstack.framework.config.ConfigKey;

import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
Expand All @@ -59,6 +60,21 @@
*/
public interface NetworkService {

public static final Integer DEFAULT_MTU = 1500;
public static final Integer MINIMUM_MTU = 68;

public static final ConfigKey<Integer> VRPublicInterfaceMtu = new ConfigKey<>("VirtualRouter", Integer.class,
"vr.public.interface.max.mtu", "1500", "The maximum value the MTU can have on the VR's public interfaces",
true, ConfigKey.Scope.Zone);

public static final ConfigKey<Integer> VRPrivateInterfaceMtu = new ConfigKey<>("VirtualRouter", Integer.class,
"vr.private.interface.max.mtu", "1500", "The maximum value the MTU can have on the VR's private interfaces",
true, ConfigKey.Scope.Zone);

public static final ConfigKey<Boolean> AllowUsersToSpecifyVRMtu = new ConfigKey<>("Advanced", Boolean.class,
"allow.end.users.to.specify.vr.mtu", "false", "Allow end users to specify VR MTU",
true, ConfigKey.Scope.Zone);

List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);

IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId, Boolean displayIp, String ipaddress) throws ResourceAllocationException, InsufficientAddressCapacityException,
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/network/vpc/Vpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public enum State {

Date getCreated();

Integer getPublicMtu();

String getIp4Dns1();

String getIp4Dns2();
Expand Down
9 changes: 5 additions & 4 deletions api/src/main/java/com/cloud/network/vpc/VpcService.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface VpcService {
* @throws ResourceAllocationException TODO
*/
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain,
String dns1, String dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc)
String dns1, String dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu)
throws ResourceAllocationException;

/**
Expand All @@ -73,11 +73,12 @@ public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName
* @param vpcId
* @param vpcName
* @param displayText
* @param customId TODO
* @param displayVpc TODO
* @param customId TODO
* @param displayVpc TODO
* @param mtu
* @return
*/
public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc);
public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu);

/**
* Lists VPC(s) based on the parameters passed to the method call
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/vm/Nic.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ public enum ReservationStrategy {
String getIPv6Cidr();

String getIPv6Address();

Integer getMtu();
}
11 changes: 11 additions & 0 deletions api/src/main/java/com/cloud/vm/NicProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class NicProfile implements InternalIdentity, Serializable {
String iPv6Dns1;
String iPv6Dns2;
String requestedIPv6;
Integer mtu;

//
// CONSTRUCTORS
Expand Down Expand Up @@ -396,6 +397,15 @@ public void setOrderIndex(Integer orderIndex) {
this.orderIndex = orderIndex;
}

public Integer getMtu() {
return mtu;
}

public void setMtu(Integer mtu) {
this.mtu = mtu;
}


//
// OTHER METHODS
//
Expand Down Expand Up @@ -426,6 +436,7 @@ public void deallocate() {
isolationUri = null;

orderIndex = null;
mtu = null;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ private AlertType(short type, String name, boolean isDefault) {
public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType((short)30, "ALERT.HA.ACTION", true);
public static final AlertType ALERT_TYPE_CA_CERT = new AlertType((short)31, "ALERT.CA.CERT", true);
public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType((short)32, "ALERT.VM.SNAPSHOT", true);
public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PUBLIC.IFACE.MTU", true);
public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PRIVATE.IFACE.MTU", true);

public short getType() {
return type;
Expand Down
8 changes: 8 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ public class ApiConstants {
public static final String HOST_ID = "hostid";
public static final String HOST_IDS = "hostids";
public static final String HOST_NAME = "hostname";
public static final String HOST_CONTROL_STATE = "hostcontrolstate";
public static final String HOSTS_MAP = "hostsmap";
public static final String HYPERVISOR = "hypervisor";
public static final String INLINE = "inline";
Expand Down Expand Up @@ -622,6 +623,7 @@ public class ApiConstants {
public static final String RESTART_REQUIRED = "restartrequired";
public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects";
public static final String ALLOW_USER_DRIVEN_BACKUPS = "allowuserdrivenbackups";
public static final String ALLOW_USER_SPECIFY_VR_MTU = "allowuserspecifyvrmtu";
public static final String CONSERVE_MODE = "conservemode";
public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor";
public static final String KEYWORD = "keyword";
Expand Down Expand Up @@ -886,6 +888,8 @@ public class ApiConstants {
public static final String ROUTER_CHECK_TYPE = "checktype";
public static final String ROUTER_IP = "routerip";
public static final String ROUTER_IPV6 = "routeripv6";
public static final String ROUTER_PRIVATE_INTERFACE_MAX_MTU = "routerprivateinterfacemaxmtu";
public static final String ROUTER_PUBLIC_INTERFACE_MAX_MTU = "routerpublicinterfacemaxmtu";
public static final String LAST_UPDATED = "lastupdated";
public static final String PERFORM_FRESH_CHECKS = "performfreshchecks";
public static final String CACHE_MODE = "cachemode";
Expand Down Expand Up @@ -924,13 +928,17 @@ public class ApiConstants {
public static final String DYNAMIC_SCALING_ENABLED = "dynamicscalingenabled";

public static final String POOL_TYPE = "pooltype";
public static final String REDUNDANT_STATE = "redundantstate";

public static final String ADMINS_ONLY = "adminsonly";
public static final String ANNOTATION_FILTER = "annotationfilter";
public static final String LOGIN = "login";
public static final String LOGOUT = "logout";
public static final String LIST_IDPS = "listIdps";

public static final String PUBLIC_MTU = "publicmtu";
public static final String PRIVATE_MTU = "privatemtu";
public static final String MTU = "mtu";
public enum BootType {
UEFI, BIOS;

Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static enum HTTPMethod {
GET, POST, PUT, DELETE
}
public static enum CommandType {
BOOLEAN, DATE, FLOAT, DOUBLE, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID
BOOLEAN, DATE, FLOAT, DOUBLE, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, UUID
}

private Object _responseObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.START_DATE, type = CommandType.TZDATE, description = "The start date of the async job (use format \"yyyy-MM-dd'T'HH:mm:ss'+'SSSS\")")
@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "The start date of the async job (use format \"yyyy-MM-dd'T'HH:mm:ss'+'SSSS\")")
private Date startDate;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;

import com.cloud.network.NetworkService;
import org.apache.log4j.Logger;

import org.apache.cloudstack.acl.RoleType;
Expand Down Expand Up @@ -157,6 +158,14 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd {
description = "The network this network is associated to. only available if create a Shared network")
private Long associatedNetworkId;

@Parameter(name = ApiConstants.PUBLIC_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0")
private Integer publicMtu;

@Parameter(name = ApiConstants.PRIVATE_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's private interface(s)", since = "4.18.0")
private Integer privateMtu;

@Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first IPv4 DNS for the network", since = "4.18.0")
private String ip4Dns1;

Expand Down Expand Up @@ -338,6 +347,13 @@ public Long getAclId() {
return aclId;
}

public Integer getPublicMtu() {
return publicMtu != null ? publicMtu : NetworkService.DEFAULT_MTU;
}

public Integer getPrivateMtu() {
return privateMtu != null ? privateMtu : NetworkService.DEFAULT_MTU;
}
public String getIp4Dns1() {
return ip4Dns1;
}
Expand Down
Loading

0 comments on commit 231dfb3

Please sign in to comment.