Skip to content

Create new Instance from VM backup #10140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 98 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
35ed72c
Initial api and service layer changes
abh1sar Dec 25, 2024
e094e14
Nas backup provider changes
abh1sar Dec 25, 2024
27feeda
Add hypervisor, service_offering and template to backups table.
abh1sar Dec 30, 2024
f98da37
Create backup_details table and add details related to vm.
abh1sar Jan 1, 2025
04a2deb
Initial UI form
abh1sar Jan 2, 2025
d3439ad
Save networkIds and diskOfferingIds in backup_details. Create require…
abh1sar Jan 3, 2025
753d80f
Restore backup to VM plugin change for VeeamBackupProvider
abh1sar Jan 5, 2025
72c943f
UI form updates
abh1sar Jan 6, 2025
7ae078e
Create instance from backup using just the backupid
abh1sar Jan 7, 2025
31f89df
Remove zone and iso from DeployVMFromBackup.vue
abh1sar Jan 7, 2025
7e3f083
Create multiple data volumes using the deployVirtualMachine Api
abh1sar Jan 9, 2025
f46fad8
Create multiple data volumes for createVMFromBackup api and ui
abh1sar Jan 9, 2025
d941809
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Jan 9, 2025
10f7beb
Fix build failure after merge
abh1sar Jan 9, 2025
edbdd01
setup ssh key pair again after restore
abh1sar Jan 10, 2025
f004264
added miniops and maxiops customisation in ui
abh1sar Jan 10, 2025
b1a86b8
added UT for backupManager and UserVmManager
abh1sar Jan 12, 2025
3b317e0
Minor ui fixes and null checks
abh1sar Jan 13, 2025
cfc9c6f
Remove import vm from restorebackuptoinstance
abh1sar Jan 14, 2025
8717e3a
set willDeleteBackupsOnOfferingRemoval to false for dummy and veeam. …
abh1sar Jan 14, 2025
f4f0655
Preserve device Ids of data volumes in the new instance.
abh1sar Jan 14, 2025
07f24cb
Throw exception if diskOffering stored in the backup is not present.
abh1sar Jan 14, 2025
38ad9be
Limit the volume size of new instance to minimum of backup volume size
abh1sar Jan 14, 2025
c2db7af
diskofferingid not supported by createVmFromBackup
abh1sar Jan 14, 2025
50aae80
remove userdata from ui form
abh1sar Jan 14, 2025
963437d
Remove console logs from ui forms
abh1sar Jan 14, 2025
300d096
fix UT failures in BackupManagerTest and UserVmManagerImplTest
abh1sar Jan 15, 2025
3c3885c
Merge branch 'main' into instance-from-backup
abh1sar Jan 15, 2025
0bea21f
Peserve override disk offering from backup
abh1sar Jan 16, 2025
129cb85
Merge branch 'instance-from-backup' of https://github.com/shapeblue/c…
abh1sar Jan 16, 2025
723537b
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Jan 16, 2025
683aebe
Fix ut issue on merge
abh1sar Jan 16, 2025
5992a1e
Addressed minor review comments
abh1sar Jan 16, 2025
2da38da
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Jan 16, 2025
5ab6c4a
Fix spelling errors.
abh1sar Jan 16, 2025
26d26d8
added more Unit Tests
abh1sar Jan 19, 2025
0cebdae
Merge branch 'main' into instance-from-backup
abh1sar Jan 19, 2025
7c600c7
Return diskofferingid for compute only diskoffering as well in servic…
abh1sar Jan 28, 2025
ac96d06
minor ui fixes
abh1sar Jan 28, 2025
08d4581
Handle inactive disk offering edge case
abh1sar Jan 28, 2025
735c379
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Jan 28, 2025
675fc8d
backupvmdetails will be shown in listbackupsresponse only if listvmde…
abh1sar Feb 5, 2025
b708397
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Feb 5, 2025
4d2e444
remove extra line from schema-42010to42100.sql
abh1sar Feb 5, 2025
b7590ba
update Template selection + minor fixes
abh1sar Feb 24, 2025
ae62219
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Feb 24, 2025
9559323
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Feb 28, 2025
934b7ab
Add name and description to backup create
abh1sar Feb 28, 2025
1626a37
Fix UT failure in BackupManagerTest
abh1sar Mar 2, 2025
0043207
Fix UT failure in BackupManagerTest
abh1sar Mar 2, 2025
a60b717
Fix imports in VeeamBackupProvider
abh1sar Mar 3, 2025
4197912
Add object storage capacity and alerts.
abh1sar Mar 3, 2025
beb05ae
Backup storage capacity and alert framework layer.
abh1sar Mar 4, 2025
c72a10e
Nas provider support for backup storage stats
abh1sar Mar 6, 2025
54bf763
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Mar 6, 2025
7791ff3
Don't show object store and backup capacity if total capacity is 0
abh1sar Mar 6, 2025
3d3f6c1
Merge branch 'instance-from-backup' of https://github.com/shapeblue/c…
abh1sar Mar 6, 2025
051d52c
Handle backup listing and restore for expunged and purged Instances
abh1sar Mar 10, 2025
73c185c
Merge remote-tracking branch 'upstream/main' into instance-from-backup
abh1sar Mar 10, 2025
dd45cfe
Fix BackupManagerTest failure
abh1sar Mar 10, 2025
9894eff
Added UT to AlertManager, BackupDao, NasBackupProvider and BackupMana…
abh1sar Mar 11, 2025
47b6cd1
make capacity dasboard scrollable
abh1sar Mar 11, 2025
e909c18
Fix syntax errors in schema-42010to42100.sql
abh1sar Mar 11, 2025
22d25d3
Fix pre commit failure in BackupDaoImplTest
abh1sar Mar 11, 2025
4997056
Enable cephFS in NAS backup repository
abh1sar Mar 11, 2025
1574f3a
Error out vm expunge from destroyvmCmd if it has a backup offering wi…
abh1sar Mar 11, 2025
912639b
Extract duplicate code into new method checkAndRemoveBackupOfferingBe…
abh1sar Mar 12, 2025
1123adf
Addressed last set of review comments
abh1sar Mar 17, 2025
d76cb40
fix npe in updateObjectStore
abh1sar Mar 18, 2025
b2a499e
Handle backup offering remove without deleting backups
abh1sar Mar 20, 2025
bdeb62d
Remove the concept of orphaned backup as vm with backups cannot be pu…
abh1sar Mar 20, 2025
918b8b8
fix listVmIdsWithBackupsInZone
abh1sar Mar 26, 2025
39ea6b7
Add dataSize, backupSize to Backup.RestorePoint for all providers
abh1sar Mar 27, 2025
55486d6
minor UI fixes
abh1sar Mar 27, 2025
f49651f
Show name,description fields only for synchronous backup provider plu…
abh1sar Mar 28, 2025
a50f358
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Mar 28, 2025
c307f82
Fix test failure in BackupDaoImplTest
abh1sar Mar 28, 2025
e0a1c97
Added UT and minor bug fixes
abh1sar Mar 30, 2025
d1b9b6a
Merge branch 'main' into instance-from-backup
abh1sar Apr 2, 2025
70d2395
Merge branch 'instance-from-backup' of https://github.com/shapeblue/c…
abh1sar Apr 9, 2025
c45efba
Merge remote-tracking branch 'upstream/main' into instance
abh1sar Apr 9, 2025
1241252
fixed for build failure in NASBackupProvider
abh1sar Apr 10, 2025
eb4b132
Addressed last set of review comments from Wei.
abh1sar Apr 10, 2025
f8a20a4
Fixed deploydb issue by using TEXT instead of varchar(65536) in backu…
abh1sar Apr 10, 2025
17ecc5a
Handle create VM from backup for VMs created using ISO.
abh1sar Apr 11, 2025
6b098ce
Minor bug fix in UserVmManagerImpl
abh1sar Apr 11, 2025
8803c78
Fix for UT failures
abh1sar Apr 11, 2025
57b0f2c
Fix build failures
abh1sar Apr 11, 2025
1075a55
BaseDeployVMCmd as the base class for DeployVmCmd and CreateVmFromBac…
abh1sar Apr 14, 2025
d2fb239
Fix Expunge generic error
abh1sar Apr 23, 2025
2d89a8f
Fix Backup Storage capacity and NAS backup without mount options
abh1sar Apr 23, 2025
e2fa0be
Dummy BnR plugin integration test
abh1sar Apr 25, 2025
f3f3f97
Store and get IpAddresses details from backup metadata while creating…
abh1sar Apr 29, 2025
555eed8
fix pre-commit failure in CreateVMFromBackupCmd
abh1sar Apr 29, 2025
a34c78a
Added more UT to UserVmManagerImplTest
abh1sar May 1, 2025
a298c33
Fix errors in testDestroyVM in UserVmManagerImplTest
abh1sar May 1, 2025
062e343
Add more UT to BackupManagerTest
abh1sar May 1, 2025
359af7b
Added UT to BackupManager, NetworkService and StorageManager
abh1sar May 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion api/src/main/java/com/cloud/capacity/Capacity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ public interface Capacity extends InternalIdentity, Identity {
public static final short CAPACITY_TYPE_LOCAL_STORAGE = 9;
public static final short CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = 10;
public static final short CAPACITY_TYPE_GPU = 19;
public static final short CAPACITY_TYPE_OBJECT_STORAGE = 20;
public static final short CAPACITY_TYPE_BACKUP_STORAGE = 21;

public static final short CAPACITY_TYPE_CPU_CORE = 90;

public static final List<Short> STORAGE_CAPACITY_TYPES = List.of(CAPACITY_TYPE_STORAGE,
CAPACITY_TYPE_STORAGE_ALLOCATED,
CAPACITY_TYPE_SECONDARY_STORAGE,
CAPACITY_TYPE_LOCAL_STORAGE);
CAPACITY_TYPE_LOCAL_STORAGE,
CAPACITY_TYPE_BACKUP_STORAGE,
CAPACITY_TYPE_OBJECT_STORAGE);

public Long getHostOrPoolId();

Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/event/EventTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,10 @@ public class EventTypes {
public static final String EVENT_VM_BACKUP_IMPORT_OFFERING = "BACKUP.IMPORT.OFFERING";
public static final String EVENT_VM_BACKUP_OFFERING_ASSIGN = "BACKUP.OFFERING.ASSIGN";
public static final String EVENT_VM_BACKUP_OFFERING_REMOVE = "BACKUP.OFFERING.REMOVE";
public static final String EVENT_VM_BACKUP_DELETE_LAST_POST_OFFERING_REMOVE = "BACKUP.DELETE.LAST.POST.OFFERING.REMOVE";
public static final String EVENT_VM_BACKUP_CREATE = "BACKUP.CREATE";
public static final String EVENT_VM_BACKUP_RESTORE = "BACKUP.RESTORE";
public static final String EVENT_VM_BACKUP_RESTORE_TO_VM = "BACKUP.RESTORE.TO.VM";
public static final String EVENT_VM_BACKUP_DELETE = "BACKUP.DELETE";
public static final String EVENT_VM_BACKUP_RESTORE_VOLUME_TO_VM = "BACKUP.RESTORE.VOLUME.TO.VM";
public static final String EVENT_VM_BACKUP_SCHEDULE_CONFIGURE = "BACKUP.SCHEDULE.CONFIGURE";
Expand Down
1 change: 1 addition & 0 deletions api/src/main/java/com/cloud/network/NetworkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,5 @@ Network createPrivateNetwork(String networkName, String displayText, long physic
InternalLoadBalancerElementService getInternalLoadBalancerElementByNetworkServiceProviderId(long networkProviderId);
InternalLoadBalancerElementService getInternalLoadBalancerElementById(long providerId);
List<InternalLoadBalancerElementService> getInternalLoadBalancerElements();
IpAddresses getIpAddressesFromIps(String ipAddress, String ip6Address, String macAddress);
}
21 changes: 21 additions & 0 deletions api/src/main/java/com/cloud/offering/DiskOfferingInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
private Long _size;
private Long _minIops;
private Long _maxIops;
private Long _deviceId;

public DiskOfferingInfo() {
}
Expand All @@ -31,6 +32,18 @@
_diskOffering = diskOffering;
}

public DiskOfferingInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops) {
_diskOffering = diskOffering;
_size = size;
_minIops = minIops;
_maxIops = maxIops;
}

public DiskOfferingInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops, Long deviceId) {
this(diskOffering, size, minIops, maxIops);
_deviceId = deviceId;
}

public void setDiskOffering(DiskOffering diskOffering) {
_diskOffering = diskOffering;
}
Expand Down Expand Up @@ -62,4 +75,12 @@
public Long getMaxIops() {
return _maxIops;
}

public void setDeviceId(Long deviceId) {
_deviceId = deviceId;
}

Check warning on line 81 in api/src/main/java/com/cloud/offering/DiskOfferingInfo.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/com/cloud/offering/DiskOfferingInfo.java#L79-L81

Added lines #L79 - L81 were not covered by tests

public Long getDeviceId() {

Check warning on line 83 in api/src/main/java/com/cloud/offering/DiskOfferingInfo.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L83 was not covered by tests
return _deviceId;
}

Check warning on line 85 in api/src/main/java/com/cloud/offering/DiskOfferingInfo.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L85 was not covered by tests
}
2 changes: 1 addition & 1 deletion api/src/main/java/com/cloud/storage/StorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public interface StorageService {

void removeSecondaryStorageHeuristic(RemoveSecondaryStorageSelectorCmd cmd);

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

boolean deleteObjectStore(DeleteObjectStoragePoolCmd cmd);

Expand Down
15 changes: 10 additions & 5 deletions api/src/main/java/com/cloud/vm/UserVmService.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
import org.apache.cloudstack.api.command.user.vm.CreateVMFromBackupCmd;
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
Expand Down Expand Up @@ -55,6 +56,7 @@
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network.IpAddresses;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.DiskOfferingInfo;
import com.cloud.offering.ServiceOffering;
import com.cloud.storage.StoragePool;
import com.cloud.template.VirtualMachineTemplate;
Expand Down Expand Up @@ -217,7 +219,7 @@ void startVirtualMachineForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param
* available.
*/
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List<DiskOfferingInfo> dataDiskOfferingsInfo, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Map<String, String> customParameter, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
Expand Down Expand Up @@ -294,7 +296,7 @@ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering s
* available.
*/
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List<DiskOfferingInfo> dataDiskOfferingsInfo, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
Expand Down Expand Up @@ -366,7 +368,7 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin
* available.
*/
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner,
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
String hostName, String displayName, Long diskOfferingId, Long diskSize, List<DiskOfferingInfo> dataDiskOfferingsInfo, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap, Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
Map<String, String> templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId)
Expand Down Expand Up @@ -412,8 +414,7 @@ UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
void deletePrivateTemplateRecord(Long templateId);

HypervisorType getHypervisorTypeOfUserVM(long vmid);

UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException,
UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException,
StorageUnavailableException, ResourceAllocationException;

/**
Expand Down Expand Up @@ -513,4 +514,8 @@ UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemp
* @return true if the VM is successfully unmanaged, false if not.
*/
boolean unmanageUserVM(Long vmId);

UserVm allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws InsufficientCapacityException, ResourceAllocationException, ResourceUnavailableException;

UserVm restoreVMFromBackup(CreateVMFromBackupCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException;
}
1 change: 0 additions & 1 deletion api/src/main/java/com/cloud/vm/VirtualMachine.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public static StateMachine2<State, VirtualMachine.Event, VirtualMachine> getStat
s_fsm.addTransition(new Transition<State, Event>(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging, null));
s_fsm.addTransition(new Transition<State, Event>(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging, null));
s_fsm.addTransition(new Transition<State, Event>(State.Stopped, Event.RestoringRequested, State.Restoring, null));
s_fsm.addTransition(new Transition<State, Event>(State.Expunging, Event.RestoringRequested, State.Restoring, null));
s_fsm.addTransition(new Transition<State, Event>(State.Destroyed, Event.RestoringRequested, State.Restoring, null));
s_fsm.addTransition(new Transition<State, Event>(State.Restoring, Event.RestoringSuccess, State.Stopped, null));
s_fsm.addTransition(new Transition<State, Event>(State.Restoring, Event.RestoringFailed, State.Stopped, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ private AlertType(short type, String name, boolean isDefault) {
public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType((short)32, "ALERT.VM.SNAPSHOT", true);
public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PUBLIC.IFACE.MTU", true);
public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PRIVATE.IFACE.MTU", true);
public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_BACKUP_STORAGE, "ALERT.STORAGE.BACKUP", true);
public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_OBJECT_STORAGE, "ALERT.STORAGE.OBJECT", true);

public short getType() {
return type;
Expand Down
13 changes: 13 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class ApiConstants {
public static final String ADDRESS = "address";
public static final String ALGORITHM = "algorithm";
public static final String ALIAS = "alias";
public static final String ALLOCATED = "allocated";
public static final String ALLOCATED_DATE = "allocateddate";
public static final String ALLOCATED_ONLY = "allocatedonly";
public static final String ALLOCATED_TIME = "allocated";
Expand Down Expand Up @@ -59,6 +60,7 @@ public class ApiConstants {
public static final String BACKUP_STORAGE_AVAILABLE = "backupstorageavailable";
public static final String BACKUP_STORAGE_LIMIT = "backupstoragelimit";
public static final String BACKUP_STORAGE_TOTAL = "backupstoragetotal";
public static final String BACKUP_VM_OFFERING_REMOVED = "vmbackupofferingremoved";
public static final String BACKUP_TOTAL = "backuptotal";
public static final String BASE64_IMAGE = "base64image";
public static final String BGP_PEERS = "bgppeers";
Expand Down Expand Up @@ -144,6 +146,7 @@ public class ApiConstants {
public static final String MAX_IOPS = "maxiops";
public static final String HYPERVISOR_SNAPSHOT_RESERVE = "hypervisorsnapshotreserve";
public static final String DATACENTER_NAME = "datacentername";
public static final String DATADISKS_DETAILS = "datadisksdetails";
public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist";
public static final String DEFAULT_VALUE = "defaultvalue";
public static final String DELETE_PROTECTION = "deleteprotection";
Expand All @@ -152,6 +155,7 @@ public class ApiConstants {
public static final String DESTINATION_ZONE_ID = "destzoneid";
public static final String DETAILS = "details";
public static final String DEVICE_ID = "deviceid";
public static final String DEVICE_IDS = "deviceids";
public static final String DIRECT_DOWNLOAD = "directdownload";
public static final String DISK = "disk";
public static final String DISK_OFFERING_ID = "diskofferingid";
Expand All @@ -163,7 +167,9 @@ public class ApiConstants {
public static final String DISK_IO_WRITE = "diskiowrite";
public static final String DISK_IO_PSTOTAL = "diskiopstotal";
public static final String DISK_SIZE = "disksize";
public static final String DISK_SIZES = "disksizes";
public static final String DISK_SIZE_STRICTNESS = "disksizestrictness";
public static final String DISK_OFFERING_IDS = "diskofferingids";
public static final String DISK_OFFERING_STRICTNESS = "diskofferingstrictness";
public static final String DOWNLOAD_DETAILS = "downloaddetails";
public static final String UTILIZATION = "utilization";
Expand Down Expand Up @@ -279,6 +285,7 @@ public class ApiConstants {
public static final String IP_ADDRESS = "ipaddress";
public static final String IP_ADDRESSES = "ipaddresses";
public static final String IP6_ADDRESS = "ip6address";
public static final String IP6_ADDRESSES = "ip6addresses";
public static final String IP_ADDRESS_ID = "ipaddressid";
public static final String IS_2FA_ENABLED = "is2faenabled";
public static final String IS_2FA_VERIFIED = "is2faverified";
Expand Down Expand Up @@ -327,6 +334,7 @@ public class ApiConstants {
public static final String LBID = "lbruleid";
public static final String LB_PROVIDER = "lbprovider";
public static final String MAC_ADDRESS = "macaddress";
public static final String MAC_ADDRESSES = "macaddresses";
public static final String MAX = "max";
public static final String MAX_SNAPS = "maxsnaps";
public static final String MAX_BACKUPS = "maxbackups";
Expand Down Expand Up @@ -411,6 +419,7 @@ public class ApiConstants {
public static final String POST_URL = "postURL";
public static final String POWER_STATE = "powerstate";
public static final String PRECEDENCE = "precedence";
public static final String PRESERVE_IP = "preserveip";
public static final String PRIVATE_INTERFACE = "privateinterface";
public static final String PRIVATE_IP = "privateip";
public static final String PRIVATE_PORT = "privateport";
Expand Down Expand Up @@ -517,6 +526,7 @@ public class ApiConstants {
public static final String TRUST_STORE_PASSWORD = "truststorepass";
public static final String URL = "url";
public static final String USAGE_INTERFACE = "usageinterface";
public static final String USED = "used";
public static final String USED_SUBNETS = "usedsubnets";
public static final String USED_IOPS = "usediops";
public static final String USER_DATA = "userdata";
Expand Down Expand Up @@ -559,8 +569,10 @@ public class ApiConstants {
public static final String ISOLATION_URI = "isolationuri";
public static final String IS_ALLOCATED = "isallocated";
public static final String IS_DEDICATED = "isdedicated";
public static final String IS_ISO = "isiso";
public static final String TAKEN = "taken";
public static final String VM_AVAILABLE = "vmavailable";
public static final String VM_DETAILS = "vmdetails";
public static final String VM_LIMIT = "vmlimit";
public static final String VM_TOTAL = "vmtotal";
public static final String VM_TYPE = "vmtype";
Expand Down Expand Up @@ -744,6 +756,7 @@ public class ApiConstants {
public static final String LIST_ALL = "listall";
public static final String LIST_ONLY_REMOVED = "listonlyremoved";
public static final String LIST_SYSTEM_VMS = "listsystemvms";
public static final String LIST_VM_DETAILS = "listvmdetails";
public static final String IP_RANGES = "ipranges";
public static final String IPV4_ROUTING = "ip4routing";
public static final String IPV4_ROUTES = "ip4routes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine

UserDataResponse createUserDataResponse(UserData userData);

BackupResponse createBackupResponse(Backup backup);
BackupResponse createBackupResponse(Backup backup, Boolean listVmDetails);

BackupScheduleResponse createBackupScheduleResponse(BackupSchedule backup);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
int res = resp1.getZoneName().compareTo(resp2.getZoneName());
if (res != 0) {
return res;
} else if (getSortBy() != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense
will you create a separated pr for 4.19/4.20 ? @abh1sar

return 0;

Check warning on line 138 in api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java#L138

Added line #L138 was not covered by tests
} else {
return resp1.getCapacityType().compareTo(resp2.getCapacityType());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public class AddObjectStoragePoolCmd extends BaseCmd {
@Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for the storage pool")
private String tags;

@Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "the total size of the object store in GiB. Used for tracking capacity and sending alerts", since = "4.21")
private Long size;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand All @@ -68,6 +71,10 @@ public String getName() {
return name;
}

public Long getTotalSize() {
return size;
}

public Map<String, String> getDetails() {
Map<String, String> detailsMap = null;
if (details != null && !details.isEmpty()) {
Expand Down Expand Up @@ -112,7 +119,7 @@ public long getEntityOwnerId() {
@Override
public void execute(){
try{
ObjectStore result = _storageService.discoverObjectStore(getName(), getUrl(), getProviderName(), getDetails());
ObjectStore result = _storageService.discoverObjectStore(getName(), getUrl(), getTotalSize(), getProviderName(), getDetails());
ObjectStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createObjectStoreResponse(result);
Expand Down
Loading
Loading