Skip to content

Commit cd77162

Browse files
committed
Merge branch 'main' into disk-controller-mappings
2 parents bb819b6 + 7d59bfe commit cd77162

File tree

309 files changed

+16241
-3808
lines changed

Some content is hidden

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

309 files changed

+16241
-3808
lines changed

agent/conf/agent.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,3 +447,6 @@ iscsi.session.cleanup.enabled=false
447447

448448
# Timeout (in seconds) to wait for the incremental snapshot to complete.
449449
# incremental.snapshot.timeout=10800
450+
451+
# If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise.
452+
# create.full.clone=false

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
import com.cloud.utils.nio.NioClient;
9898
import com.cloud.utils.nio.NioConnection;
9999
import com.cloud.utils.nio.Task;
100-
import com.cloud.utils.script.OutputInterpreter;
101100
import com.cloud.utils.script.Script;
102101

103102
/**
@@ -476,7 +475,7 @@ private void scheduleHostLBCheckerTask(final String lbAlgorithm, final long chec
476475
return;
477476
}
478477

479-
logger.info("Scheduling a recurring preferred host checker task with lb algorithm '{}' and host.lb.interval={} ms", lbAlgorithm, checkInterval);
478+
logger.info("Scheduling a recurring preferred host checker task with host.lb.interval={} ms", checkInterval);
480479
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
481480
hostLbCheckExecutor.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval,
482481
TimeUnit.MILLISECONDS);
@@ -614,9 +613,9 @@ protected void setupStartupCommand(final StartupCommand startup) {
614613
}
615614

616615
protected String getAgentArch() {
617-
final Script command = new Script("/usr/bin/arch", 500, logger);
618-
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
619-
return command.execute(parser);
616+
String arch = Script.runSimpleBashScript(Script.getExecutableAbsolutePath("arch"), 1000);
617+
logger.debug("Arch for agent: {} found: {}", _name, arch);
618+
return arch;
620619
}
621620

622621
@Override
@@ -968,9 +967,11 @@ private Answer migrateAgentToOtherMS(final MigrateAgentConnectionCommand cmd) {
968967
if (CollectionUtils.isNotEmpty(cmd.getMsList())) {
969968
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), false);
970969
}
971-
Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job")).schedule(() -> {
970+
ScheduledExecutorService migrateAgentConnectionService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job"));
971+
migrateAgentConnectionService.schedule(() -> {
972972
migrateAgentConnection(cmd.getAvoidMsList());
973973
}, 3, TimeUnit.SECONDS);
974+
migrateAgentConnectionService.shutdown();
974975
} catch (Exception e) {
975976
String errMsg = "Migrate agent connection failed, due to " + e.getMessage();
976977
logger.debug(errMsg, e);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,14 @@ public Property<Integer> getWorkers() {
863863
* */
864864
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);
865865

866+
/**
867+
* If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise. <br>
868+
* Data type: Boolean. <br>
869+
* Default value: <code>false</code>
870+
*/
871+
public static final Property<Boolean> CREATE_FULL_CLONE = new Property<>("create.full.clone", false);
872+
873+
866874
public static class Property <T>{
867875
private String name;
868876
private T defaultValue;

api/src/main/java/com/cloud/capacity/Capacity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ public interface Capacity extends InternalIdentity, Identity {
3434
public static final short CAPACITY_TYPE_LOCAL_STORAGE = 9;
3535
public static final short CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = 10;
3636
public static final short CAPACITY_TYPE_GPU = 19;
37+
public static final short CAPACITY_TYPE_OBJECT_STORAGE = 20;
38+
public static final short CAPACITY_TYPE_BACKUP_STORAGE = 21;
3739

3840
public static final short CAPACITY_TYPE_CPU_CORE = 90;
3941

4042
public static final List<Short> STORAGE_CAPACITY_TYPES = List.of(CAPACITY_TYPE_STORAGE,
4143
CAPACITY_TYPE_STORAGE_ALLOCATED,
4244
CAPACITY_TYPE_SECONDARY_STORAGE,
43-
CAPACITY_TYPE_LOCAL_STORAGE);
45+
CAPACITY_TYPE_LOCAL_STORAGE,
46+
CAPACITY_TYPE_BACKUP_STORAGE,
47+
CAPACITY_TYPE_OBJECT_STORAGE);
4448

4549
public Long getHostOrPoolId();
4650

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,13 @@ public class EventTypes {
632632
public static final String EVENT_VM_BACKUP_CREATE = "BACKUP.CREATE";
633633
public static final String EVENT_VM_BACKUP_RESTORE = "BACKUP.RESTORE";
634634
public static final String EVENT_VM_BACKUP_DELETE = "BACKUP.DELETE";
635+
public static final String EVENT_VM_BACKUP_OFFERING_REMOVED_AND_BACKUPS_DELETED = "BACKUP.OFFERING.BACKUPS.DEL";
635636
public static final String EVENT_VM_BACKUP_RESTORE_VOLUME_TO_VM = "BACKUP.RESTORE.VOLUME.TO.VM";
636637
public static final String EVENT_VM_BACKUP_SCHEDULE_CONFIGURE = "BACKUP.SCHEDULE.CONFIGURE";
637638
public static final String EVENT_VM_BACKUP_SCHEDULE_DELETE = "BACKUP.SCHEDULE.DELETE";
638639
public static final String EVENT_VM_BACKUP_USAGE_METRIC = "BACKUP.USAGE.METRIC";
639640
public static final String EVENT_VM_BACKUP_EDIT = "BACKUP.OFFERING.EDIT";
641+
public static final String EVENT_VM_CREATE_FROM_BACKUP = "VM.CREATE.FROM.BACKUP";
640642

641643
// external network device events
642644
public static final String EVENT_EXTERNAL_NVP_CONTROLLER_ADD = "PHYSICAL.NVPCONTROLLER.ADD";

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,5 +272,7 @@ Network createPrivateNetwork(String networkName, String displayText, long physic
272272

273273
boolean handleCksIsoOnNetworkVirtualRouter(Long virtualRouterId, boolean mount) throws ResourceUnavailableException;
274274

275+
IpAddresses getIpAddressesFromIps(String ipAddress, String ip6Address, String macAddress);
276+
275277
String getNicVlanValueForExternalVm(NicTO nic);
276278
}

api/src/main/java/com/cloud/offering/DiskOfferingInfo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ public DiskOfferingInfo(DiskOffering diskOffering) {
3131
_diskOffering = diskOffering;
3232
}
3333

34+
public DiskOfferingInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops) {
35+
_diskOffering = diskOffering;
36+
_size = size;
37+
_minIops = minIops;
38+
_maxIops = maxIops;
39+
}
40+
3441
public void setDiskOffering(DiskOffering diskOffering) {
3542
_diskOffering = diskOffering;
3643
}

api/src/main/java/com/cloud/storage/StorageService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public interface StorageService {
134134

135135
void removeSecondaryStorageHeuristic(RemoveSecondaryStorageSelectorCmd cmd);
136136

137-
ObjectStore discoverObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
137+
ObjectStore discoverObjectStore(String name, String url, Long size, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
138138

139139
boolean deleteObjectStore(DeleteObjectStoragePoolCmd cmd);
140140

api/src/main/java/com/cloud/storage/VolumeApiService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ public interface VolumeApiService {
113113

114114
Volume detachVolumeFromVM(DetachVolumeCmd cmd);
115115

116-
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds)
116+
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds, List<Long> poolIds, Boolean useStorageReplication)
117117
throws ResourceAllocationException;
118118

119-
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds) throws ResourceAllocationException;
119+
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds, List<Long> storagePoolIds, Boolean useStorageReplication) throws ResourceAllocationException;
120120

121121
Volume updateVolume(long volumeId, String path, String state, Long storageId,
122122
Boolean displayVolume, Boolean deleteProtection,

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
2828
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
2929
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
30+
import org.apache.cloudstack.api.command.user.vm.CreateVMFromBackupCmd;
3031
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
3132
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
3233
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
@@ -220,7 +221,7 @@ void startVirtualMachineForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param
220221
* available.
221222
*/
222223
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList,
223-
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
224+
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
224225
String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
225226
List<Long> affinityGroupIdList, Map<String, String> customParameter, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
226227
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
@@ -297,7 +298,7 @@ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering s
297298
* available.
298299
*/
299300
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
300-
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
301+
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, String group, HypervisorType hypervisor,
301302
HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
302303
List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
303304
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
@@ -369,7 +370,7 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin
369370
* available.
370371
*/
371372
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner,
372-
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
373+
String hostName, String displayName, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
373374
Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
374375
Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap, Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
375376
Map<String, String> templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot)
@@ -516,4 +517,8 @@ UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemp
516517
* @return true if the VM is successfully unmanaged, false if not.
517518
*/
518519
boolean unmanageUserVM(Long vmId);
520+
521+
UserVm allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws InsufficientCapacityException, ResourceAllocationException, ResourceUnavailableException;
522+
523+
UserVm restoreVMFromBackup(CreateVMFromBackupCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException;
519524
}

0 commit comments

Comments
 (0)