Skip to content

Commit b058f0a

Browse files
author
gean.silva
committed
remove file
1 parent 850b443 commit b058f0a

7 files changed

Lines changed: 97 additions & 3 deletions

File tree

‎api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupsCmd.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ public class ListBackupsCmd extends BaseListProjectAndAccountResourcesCmd {
8989
description = "list backups by backup offering")
9090
private Long backupOfferingId;
9191

92+
@Parameter(name = ApiConstants.STATUS,
93+
type = CommandType.STRING,
94+
since = "4.23.0",
95+
description = "list backups by status")
96+
private String backupStatus;
97+
9298
@Parameter(name = ApiConstants.LIST_VM_DETAILS,
9399
type = CommandType.BOOLEAN,
94100
since = "4.21.0",
@@ -119,6 +125,10 @@ public Long getZoneId() {
119125
return zoneId;
120126
}
121127

128+
public String getBackupStatus() {
129+
return backupStatus;
130+
}
131+
122132
public Boolean getListVmDetails() {
123133
return listVmDetails;
124134
}

‎server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import javax.naming.ConfigurationException;
4040

4141
import com.cloud.utils.DomainHelper;
42+
import com.cloud.utils.EnumUtils;
4243
import org.apache.cloudstack.api.ApiCommandResourceType;
4344
import org.apache.cloudstack.api.ApiConstants;
4445
import org.apache.cloudstack.api.InternalIdentity;
@@ -256,6 +257,8 @@ public class BackupManagerImpl extends ManagerBase implements BackupManager {
256257
private static Map<String, BackupProvider> backupProvidersMap = new HashMap<>();
257258
private List<BackupProvider> backupProviders;
258259

260+
private static final List<Backup.Status> INVALID_BACKUP_STATUS = List.of(Backup.Status.Expunged, Backup.Status.Removed);
261+
259262
public AsyncJobDispatcher getAsyncJobDispatcher() {
260263
return asyncJobDispatcher;
261264
}
@@ -1089,13 +1092,28 @@ protected void deleteExcessBackups(List<BackupVO> backups, int amountOfBackupsTo
10891092
}
10901093
}
10911094

1095+
private Backup.Status validateBackupStatus(final String backupStatus) {
1096+
if (backupStatus == null) {
1097+
return null;
1098+
}
1099+
1100+
Backup.Status status = EnumUtils.getEnumIgnoreCase(Backup.Status.class, backupStatus);
1101+
if (status == null || INVALID_BACKUP_STATUS.contains(status)) {
1102+
throw new InvalidParameterValueException(String.format("Invalid backup status: %s. Valid values are: " +
1103+
"Allocated, Queued, BackingUp, BackedUp, Error, Failed, Restoring.", backupStatus));
1104+
}
1105+
1106+
return status;
1107+
}
1108+
10921109
@Override
10931110
public Pair<List<Backup>, Integer> listBackups(final ListBackupsCmd cmd) {
10941111
final Long id = cmd.getId();
10951112
final Long vmId = cmd.getVmId();
10961113
final String name = cmd.getName();
10971114
final Long zoneId = cmd.getZoneId();
10981115
final Long backupOfferingId = cmd.getBackupOfferingId();
1116+
final Backup.Status backupStatus = validateBackupStatus(cmd.getBackupStatus());
10991117
final Account caller = CallContext.current().getCallingAccount();
11001118
final String keyword = cmd.getKeyword();
11011119
List<Long> permittedAccounts = new ArrayList<Long>();
@@ -1124,6 +1142,7 @@ public Pair<List<Backup>, Integer> listBackups(final ListBackupsCmd cmd) {
11241142
sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ);
11251143
sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
11261144
sb.and("backupOfferingId", sb.entity().getBackupOfferingId(), SearchCriteria.Op.EQ);
1145+
sb.and("backupStatus", sb.entity().getStatus(), SearchCriteria.Op.EQ);
11271146

11281147
if (keyword != null) {
11291148
sb.and().op("keywordName", sb.entity().getName(), SearchCriteria.Op.LIKE);
@@ -1156,6 +1175,8 @@ public Pair<List<Backup>, Integer> listBackups(final ListBackupsCmd cmd) {
11561175
sc.setParameters("backupOfferingId", backupOfferingId);
11571176
}
11581177

1178+
sc.setParametersIfNotNull("backupStatus", backupStatus);
1179+
11591180
if (keyword != null) {
11601181
String keywordMatch = "%" + keyword + "%";
11611182
sc.setParameters("keywordName", keywordMatch);

‎ui/public/locales/en.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,8 @@
460460
"label.back.login": "Back to login",
461461
"label.backup": "Backup",
462462
"label.backups": "Backups",
463+
"label.backedup": "BackedUp",
464+
"label.backingup": "BackingUp",
463465
"label.backup.attach.restore": "Restore and attach backup volume",
464466
"label.backup.configure.schedule": "Configure Backup Schedule",
465467
"label.backup.offering.assign": "Assign Instance to backup offering",
@@ -2014,6 +2016,7 @@
20142016
"label.purge.usage.records.error": "Failed while purging usage records",
20152017
"label.purpose": "Purpose",
20162018
"label.qostype": "QoS type",
2019+
"label.queued": "Queued",
20172020
"label.quickview": "Quick view",
20182021
"label.quiescevm": "Quiesce Instance",
20192022
"label.quiettime": "Quiet time (in sec)",
@@ -2170,6 +2173,7 @@
21702173
"label.restartrequired": "Restart required",
21712174
"label.restore": "Restore",
21722175
"label.restore.volume.attach": "Restore volume and attach",
2176+
"label.restoring": "Restoring",
21732177
"label.use.backup.ip.address": "Use IP Addresses from Backup",
21742178
"label.use.backup.ip.address.tooltip": "Use the same IP/MAC addresses as stored in the backup metadata. The command will error out if the IP/MAC addresses are not available",
21752179
"label.review": "Review",

‎ui/public/locales/pt_BR.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@
428428
"label.backup": "Backup",
429429
"label.backups": "Backups",
430430
"label.back.login": "Voltar à página de login",
431-
"label.backup": "Backups",
431+
"label.backedup": "Salvo",
432+
"label.backingup": "Salvando",
432433
"label.backup.attach.restore": "Restaurar e anexar volume de backup",
433434
"label.backuplimit": "Limite de backups",
434435
"label.backup.storage": "Armazenamento de backup",
@@ -1814,6 +1815,7 @@
18141815
"label.purgeresources": "Limpar Recursos",
18151816
"label.purpose": "Prop\u00f3sito",
18161817
"label.qostype": "Tipo de QoS",
1818+
"label.queued": "Enfileirado",
18171819
"label.quickview": "Visualiza\u00e7\u00e3o r\u00e1pida",
18181820
"label.quiescevm": "Quiesce VM",
18191821
"label.quiettime": "Tempo em espera (em seg)",
@@ -1967,6 +1969,7 @@
19671969
"label.restartrequired": "Reiniciar obrigat\u00f3rio",
19681970
"label.restore": "Restaurar",
19691971
"label.restore.volume.attach": "Restaurar volume e anex\u00e1-lo",
1972+
"label.restoring": "Restaurando",
19701973
"label.review": "Revisar",
19711974
"label.role": "Fun\u00e7\u00e3o",
19721975
"label.roleid": "Fun\u00e7\u00e3o",

‎ui/src/components/view/SearchView.vue‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export default {
325325
'type', 'scope', 'managementserverid', 'serviceofferingid',
326326
'diskofferingid', 'networkid', 'usagetype', 'restartrequired', 'gpuenabled',
327327
'displaynetwork', 'guestiptype', 'usersource', 'arch', 'oscategoryid', 'templatetype', 'gpucardid', 'vgpuprofileid',
328-
'extensionid', 'backupoffering', 'volumeid', 'virtualmachineid'].includes(item)
328+
'extensionid', 'backupoffering', 'volumeid', 'virtualmachineid', 'status'].includes(item)
329329
) {
330330
type = 'list'
331331
} else if (item === 'tags') {
@@ -516,6 +516,7 @@ export default {
516516
let gpuCardIndex = -1
517517
let vgpuProfileIndex = -1
518518
let extensionIndex = -1
519+
let backupStatusIndex = -1
519520
520521
if (arrayField.includes('type')) {
521522
if (this.$route.path === '/alert') {
@@ -661,6 +662,11 @@ export default {
661662
promises.push(await this.fetchVolumes(searchKeyword))
662663
}
663664
665+
if (arrayField.includes('status')) {
666+
backupStatusIndex = this.fields.findIndex(item => item.name === 'status')
667+
this.fields[backupStatusIndex].opts = this.fetchAvailableBackupStatus()
668+
}
669+
664670
Promise.all(promises).then(response => {
665671
if (typeIndex > -1) {
666672
const types = response.filter(item => item.type === 'type')
@@ -1590,6 +1596,38 @@ export default {
15901596
})
15911597
})
15921598
},
1599+
fetchAvailableBackupStatus () {
1600+
return [
1601+
{
1602+
id: 'Allocated',
1603+
name: 'label.allocated'
1604+
},
1605+
{
1606+
id: 'Queued',
1607+
name: 'label.queued'
1608+
},
1609+
{
1610+
id: 'BackingUp',
1611+
name: 'label.backingup'
1612+
},
1613+
{
1614+
id: 'BackedUp',
1615+
name: 'label.backedup'
1616+
},
1617+
{
1618+
id: 'Error',
1619+
name: 'label.error'
1620+
},
1621+
{
1622+
id: 'Failed',
1623+
name: 'label.failed'
1624+
},
1625+
{
1626+
id: 'Restoring',
1627+
name: 'label.restoring'
1628+
}
1629+
]
1630+
},
15931631
onSearch (value) {
15941632
this.paramsFilter = {}
15951633
this.searchQuery = value

‎ui/src/components/widgets/Status.vue‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,24 @@ export default {
106106
case 'no':
107107
state = this.$t('label.no')
108108
break
109+
case 'backedup':
110+
state = this.$t('label.backedup')
111+
break
112+
case 'backingup':
113+
state = this.$t('label.backingup')
114+
break
115+
case 'allocated':
116+
state = this.$t('label.allocated')
117+
break
118+
case 'qeued':
119+
state = this.$t('label.queued')
120+
break
121+
case 'restoring':
122+
state = this.$t('label.restoring')
123+
break
124+
case 'failed':
125+
state = this.$t('label.failed')
126+
break
109127
}
110128
return state.charAt(0).toUpperCase() + state.slice(1)
111129
}

‎ui/src/config/section/storage.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ export default {
476476
columns: ['name', 'status', 'size', 'virtualsize', 'virtualmachinename', 'backupofferingname', 'intervaltype', 'type', 'created', 'account', 'domain', 'zone'],
477477
details: ['name', 'description', 'virtualmachinename', 'id', 'intervaltype', 'type', 'externalid', 'size', 'virtualsize', 'volumes', 'backupofferingname', 'zone', 'account', 'domain', 'created'],
478478
searchFilters: () => {
479-
var filters = ['name', 'zoneid', 'domainid', 'account', 'backupofferingid']
479+
var filters = ['name', 'zoneid', 'domainid', 'account', 'backupofferingid', 'status']
480480
return filters
481481
},
482482
tabs: [

0 commit comments

Comments
 (0)