Skip to content

Commit 050ee44

Browse files
committed
Merge branch '4.18' into 4.19
2 parents 6c7426e + 7c5b7ca commit 050ee44

File tree

16 files changed

+265
-154
lines changed

16 files changed

+265
-154
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
3030
import org.apache.cloudstack.api.command.admin.storage.SyncStoragePoolCmd;
3131
import org.apache.cloudstack.api.command.admin.storage.UpdateObjectStoragePoolCmd;
32+
import org.apache.cloudstack.api.command.admin.storage.UpdateImageStoreCmd;
3233
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
3334

3435
import com.cloud.exception.DiscoveryException;
@@ -110,6 +111,8 @@ public interface StorageService {
110111
*/
111112
ImageStore migrateToObjectStore(String name, String url, String providerName, Map<String, String> details) throws DiscoveryException;
112113

114+
ImageStore updateImageStore(UpdateImageStoreCmd cmd);
115+
113116
ImageStore updateImageStoreStatus(Long id, Boolean readonly);
114117

115118
void updateStorageCapabilities(Long poolId, boolean failOnChecks);

api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateImageStoreCmd.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ public class UpdateImageStoreCmd extends BaseCmd {
4141
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, required = true, description = "Image Store UUID")
4242
private Long id;
4343

44-
@Parameter(name = ApiConstants.READ_ONLY, type = CommandType.BOOLEAN, required = true, description = "If set to true, it designates the corresponding image store to read-only, " +
45-
"hence not considering them during storage migration")
44+
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = false, description = "The new name for the Image Store.")
45+
private String name;
46+
47+
@Parameter(name = ApiConstants.READ_ONLY, type = CommandType.BOOLEAN, required = false,
48+
description = "If set to true, it designates the corresponding image store to read-only, hence not considering them during storage migration")
4649
private Boolean readonly;
4750

51+
@Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, required = false,
52+
description = "The number of bytes CloudStack can use on this image storage.\n\tNOTE: this will be overwritten by the StatsCollector as soon as there is a SSVM to query the storage.")
53+
private Long capacityBytes;
54+
4855
/////////////////////////////////////////////////////
4956
/////////////////// Accessors ///////////////////////
5057
/////////////////////////////////////////////////////
@@ -53,17 +60,25 @@ public Long getId() {
5360
return id;
5461
}
5562

63+
public String getName() {
64+
return name;
65+
}
66+
5667
public Boolean getReadonly() {
5768
return readonly;
5869
}
5970

71+
public Long getCapacityBytes() {
72+
return capacityBytes;
73+
}
74+
6075
/////////////////////////////////////////////////////
6176
/////////////// API Implementation///////////////////
6277
/////////////////////////////////////////////////////
6378

6479
@Override
6580
public void execute() {
66-
ImageStore result = _storageService.updateImageStoreStatus(getId(), getReadonly());
81+
ImageStore result = _storageService.updateImageStore(this);
6782
ImageStoreResponse storeResponse = null;
6883
if (result != null) {
6984
storeResponse = _responseGenerator.createImageStoreResponse(result);

api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,39 @@
2727

2828
@EntityReference(value = ImageStore.class)
2929
public class ImageStoreResponse extends BaseResponseWithAnnotations {
30-
@SerializedName("id")
30+
@SerializedName(ApiConstants.ID)
3131
@Param(description = "the ID of the image store")
3232
private String id;
3333

34-
@SerializedName("zoneid")
34+
@SerializedName(ApiConstants.ZONE_ID)
3535
@Param(description = "the Zone ID of the image store")
3636
private String zoneId;
3737

3838
@SerializedName(ApiConstants.ZONE_NAME)
3939
@Param(description = "the Zone name of the image store")
4040
private String zoneName;
4141

42-
@SerializedName("name")
42+
@SerializedName(ApiConstants.NAME)
4343
@Param(description = "the name of the image store")
4444
private String name;
4545

46-
@SerializedName("url")
46+
@SerializedName(ApiConstants.URL)
4747
@Param(description = "the url of the image store")
4848
private String url;
4949

50-
@SerializedName("protocol")
50+
@SerializedName(ApiConstants.PROTOCOL)
5151
@Param(description = "the protocol of the image store")
5252
private String protocol;
5353

5454
@SerializedName("providername")
5555
@Param(description = "the provider name of the image store")
5656
private String providerName;
5757

58-
@SerializedName("scope")
58+
@SerializedName(ApiConstants.SCOPE)
5959
@Param(description = "the scope of the image store")
6060
private ScopeType scope;
6161

62-
@SerializedName("readonly")
62+
@SerializedName(ApiConstants.READ_ONLY)
6363
@Param(description = "defines if store is read-only")
6464
private Boolean readonly;
6565

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ static Boolean getFullCloneConfiguration(Long storeId) {
361361

362362
Long getDiskIopsWriteRate(ServiceOffering offering, DiskOffering diskOffering);
363363

364+
ImageStore updateImageStoreStatus(Long id, String name, Boolean readonly, Long capacityBytes);
365+
364366
void cleanupDownloadUrls();
365367

366368
void setDiskProfileThrottling(DiskProfile dskCh, ServiceOffering offering, DiskOffering diskOffering);

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3126,7 +3126,7 @@ private Pair<List<HostTagVO>, Integer> searchForHostTagsInternal(ListHostTagsCmd
31263126
@Override
31273127
public ListResponse<ImageStoreResponse> searchForImageStores(ListImageStoresCmd cmd) {
31283128
Pair<List<ImageStoreJoinVO>, Integer> result = searchForImageStoresInternal(cmd);
3129-
ListResponse<ImageStoreResponse> response = new ListResponse<ImageStoreResponse>();
3129+
ListResponse<ImageStoreResponse> response = new ListResponse<>();
31303130

31313131
List<ImageStoreResponse> poolResponses = ViewResponseHelper.createImageStoreResponse(result.first().toArray(new ImageStoreJoinVO[result.first().size()]));
31323132
response.setResponses(poolResponses, result.second());

0 commit comments

Comments
 (0)