Skip to content

Commit ebfe83d

Browse files
committed
Merge remote-tracking branch 'apache/main' into integration-veeam-kvm
2 parents d8c7ee7 + 96ca1b2 commit ebfe83d

76 files changed

Lines changed: 2440 additions & 1116 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,11 @@
2222
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
2323
import com.cloud.host.Host;
2424
import com.cloud.host.Host.Type;
25-
import com.cloud.offering.ServiceOffering;
2625
import com.cloud.utils.component.Adapter;
27-
import com.cloud.vm.VirtualMachine;
2826
import com.cloud.vm.VirtualMachineProfile;
2927

3028
public interface HostAllocator extends Adapter {
3129

32-
/**
33-
* @param UserVm vm
34-
* @param ServiceOffering offering
35-
**/
36-
boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering);
37-
3830
/**
3931
* Determines which physical hosts are suitable to
4032
* allocate the guest virtual machines on
@@ -49,31 +41,6 @@ public interface HostAllocator extends Adapter {
4941

5042
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
5143

52-
/**
53-
* Determines which physical hosts are suitable to allocate the guest
54-
* virtual machines on
55-
*
56-
* Allocators must set any other hosts not considered for allocation in the
57-
* ExcludeList avoid. Thus the avoid set and the list of hosts suitable,
58-
* together must cover the entire host set in the cluster.
59-
*
60-
* @param VirtualMachineProfile
61-
* vmProfile
62-
* @param DeploymentPlan
63-
* plan
64-
* @param GuestType
65-
* type
66-
* @param ExcludeList
67-
* avoid
68-
* @param int returnUpTo (use -1 to return all possible hosts)
69-
* @param boolean considerReservedCapacity (default should be true, set to
70-
* false if host capacity calculation should not look at reserved
71-
* capacity)
72-
* @return List<Host> List of hosts that are suitable for VM allocation
73-
**/
74-
75-
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
76-
7744
/**
7845
* Determines which physical hosts are suitable to allocate the guest
7946
* virtual machines on

api/src/main/java/com/cloud/deploy/DeploymentPlanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public interface DeploymentPlanner extends Adapter {
7070
boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
7171

7272
public enum AllocationAlgorithm {
73-
random, firstfit, userdispersing;
73+
random, firstfit, userdispersing, firstfitleastconsumed;
7474
}
7575

7676
public enum PlannerResourceUsage {

api/src/main/java/com/cloud/network/Network.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,4 +510,6 @@ public void setIp6Address(String ip6Address) {
510510
Integer getPrivateMtu();
511511

512512
Integer getNetworkCidrSize();
513+
514+
boolean getKeepMacAddressOnPublicNic();
513515
}

api/src/main/java/com/cloud/network/NetworkProfile.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,11 @@ public Integer getNetworkCidrSize() {
385385
return networkCidrSize;
386386
}
387387

388+
@Override
389+
public boolean getKeepMacAddressOnPublicNic() {
390+
return true;
391+
}
392+
388393
@Override
389394
public String toString() {
390395
return String.format("NetworkProfile %s",

api/src/main/java/com/cloud/network/vpc/Vpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,6 @@ public enum State {
107107
String getIp6Dns2();
108108

109109
boolean useRouterIpAsResolver();
110+
111+
boolean getKeepMacAddressOnPublicNic();
110112
}

api/src/main/java/com/cloud/network/vpc/VpcService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public interface VpcService {
5858
*/
5959
Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain,
6060
String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu, Integer cidrSize,
61-
Long asNumber, List<Long> bgpPeerIds, Boolean useVrIpResolver) throws ResourceAllocationException;
61+
Long asNumber, List<Long> bgpPeerIds, Boolean useVrIpResolver, boolean keepMacAddressOnPublicNic) throws ResourceAllocationException;
6262

6363
/**
6464
* Persists VPC record in the database
@@ -104,7 +104,7 @@ Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, Strin
104104
* @throws ResourceUnavailableException if during restart some resources may not be available
105105
* @throws InsufficientCapacityException if for instance no address space, compute or storage is sufficiently available
106106
*/
107-
Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu, String sourceNatIp) throws ResourceUnavailableException, InsufficientCapacityException;
107+
Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu, String sourceNatIp, Boolean keepMacAddressOnPublicNic) throws ResourceUnavailableException, InsufficientCapacityException;
108108

109109
/**
110110
* Lists VPC(s) based on the parameters passed to the API call

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,13 @@ public class ApiConstants {
13611361
public static final String OBJECT_STORAGE_LIMIT = "objectstoragelimit";
13621362
public static final String OBJECT_STORAGE_TOTAL = "objectstoragetotal";
13631363

1364+
public static final String KEEP_MAC_ADDRESS_ON_PUBLIC_NIC = "keepmacaddressonpublicnic";
1365+
1366+
public static final String PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC =
1367+
"Indicates whether to use the same MAC address for the public NIC of VRs on the same network. If \"true\", when creating redundant routers or recreating" +
1368+
" a VR, CloudStack will use the same MAC address for the public NIC of all VRs. Otherwise, if \"false\", new public NICs will always have " +
1369+
" a new MAC address.";
1370+
13641371
public static final String PARAMETER_DESCRIPTION_ACTIVATION_RULE = "Quota tariff's activation rule. It can receive a JS script that results in either " +
13651372
"a boolean or a numeric value: if it results in a boolean value, the tariff value will be applied according to the result; if it results in a numeric value, the " +
13661373
"numeric value will be applied; if the result is neither a boolean nor a numeric value, the tariff will not be applied. If the rule is not informed, the tariff " +

api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void execute() {
7878
for (Host host : result.first()) {
7979
HostForMigrationResponse hostResponse = _responseGenerator.createHostForMigrationResponse(host);
8080
Boolean suitableForMigration = false;
81-
if (hostsWithCapacity.contains(host)) {
81+
if (hostsWithCapacity != null && hostsWithCapacity.contains(host)) {
8282
suitableForMigration = true;
8383
}
8484
hostResponse.setSuitableForMigration(suitableForMigration);

api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ protected ListResponse<HostResponse> getHostResponses() {
252252
for (Host host : result.first()) {
253253
HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails());
254254
Boolean suitableForMigration = false;
255-
if (hostsWithCapacity.contains(host)) {
255+
if (hostsWithCapacity != null && hostsWithCapacity.contains(host)) {
256256
suitableForMigration = true;
257257
}
258258
hostResponse.setSuitableForMigration(suitableForMigration);

api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd {
199199
@Parameter(name=ApiConstants.AS_NUMBER, type=CommandType.LONG, since = "4.20.0", description="the AS Number of the network")
200200
private Long asNumber;
201201

202+
@Parameter(name = ApiConstants.KEEP_MAC_ADDRESS_ON_PUBLIC_NIC,
203+
description = ApiConstants.PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC,
204+
type = CommandType.BOOLEAN, since = "4.23.0", authorized = {RoleType.Admin})
205+
private Boolean keepMacAddressOnPublicNic;
206+
202207
/////////////////////////////////////////////////////
203208
/////////////////// Accessors ///////////////////////
204209
/////////////////////////////////////////////////////
@@ -286,6 +291,10 @@ public String getSourceNatIP() {
286291
return sourceNatIP;
287292
}
288293

294+
public Boolean getKeepMacAddressOnPublicNic() {
295+
return keepMacAddressOnPublicNic;
296+
}
297+
289298
@Override
290299
public boolean isDisplay() {
291300
if(displayNetwork == null)

0 commit comments

Comments
 (0)