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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 10 additions & 19 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 25 additions & 8 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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
/**

0 commit comments

Comments
 (0)