Skip to content

Commit 90fe1d5

Browse files
committed
Merge branch '4.19'
2 parents 3a0c312 + bcbf152 commit 90fe1d5

File tree

135 files changed

+4310
-774
lines changed

Some content is hidden

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

135 files changed

+4310
-774
lines changed

agent/src/main/java/com/cloud/agent/Agent.java

+6
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,12 @@ public void doTask(final Task task) throws TaskExecutionException {
11271127
logger.error("Error parsing task", e);
11281128
}
11291129
} else if (task.getType() == Task.Type.DISCONNECT) {
1130+
try {
1131+
// an issue has been found if reconnect immediately after disconnecting. please refer to https://github.com/apache/cloudstack/issues/8517
1132+
// wait 5 seconds before reconnecting
1133+
Thread.sleep(5000);
1134+
} catch (InterruptedException e) {
1135+
}
11301136
reconnect(task.getLink());
11311137
return;
11321138
} else if (task.getType() == Task.Type.OTHER) {

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ public Property<Integer> getWorkers() {
751751
public static final Property<Integer> IOTHREADS = new Property<>("iothreads", 1);
752752

753753
/**
754-
* Enable verbose mode for virt-v2v Instance Conversion from Vmware to KVM
754+
* Enable verbose mode for virt-v2v Instance Conversion from VMware to KVM
755755
* Data type: Boolean.<br>
756756
* Default value: <code>false</code>
757757
*/

api/src/main/java/com/cloud/agent/api/to/RemoteInstanceTO.java

+10-19
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,39 @@
1818
*/
1919
package com.cloud.agent.api.to;
2020

21+
import java.io.Serializable;
22+
2123
import com.cloud.agent.api.LogLevel;
2224
import com.cloud.hypervisor.Hypervisor;
2325

24-
import java.io.Serializable;
25-
2626
public class RemoteInstanceTO implements Serializable {
2727

2828
private Hypervisor.HypervisorType hypervisorType;
29-
private String hostName;
3029
private String instanceName;
3130

32-
// Vmware Remote Instances parameters
31+
// VMware Remote Instances parameters (required for exporting OVA through ovftool)
3332
// TODO: cloud.agent.transport.Request#getCommands() cannot handle gsoc decode for polymorphic classes
3433
private String vcenterUsername;
3534
@LogLevel(LogLevel.Log4jLevel.Off)
3635
private String vcenterPassword;
3736
private String vcenterHost;
3837
private String datacenterName;
39-
private String clusterName;
4038

4139
public RemoteInstanceTO() {
4240
}
4341

44-
public RemoteInstanceTO(String hostName, String instanceName, String vcenterHost,
45-
String datacenterName, String clusterName,
46-
String vcenterUsername, String vcenterPassword) {
42+
public RemoteInstanceTO(String instanceName) {
43+
this.hypervisorType = Hypervisor.HypervisorType.VMware;
44+
this.instanceName = instanceName;
45+
}
46+
47+
public RemoteInstanceTO(String instanceName, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
4748
this.hypervisorType = Hypervisor.HypervisorType.VMware;
48-
this.hostName = hostName;
4949
this.instanceName = instanceName;
5050
this.vcenterHost = vcenterHost;
51-
this.datacenterName = datacenterName;
52-
this.clusterName = clusterName;
5351
this.vcenterUsername = vcenterUsername;
5452
this.vcenterPassword = vcenterPassword;
53+
this.datacenterName = datacenterName;
5554
}
5655

5756
public Hypervisor.HypervisorType getHypervisorType() {
@@ -62,10 +61,6 @@ public String getInstanceName() {
6261
return this.instanceName;
6362
}
6463

65-
public String getHostName() {
66-
return this.hostName;
67-
}
68-
6964
public String getVcenterUsername() {
7065
return vcenterUsername;
7166
}
@@ -81,8 +76,4 @@ public String getVcenterHost() {
8176
public String getDatacenterName() {
8277
return datacenterName;
8378
}
84-
85-
public String getClusterName() {
86-
return clusterName;
87-
}
8879
}

api/src/main/java/com/cloud/host/Host.java

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static String[] toStrings(Host.Type... types) {
5454
}
5555
public static final String HOST_UEFI_ENABLE = "host.uefi.enable";
5656
public static final String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
57+
public static final String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
5758

5859
/**
5960
* @return name of the machine.

api/src/main/java/com/cloud/hypervisor/HypervisorGuru.java

+25-8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.cloudstack.framework.config.ConfigKey;
2424

2525
import com.cloud.agent.api.Command;
26+
import com.cloud.agent.api.to.DataStoreTO;
2627
import com.cloud.agent.api.to.NicTO;
2728
import com.cloud.agent.api.to.VirtualMachineTO;
2829
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@@ -101,21 +102,20 @@ boolean attachRestoredVolumeToVirtualMachine(long zoneId, String location, Backu
101102
* Will generate commands to migrate a vm to a pool. For now this will only work for stopped VMs on Vmware.
102103
*
103104
* @param vm the stopped vm to migrate
104-
* @param destination the primary storage pool to migrate to
105+
* @param volumeToPool the primary storage pools to migrate to
105106
* @return a list of commands to perform for a successful migration
106107
*/
107108
List<Command> finalizeMigrate(VirtualMachine vm, Map<Volume, StoragePool> volumeToPool);
108109

109110

110111
/**
111-
* Will perform a clone of a VM on an external host (if the guru can handle)
112+
* Will return the hypervisor VM (clone VM for PowerOn VMs), performs a clone of a VM if required on an external host (if the guru can handle)
112113
* @param hostIp VM's source host IP
113-
* @param vmName name of the source VM to clone from
114+
* @param vmName name of the source VM (clone VM name if cloned)
114115
* @param params hypervisor specific additional parameters
115-
* @return a reference to the cloned VM
116+
* @return a reference to the hypervisor or cloned VM, and cloned flag
116117
*/
117-
UnmanagedInstanceTO cloneHypervisorVMOutOfBand(String hostIp, String vmName,
118-
Map<String, String> params);
118+
Pair<UnmanagedInstanceTO, Boolean> getHypervisorVMOutOfBandAndCloneIfRequired(String hostIp, String vmName, Map<String, String> params);
119119

120120
/**
121121
* Removes a VM created as a clone of a VM on an external host
@@ -124,6 +124,23 @@ UnmanagedInstanceTO cloneHypervisorVMOutOfBand(String hostIp, String vmName,
124124
* @param params hypervisor specific additional parameters
125125
* @return true if the operation succeeds, false if not
126126
*/
127-
boolean removeClonedHypervisorVMOutOfBand(String hostIp, String vmName,
128-
Map<String, String> params);
127+
boolean removeClonedHypervisorVMOutOfBand(String hostIp, String vmName, Map<String, String> params);
128+
129+
/**
130+
* Create an OVA/OVF template of a VM on an external host (if the guru can handle)
131+
* @param hostIp VM's source host IP
132+
* @param vmName name of the source VM to create template from
133+
* @param params hypervisor specific additional parameters
134+
* @param templateLocation datastore to create the template file
135+
* @return the created template dir/name
136+
*/
137+
String createVMTemplateOutOfBand(String hostIp, String vmName, Map<String, String> params, DataStoreTO templateLocation, int threadsCountToExportOvf);
138+
139+
/**
140+
* Removes the template on the location
141+
* @param templateLocation datastore to remove the template file
142+
* @param templateDir the template dir to remove from datastore
143+
* @return true if the operation succeeds, false if not
144+
*/
145+
boolean removeVMTemplateOutOfBand(DataStoreTO templateLocation, String templateDir);
129146
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ public interface NetworkModel {
317317

318318
void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
319319

320+
void checkIp6CidrSizeEqualTo64(String ip6Cidr) throws InvalidParameterValueException;
321+
320322
void checkRequestedIpAddresses(long networkId, IpAddresses ips) throws InvalidParameterValueException;
321323

322324
String getStartIpv6Address(long id);

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

+9
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,22 @@
1717
package com.cloud.network;
1818

1919
import java.util.List;
20+
import java.util.Map;
2021

2122
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
2223
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
2324

25+
import com.cloud.deploy.DeploymentPlanner;
2426
import com.cloud.exception.ConcurrentOperationException;
2527
import com.cloud.exception.InsufficientCapacityException;
28+
import com.cloud.exception.OperationTimedoutException;
2629
import com.cloud.exception.ResourceUnavailableException;
2730
import com.cloud.network.router.VirtualRouter;
2831
import com.cloud.user.Account;
2932
import com.cloud.utils.Pair;
3033
import com.cloud.vm.Nic;
34+
import com.cloud.vm.VirtualMachine;
35+
import com.cloud.vm.VirtualMachineProfile;
3136

3237
public interface VirtualNetworkApplianceService {
3338
/**
@@ -62,6 +67,10 @@ public interface VirtualNetworkApplianceService {
6267

6368
VirtualRouter startRouter(long id) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException;
6469

70+
void startRouterForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlanner planner)
71+
throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException,
72+
OperationTimedoutException;
73+
6574
VirtualRouter destroyRouter(long routerId, Account caller, Long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException;
6675

6776
VirtualRouter findRouter(long routerId);

api/src/main/java/com/cloud/network/guru/NetworkGuru.java

+3
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,7 @@ void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDe
212212

213213
boolean isMyTrafficType(TrafficType type);
214214

215+
default boolean isSlaacV6Only() {
216+
return true;
217+
}
215218
}

api/src/main/java/com/cloud/vm/NicProfile.java

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class NicProfile implements InternalIdentity, Serializable {
6262
String iPv4Dns1;
6363
String iPv4Dns2;
6464
String requestedIPv4;
65+
boolean ipv4AllocationRaceCheck;
6566

6667
// IPv6
6768
String iPv6Address;
@@ -405,6 +406,13 @@ public void setMtu(Integer mtu) {
405406
this.mtu = mtu;
406407
}
407408

409+
public boolean getIpv4AllocationRaceCheck() {
410+
return this.ipv4AllocationRaceCheck;
411+
}
412+
413+
public void setIpv4AllocationRaceCheck(boolean ipv4AllocationRaceCheck) {
414+
this.ipv4AllocationRaceCheck = ipv4AllocationRaceCheck;
415+
}
408416

409417
//
410418
// OTHER METHODS

api/src/main/java/com/cloud/vm/UserVmService.java

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
4343

4444
import com.cloud.dc.DataCenter;
45+
import com.cloud.deploy.DeploymentPlanner;
4546
import com.cloud.exception.ConcurrentOperationException;
4647
import com.cloud.exception.InsufficientCapacityException;
4748
import com.cloud.exception.ManagementServerException;
@@ -112,6 +113,10 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E
112113

113114
void startVirtualMachine(UserVm vm) throws OperationTimedoutException, ResourceUnavailableException, InsufficientCapacityException;
114115

116+
void startVirtualMachineForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param, Object> params,
117+
DeploymentPlanner planner) throws InsufficientCapacityException, ResourceUnavailableException,
118+
ConcurrentOperationException, OperationTimedoutException;
119+
115120
UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
116121

117122
/**

api/src/main/java/com/cloud/vm/VirtualMachineProfile.java

+4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ public boolean equals(Object obj) {
192192

193193
Map<Param, Object> getParameters();
194194

195+
void setCpuOvercommitRatio(Float cpuOvercommitRatio);
196+
197+
void setMemoryOvercommitRatio(Float memoryOvercommitRatio);
198+
195199
Float getCpuOvercommitRatio();
196200

197201
Float getMemoryOvercommitRatio();

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

+4
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public class ApiConstants {
191191
public static final String FORCED = "forced";
192192
public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage";
193193
public static final String FORCE_DELETE_HOST = "forcedeletehost";
194+
public static final String FORCE_MS_TO_IMPORT_VM_FILES = "forcemstoimportvmfiles";
194195
public static final String FORMAT = "format";
195196
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
196197
public static final String FOR_SYSTEM_VMS = "forsystemvms";
@@ -239,6 +240,7 @@ public class ApiConstants {
239240
public static final String NEXT_ACL_RULE_ID = "nextaclruleid";
240241
public static final String MOVE_ACL_CONSISTENCY_HASH = "aclconsistencyhash";
241242
public static final String IMAGE_PATH = "imagepath";
243+
public static final String INSTANCE_CONVERSION_SUPPORTED = "instanceconversionsupported";
242244
public static final String INTERNAL_DNS1 = "internaldns1";
243245
public static final String INTERNAL_DNS2 = "internaldns2";
244246
public static final String INTERNET_PROTOCOL = "internetprotocol";
@@ -1135,6 +1137,8 @@ public class ApiConstants {
11351137
public static final String WEBHOOK_ID = "webhookid";
11361138
public static final String WEBHOOK_NAME = "webhookname";
11371139

1140+
public static final String NFS_MOUNT_OPTIONS = "nfsmountopts";
1141+
11381142
/**
11391143
* This enum specifies IO Drivers, each option controls specific policies on I/O.
11401144
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).

api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportVmCmd.java

+17-8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.apache.cloudstack.api.response.VmwareDatacenterResponse;
3838
import org.apache.cloudstack.api.response.ZoneResponse;
3939
import org.apache.cloudstack.vm.VmImportService;
40+
import org.apache.commons.lang3.BooleanUtils;
4041
import org.apache.commons.lang3.ObjectUtils;
4142
import org.apache.commons.lang3.StringUtils;
4243

@@ -116,40 +117,44 @@ public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
116117
description = "Temp Path on external host for disk image copy" )
117118
private String tmpPath;
118119

119-
// Import from Vmware to KVM migration parameters
120+
// Import from VMware to KVM migration parameters
120121

121122
@Parameter(name = ApiConstants.EXISTING_VCENTER_ID,
122123
type = CommandType.UUID,
123124
entityType = VmwareDatacenterResponse.class,
124-
description = "(only for importing migrated VMs from Vmware to KVM) UUID of a linked existing vCenter")
125+
description = "(only for importing VMs from VMware to KVM) UUID of a linked existing vCenter")
125126
private Long existingVcenterId;
126127

127128
@Parameter(name = ApiConstants.HOST_IP,
128129
type = BaseCmd.CommandType.STRING,
129-
description = "(only for importing migrated VMs from Vmware to KVM) VMware ESXi host IP/Name.")
130+
description = "(only for importing VMs from VMware to KVM) VMware ESXi host IP/Name.")
130131
private String hostip;
131132

132133
@Parameter(name = ApiConstants.VCENTER,
133134
type = CommandType.STRING,
134-
description = "(only for importing migrated VMs from Vmware to KVM) The name/ip of vCenter. Make sure it is IP address or full qualified domain name for host running vCenter server.")
135+
description = "(only for importing VMs from VMware to KVM) The name/ip of vCenter. Make sure it is IP address or full qualified domain name for host running vCenter server.")
135136
private String vcenter;
136137

137138
@Parameter(name = ApiConstants.DATACENTER_NAME, type = CommandType.STRING,
138-
description = "(only for importing migrated VMs from Vmware to KVM) Name of VMware datacenter.")
139+
description = "(only for importing VMs from VMware to KVM) Name of VMware datacenter.")
139140
private String datacenterName;
140141

141142
@Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING,
142-
description = "(only for importing migrated VMs from Vmware to KVM) Name of VMware cluster.")
143+
description = "(only for importing VMs from VMware to KVM) Name of VMware cluster.")
143144
private String clusterName;
144145

145146
@Parameter(name = ApiConstants.CONVERT_INSTANCE_HOST_ID, type = CommandType.UUID, entityType = HostResponse.class,
146-
description = "(only for importing migrated VMs from Vmware to KVM) optional - the host to perform the virt-v2v migration from VMware to KVM.")
147+
description = "(only for importing VMs from VMware to KVM) optional - the host to perform the virt-v2v migration from VMware to KVM.")
147148
private Long convertInstanceHostId;
148149

149150
@Parameter(name = ApiConstants.CONVERT_INSTANCE_STORAGE_POOL_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class,
150-
description = "(only for importing migrated VMs from Vmware to KVM) optional - the temporary storage pool to perform the virt-v2v migration from VMware to KVM.")
151+
description = "(only for importing VMs from VMware to KVM) optional - the temporary storage pool to perform the virt-v2v migration from VMware to KVM.")
151152
private Long convertStoragePoolId;
152153

154+
@Parameter(name = ApiConstants.FORCE_MS_TO_IMPORT_VM_FILES, type = CommandType.BOOLEAN,
155+
description = "(only for importing VMs from VMware to KVM) optional - if true, forces MS to import VM file(s) to temporary storage, else uses KVM Host if ovftool is available, falls back to MS if not.")
156+
private Boolean forceMsToImportVmFiles;
157+
153158
/////////////////////////////////////////////////////
154159
/////////////////// Accessors ///////////////////////
155160
/////////////////////////////////////////////////////
@@ -198,6 +203,10 @@ public Long getConvertStoragePoolId() {
198203
return convertStoragePoolId;
199204
}
200205

206+
public Boolean getForceMsToImportVmFiles() {
207+
return BooleanUtils.toBooleanDefaultIfNull(forceMsToImportVmFiles, false);
208+
}
209+
201210
public String getHypervisor() {
202211
return hypervisor;
203212
}

api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
7272

7373
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID_IP,
7474
type = CommandType.MAP,
75-
description = "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].ip=10.1.1.75",
75+
description = "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].vmip=10.1.1.75",
7676
since = "4.4")
7777
private Map vmIdIpMap;
7878

0 commit comments

Comments
 (0)