Skip to content

Commit 7d2e48a

Browse files
committed
Merge remote-tracking branch 'origin/main' into differential-snapshots
2 parents add5395 + 69cf299 commit 7d2e48a

File tree

120 files changed

+2023
-508
lines changed

Some content is hidden

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

120 files changed

+2023
-508
lines changed

.asf.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ github:
5151

5252
collaborators:
5353
- acs-robot
54-
- rajujith
55-
- winterhazel
5654
- gpordeus
5755
- hsato03
5856
- bernardodemarco
5957
- abh1sar
6058
- FelipeM525
6159
- lucas-a-martins
60+
- nicoschmdt
6261

6362
protected_branches: ~
6463

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class RemoteInstanceTO implements Serializable {
2727

2828
private Hypervisor.HypervisorType hypervisorType;
2929
private String instanceName;
30+
private String instancePath;
3031

3132
// VMware Remote Instances parameters (required for exporting OVA through ovftool)
3233
// TODO: cloud.agent.transport.Request#getCommands() cannot handle gsoc decode for polymorphic classes
@@ -44,9 +45,10 @@ public RemoteInstanceTO(String instanceName) {
4445
this.instanceName = instanceName;
4546
}
4647

47-
public RemoteInstanceTO(String instanceName, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
48+
public RemoteInstanceTO(String instanceName, String instancePath, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
4849
this.hypervisorType = Hypervisor.HypervisorType.VMware;
4950
this.instanceName = instanceName;
51+
this.instancePath = instancePath;
5052
this.vcenterHost = vcenterHost;
5153
this.vcenterUsername = vcenterUsername;
5254
this.vcenterPassword = vcenterPassword;
@@ -61,6 +63,10 @@ public String getInstanceName() {
6163
return this.instanceName;
6264
}
6365

66+
public String getInstancePath() {
67+
return this.instancePath;
68+
}
69+
6470
public String getVcenterUsername() {
6571
return vcenterUsername;
6672
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MigrationOptions implements Serializable {
2424

2525
private String srcPoolUuid;
2626
private Storage.StoragePoolType srcPoolType;
27+
private Long srcPoolClusterId;
2728
private Type type;
2829
private ScopeType scopeType;
2930
private String srcBackingFilePath;
@@ -38,21 +39,23 @@ public enum Type {
3839
public MigrationOptions() {
3940
}
4041

41-
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcBackingFilePath, boolean copySrcTemplate, ScopeType scopeType) {
42+
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcBackingFilePath, boolean copySrcTemplate, ScopeType scopeType, Long srcPoolClusterId) {
4243
this.srcPoolUuid = srcPoolUuid;
4344
this.srcPoolType = srcPoolType;
4445
this.type = Type.LinkedClone;
4546
this.scopeType = scopeType;
4647
this.srcBackingFilePath = srcBackingFilePath;
4748
this.copySrcTemplate = copySrcTemplate;
49+
this.srcPoolClusterId = srcPoolClusterId;
4850
}
4951

50-
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcVolumeUuid, ScopeType scopeType) {
52+
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcVolumeUuid, ScopeType scopeType, Long srcPoolClusterId) {
5153
this.srcPoolUuid = srcPoolUuid;
5254
this.srcPoolType = srcPoolType;
5355
this.type = Type.FullClone;
5456
this.scopeType = scopeType;
5557
this.srcVolumeUuid = srcVolumeUuid;
58+
this.srcPoolClusterId = srcPoolClusterId;
5659
}
5760

5861
public String getSrcPoolUuid() {
@@ -63,6 +66,10 @@ public Storage.StoragePoolType getSrcPoolType() {
6366
return srcPoolType;
6467
}
6568

69+
public Long getSrcPoolClusterId() {
70+
return srcPoolClusterId;
71+
}
72+
6673
public ScopeType getScopeType() { return scopeType; }
6774

6875
public String getSrcBackingFilePath() {

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
import java.util.List;
2323
import java.util.Map;
2424

25+
import com.cloud.exception.ResourceAllocationException;
26+
import com.cloud.offering.DiskOffering;
27+
import com.cloud.user.Account;
2528
import com.cloud.utils.Pair;
29+
import com.cloud.utils.fsm.NoTransitionException;
30+
2631
import org.apache.cloudstack.api.command.user.volume.AssignVolumeCmd;
2732
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
2833
import org.apache.cloudstack.api.command.user.volume.ChangeOfferingForVolumeCmd;
@@ -37,21 +42,17 @@
3742
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
3843
import org.apache.cloudstack.framework.config.ConfigKey;
3944

40-
import com.cloud.exception.ResourceAllocationException;
41-
import com.cloud.user.Account;
42-
import com.cloud.utils.fsm.NoTransitionException;
43-
4445
public interface VolumeApiService {
4546

46-
ConfigKey<Long> ConcurrentMigrationsThresholdPerDatastore = new ConfigKey<Long>("Advanced"
47+
ConfigKey<Long> ConcurrentMigrationsThresholdPerDatastore = new ConfigKey<>("Advanced"
4748
, Long.class
4849
, "concurrent.migrations.per.target.datastore"
4950
, "0"
5051
, "Limits number of migrations that can be handled per datastore concurrently; default is 0 - unlimited"
5152
, true // not sure if this is to be dynamic
5253
, ConfigKey.Scope.Global);
5354

54-
ConfigKey<Boolean> UseHttpsToUpload = new ConfigKey<Boolean>("Advanced",
55+
ConfigKey<Boolean> UseHttpsToUpload = new ConfigKey<>("Advanced",
5556
Boolean.class,
5657
"use.https.to.upload",
5758
"true",
@@ -85,7 +86,7 @@ public interface VolumeApiService {
8586
* @param cmd
8687
* the API command wrapping the criteria
8788
* @return the volume object
88-
* @throws ResourceAllocationException
89+
* @throws ResourceAllocationException no capacity to allocate the new volume size
8990
*/
9091
Volume resizeVolume(ResizeVolumeCmd cmd) throws ResourceAllocationException;
9192

@@ -139,13 +140,13 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
139140
Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName) throws ResourceAllocationException;
140141

141142
/**
142-
* Checks if the target storage supports the disk offering.
143+
* Checks if the storage pool supports the disk offering tags.
143144
* This validation is consistent with the mechanism used to select a storage pool to deploy a volume when a virtual machine is deployed or when a data disk is allocated.
144145
*
145146
* The scenarios when this method returns true or false is presented in the following table.
146147
* <table border="1">
147148
* <tr>
148-
* <th>#</th><th>Disk offering tags</th><th>Storage tags</th><th>Does the storage support the disk offering?</th>
149+
* <th>#</th><th>Disk offering diskOfferingTags</th><th>Storage diskOfferingTags</th><th>Does the storage support the disk offering?</th>
149150
* </tr>
150151
* <body>
151152
* <tr>
@@ -169,7 +170,8 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
169170
* </body>
170171
* </table>
171172
*/
172-
boolean doesTargetStorageSupportDiskOffering(StoragePool destPool, String diskOfferingTags);
173+
boolean doesStoragePoolSupportDiskOffering(StoragePool destPool, DiskOffering diskOffering);
174+
boolean doesStoragePoolSupportDiskOfferingTags(StoragePool destPool, String diskOfferingTags);
173175

174176
Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge);
175177

api/src/main/java/org/apache/cloudstack/api/command/admin/offering/IsAccountAllowedToCreateOfferingsWithTagsCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
responseObject = IsAccountAllowedToCreateOfferingsWithTagsResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
3030
public class IsAccountAllowedToCreateOfferingsWithTagsCmd extends BaseCmd {
3131

32-
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account UUID")
32+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account UUID", required = true)
3333
private Long id;
3434

3535
@Override

api/src/main/java/org/apache/cloudstack/backup/BackupProvider.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,39 +49,38 @@ public interface BackupProvider {
4949

5050
/**
5151
* Assign a VM to a backup offering or policy
52-
* @param vm
53-
* @param backup
54-
* @param policy
55-
* @return
52+
* @param vm the machine to back up
53+
* @param backupOffering the SLA definition for the backup
54+
* @return succeeded?
5655
*/
5756
boolean assignVMToBackupOffering(VirtualMachine vm, BackupOffering backupOffering);
5857

5958
/**
6059
* Removes a VM from a backup offering or policy
61-
* @param vm
62-
* @return
60+
* @param vm the machine to stop backing up
61+
* @return succeeded?
6362
*/
6463
boolean removeVMFromBackupOffering(VirtualMachine vm);
6564

6665
/**
67-
* Whether the provide will delete backups on removal of VM from the offfering
66+
* Whether the provider will delete backups on removal of VM from the offering
6867
* @return boolean result
6968
*/
7069
boolean willDeleteBackupsOnOfferingRemoval();
7170

7271
/**
7372
* Starts and creates an adhoc backup process
7473
* for a previously registered VM backup
75-
* @param backup
76-
* @return
74+
* @param vm the machine to make a backup of
75+
* @return the result and {code}Backup{code} {code}Object{code}
7776
*/
7877
Pair<Boolean, Backup> takeBackup(VirtualMachine vm);
7978

8079
/**
8180
* Delete an existing backup
82-
* @param backuo The backup to exclude
81+
* @param backup The backup to exclude
8382
* @param forced Indicates if backup will be force removed or not
84-
* @return
83+
* @return succeeded?
8584
*/
8685
boolean deleteBackup(Backup backup, boolean forced);
8786

@@ -97,23 +96,23 @@ public interface BackupProvider {
9796

9897
/**
9998
* Returns backup metrics for a list of VMs in a zone
100-
* @param zoneId
101-
* @param vms
102-
* @return
99+
* @param zoneId the zone for which to return metrics
100+
* @param vms a list of machines to get measurements for
101+
* @return a map of machine -> backup metrics
103102
*/
104103
Map<VirtualMachine, Backup.Metric> getBackupMetrics(Long zoneId, List<VirtualMachine> vms);
105104

106105
/**
107106
* This method should TODO
108-
* @param
107+
* @param vm the machine to get restore point for
109108
*/
110-
public List<Backup.RestorePoint> listRestorePoints(VirtualMachine vm);
109+
List<Backup.RestorePoint> listRestorePoints(VirtualMachine vm);
111110

112111
/**
113112
* This method should TODO
114-
* @param
115-
* @param
116-
* @param metric
113+
* @param restorePoint the restore point to create a backup for
114+
* @param vm The machine for which to create a backup
115+
* @param metric the metric object to update with the new backup data
117116
*/
118117
Backup createNewBackupEntryForRestorePoint(Backup.RestorePoint restorePoint, VirtualMachine vm, Backup.Metric metric);
119118
}

api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public enum PowerState {
3333

3434
private String internalCSName;
3535

36+
private String path;
37+
3638
private PowerState powerState;
3739

3840
private PowerState cloneSourcePowerState;
@@ -75,6 +77,14 @@ public void setInternalCSName(String internalCSName) {
7577
this.internalCSName = internalCSName;
7678
}
7779

80+
public String getPath() {
81+
return path;
82+
}
83+
84+
public void setPath(String path) {
85+
this.path = path;
86+
}
87+
7888
public PowerState getPowerState() {
7989
return powerState;
8090
}

engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package com.cloud.capacity;
1818

19+
import java.util.List;
20+
1921
import org.apache.cloudstack.framework.config.ConfigKey;
2022
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
2123

@@ -67,7 +69,7 @@ public interface CapacityManager {
6769
"0.85",
6870
"Percentage (as a value between 0 and 1) of storage utilization above which allocators will disable using the pool for low storage available.",
6971
true,
70-
ConfigKey.Scope.Zone);
72+
List.of(ConfigKey.Scope.StoragePool, ConfigKey.Scope.Zone));
7173
static final ConfigKey<Double> StorageOverprovisioningFactor =
7274
new ConfigKey<>(
7375
"Storage",
@@ -85,7 +87,7 @@ public interface CapacityManager {
8587
"0.85",
8688
"Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for low allocated storage available.",
8789
true,
88-
ConfigKey.Scope.Zone);
90+
List.of(ConfigKey.Scope.StoragePool, ConfigKey.Scope.Zone));
8991
static final ConfigKey<Boolean> StorageOperationsExcludeCluster =
9092
new ConfigKey<>(
9193
Boolean.class,
@@ -125,7 +127,7 @@ public interface CapacityManager {
125127
"Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for volume resize. " +
126128
"This is applicable only when volume.resize.allowed.beyond.allocation is set to true.",
127129
true,
128-
ConfigKey.Scope.Zone);
130+
List.of(ConfigKey.Scope.StoragePool, ConfigKey.Scope.Zone));
129131

130132
ConfigKey<Integer> CapacityCalculateWorkers = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class,
131133
"capacity.calculate.workers", "1",

engine/components-api/src/main/java/com/cloud/storage/StorageManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public interface StorageManager extends StorageService {
214214
ConfigKey<Boolean> AllowVolumeReSizeBeyondAllocation = new ConfigKey<Boolean>("Advanced", Boolean.class, "volume.resize.allowed.beyond.allocation", "false",
215215
"Determines whether volume size can exceed the pool capacity allocation disable threshold (pool.storage.allocated.capacity.disablethreshold) " +
216216
"when resize a volume upto resize capacity disable threshold (pool.storage.allocated.resize.capacity.disablethreshold)",
217-
true, ConfigKey.Scope.Zone);
217+
true, List.of(ConfigKey.Scope.StoragePool, ConfigKey.Scope.Zone));
218218

219219
ConfigKey<Integer> StoragePoolHostConnectWorkers = new ConfigKey<>("Storage", Integer.class,
220220
"storage.pool.host.connect.workers", "1",

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ protected void advanceExpunge(VMInstanceVO vm) throws ResourceUnavailableExcepti
721721

722722
private void handleUnsuccessfulExpungeOperation(List<Command> finalizeExpungeCommands, List<Command> nicExpungeCommands,
723723
VMInstanceVO vm, Long hostId) throws OperationTimedoutException, AgentUnavailableException {
724-
if (CollectionUtils.isNotEmpty(finalizeExpungeCommands) || CollectionUtils.isNotEmpty(nicExpungeCommands) && (hostId != null)) {
724+
if ((CollectionUtils.isNotEmpty(finalizeExpungeCommands) || CollectionUtils.isNotEmpty(nicExpungeCommands)) && hostId != null) {
725725
final Commands cmds = new Commands(Command.OnError.Stop);
726726
addAllExpungeCommandsFromList(finalizeExpungeCommands, cmds, vm);
727727
addAllExpungeCommandsFromList(nicExpungeCommands, cmds, vm);

0 commit comments

Comments
 (0)