Skip to content

Commit 1706f9e

Browse files
Merge branch 'ablestack-diplo' into usb_lun_mdev-devices
2 parents b78ed84 + 74d2037 commit 1706f9e

File tree

121 files changed

+6528
-33096
lines changed

Some content is hidden

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

121 files changed

+6528
-33096
lines changed

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/VolumeApiService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public interface VolumeApiService {
117117
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds)
118118
throws ResourceAllocationException;
119119

120+
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds, boolean backup)
121+
throws ResourceAllocationException;
122+
120123
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds) throws ResourceAllocationException;
121124

122125
Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, Boolean deleteProtection, String customId, long owner, String chainInfo, String name, String type);

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class ApiConstants {
5151
public static final String AVAILABLE = "available";
5252
public static final String AVAILABLE_SUBNETS = "availablesubnets";
5353
public static final String AVAILABLE_VIRTUAL_MACHINE_COUNT = "availablevirtualmachinecount";
54+
public static final String BACKUP = "backup";
5455
public static final String BACKUP_ID = "backupid";
5556
public static final String BACKUP_OFFERING_NAME = "backupofferingname";
5657
public static final String BACKUP_OFFERING_ID = "backupofferingid";
@@ -836,6 +837,7 @@ public class ApiConstants {
836837
public static final String DEST_NETWORK_UUID = "destnetworkuuid";
837838
public static final String LOGICAL_ROUTER_UUID = "logicalrouteruuid";
838839
public static final String RETRY = "retry";
840+
public static final String RETENTION_PERIOD = "retentionperiod";
839841
public static final String HTTP_METHOD = "httpmethodtype";
840842
public static final String EXPECTED_CODE = "expectedcode";
841843
public static final String URL_PATH = "urlpath";
@@ -1309,8 +1311,10 @@ public class ApiConstants {
13091311
public static final String ISSUED_DATE = "issueddate";
13101312
public static final String XML_CONFIG = "xmlconfig";
13111313
public static final String CURRENT_VM_ID = "currentvmid";
1312-
13131314
public static final String RESULT_REDFISH_DATA = "redfishdata";
1315+
public static final String EXTERNAL_ENTITY = "externalEntity";
1316+
public static final String MIGRATION_IP = "migrationip";
1317+
public static final String VM_SNAPSHOT_NONCOPY = "noncopy";
13141318

13151319
public static final String PARENT_HB_NAME = "parenthbaname";
13161320
public static final String WWNN = "wwnn";

api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public class ImportBackupOfferingCmd extends BaseAsyncCmd {
6262
description = "the description of the backup offering")
6363
private String description;
6464

65+
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = true,
66+
description = "The backup provider name")
67+
private String provider;
68+
6569
@Parameter(name = ApiConstants.EXTERNAL_ID,
6670
type = CommandType.STRING,
6771
required = true,
@@ -76,6 +80,10 @@ public class ImportBackupOfferingCmd extends BaseAsyncCmd {
7680
description = "Whether users are allowed to create adhoc backups and backup schedules", required = true)
7781
private Boolean userDrivenBackups;
7882

83+
@Parameter(name = ApiConstants.RETENTION_PERIOD, type = CommandType.STRING, required = false,
84+
description = "Retention period of backup data")
85+
private String retentionPeriod;
86+
7987
/////////////////////////////////////////////////////
8088
/////////////////// Accessors ///////////////////////
8189
/////////////////////////////////////////////////////
@@ -84,6 +92,10 @@ public String getName() {
8492
return name;
8593
}
8694

95+
public String getProvider() {
96+
return provider;
97+
}
98+
8799
public String getExternalId() {
88100
return externalId;
89101
}
@@ -100,6 +112,10 @@ public Boolean getUserDrivenBackups() {
100112
return userDrivenBackups == null ? false : userDrivenBackups;
101113
}
102114

115+
public String getRetentionPeriod() {
116+
return retentionPeriod;
117+
}
118+
103119
/////////////////////////////////////////////////////
104120
/////////////// API Implementation///////////////////
105121
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ListBackupProviderOfferingsCmd.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public class ListBackupProviderOfferingsCmd extends BaseBackupListCmd {
5555
required = true, description = "The zone ID")
5656
private Long zoneId;
5757

58+
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = true,
59+
description = "The backup provider name")
60+
private String provider;
61+
5862
/////////////////////////////////////////////////////
5963
/////////////////// Accessors ///////////////////////
6064
/////////////////////////////////////////////////////
@@ -63,6 +67,10 @@ public Long getZoneId() {
6367
return zoneId;
6468
}
6569

70+
public String getProvider() {
71+
return provider;
72+
}
73+
6674
/////////////////////////////////////////////////////
6775
/////////////// API Implementation///////////////////
6876
/////////////////////////////////////////////////////
@@ -77,7 +85,7 @@ private void validateParameters() {
7785
public void execute() throws ResourceUnavailableException, ServerApiException, ConcurrentOperationException {
7886
validateParameters();
7987
try {
80-
final List<BackupOffering> backupOfferings = backupManager.listBackupProviderOfferings(getZoneId());
88+
final List<BackupOffering> backupOfferings = backupManager.listBackupProviderOfferings(getZoneId(), getProvider());
8189
setupResponseBackupOfferingsList(backupOfferings, backupOfferings.size());
8290
} catch (InvalidParameterValueException e) {
8391
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.command.admin.backup;
18+
19+
import java.util.ArrayList;
20+
import java.util.List;
21+
22+
import javax.inject.Inject;
23+
24+
import org.apache.cloudstack.acl.RoleType;
25+
import org.apache.cloudstack.api.APICommand;
26+
import org.apache.cloudstack.api.ApiConstants;
27+
import org.apache.cloudstack.api.BaseCmd;
28+
import org.apache.cloudstack.api.Parameter;
29+
import org.apache.cloudstack.api.response.BackupProviderResponse;
30+
import org.apache.cloudstack.api.response.ListResponse;
31+
import org.apache.cloudstack.api.response.ZoneResponse;
32+
import org.apache.cloudstack.backup.BackupManager;
33+
import org.apache.cloudstack.backup.BackupProvider;
34+
35+
import com.cloud.user.Account;
36+
37+
@APICommand(name = "listBackupProvidersForZone",
38+
description = "Lists Backup and Recovery providers for zone",
39+
responseObject = BackupProviderResponse.class, since = "4.14.0",
40+
authorized = {RoleType.Admin})
41+
public class ListBackupProvidersForZoneCmd extends BaseCmd {
42+
43+
@Inject
44+
private BackupManager backupManager;
45+
46+
/////////////////////////////////////////////////////
47+
//////////////// API parameters /////////////////////
48+
/////////////////////////////////////////////////////
49+
50+
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the zone ID")
51+
private Long zoneId;
52+
53+
/////////////////////////////////////////////////////
54+
/////////////////// Accessors ///////////////////////
55+
/////////////////////////////////////////////////////
56+
57+
public Long getZoneId() {
58+
return zoneId;
59+
}
60+
61+
@Override
62+
public long getEntityOwnerId() {
63+
return Account.ACCOUNT_ID_SYSTEM;
64+
}
65+
66+
/////////////////////////////////////////////////////
67+
/////////////// API Implementation///////////////////
68+
/////////////////////////////////////////////////////
69+
70+
private void setupResponse(final List<BackupProvider> providers) {
71+
final ListResponse<BackupProviderResponse> response = new ListResponse<>();
72+
final List<BackupProviderResponse> responses = new ArrayList<>();
73+
for (final BackupProvider provider : providers) {
74+
if (provider == null) {
75+
continue;
76+
}
77+
final BackupProviderResponse backupProviderResponse = new BackupProviderResponse();
78+
backupProviderResponse.setName(provider.getName());
79+
backupProviderResponse.setDescription(provider.getDescription());
80+
backupProviderResponse.setObjectName("providers");
81+
responses.add(backupProviderResponse);
82+
}
83+
response.setResponses(responses);
84+
response.setResponseName(getCommandName());
85+
setResponseObject(response);
86+
}
87+
88+
@Override
89+
public void execute() {
90+
List<BackupProvider> providers = backupManager.listBackupProvidersForZone(getZoneId());
91+
setupResponse(providers);
92+
}
93+
}

api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public class UpdateBackupOfferingCmd extends BaseCmd {
5757
@Parameter(name = ApiConstants.ALLOW_USER_DRIVEN_BACKUPS, type = CommandType.BOOLEAN, description = "Whether to allow user driven backups or not")
5858
private Boolean allowUserDrivenBackups;
5959

60+
@Parameter(name = ApiConstants.RETENTION_PERIOD, type = CommandType.STRING, required = false, description = "Retention period of backup data")
61+
private String retentionPeriod;
62+
6063
/////////////////////////////////////////////////////
6164
/////////////////// Accessors ///////////////////////
6265
/////////////////////////////////////////////////////
@@ -76,6 +79,10 @@ public Boolean getAllowUserDrivenBackups() {
7679
return allowUserDrivenBackups;
7780
}
7881

82+
public String getRetentionPeriod() {
83+
return retentionPeriod;
84+
}
85+
7986
/////////////////////////////////////////////////////
8087
/////////////// API Implementation///////////////////
8188
/////////////////////////////////////////////////////
@@ -91,7 +98,7 @@ public void execute() {
9198

9299
if (result == null) {
93100
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to update backup offering %s.",
94-
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "name", "description", "allowUserDrivenBackups")));
101+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "name", "description", "allowUserDrivenBackups", "retentionPeriod")));
95102
}
96103
BackupOfferingResponse response = _responseGenerator.createBackupOfferingResponse(result);
97104
response.setResponseName(getCommandName());

api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public class UpdateHostCmd extends BaseCmd {
6767
@Parameter(name = ApiConstants.ANNOTATION, type = CommandType.STRING, description = "Add an annotation to this host", since = "4.11", authorized = {RoleType.Admin})
6868
private String annotation;
6969

70+
@Parameter(name = ApiConstants.MIGRATION_IP, type = CommandType.STRING, description = "Add an migration ip to this host", since = "4.20")
71+
private String migrationIp;
72+
7073
/////////////////////////////////////////////////////
7174
/////////////////// Accessors ///////////////////////
7275
/////////////////////////////////////////////////////
@@ -103,6 +106,10 @@ public String getAnnotation() {
103106
return annotation;
104107
}
105108

109+
public String getMigrationIp() {
110+
return migrationIp;
111+
}
112+
106113
/////////////////////////////////////////////////////
107114
/////////////// API Implementation///////////////////
108115
/////////////////////////////////////////////////////

0 commit comments

Comments
 (0)