diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/com/cloud/storage/VolumeApiService.java index 09ac3ee2cbb..310f69ebd41 100644 --- a/api/src/com/cloud/storage/VolumeApiService.java +++ b/api/src/com/cloud/storage/VolumeApiService.java @@ -82,7 +82,7 @@ public interface VolumeApiService { Snapshot allocSnapshot(Long volumeId, Long policyId) throws ResourceAllocationException; - Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner); + Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner, String chainInfo); /** * Extracts the volume to a particular location. diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java index 3b9b19c7b5f..3699102af37 100755 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -41,6 +41,7 @@ public class ApiConstants { public static final String PRIVATE_KEY = "privatekey"; public static final String DOMAIN_SUFFIX = "domainsuffix"; public static final String DNS_SEARCH_ORDER = "dnssearchorder"; + public static final String CHAIN_INFO = "chaininfo"; public static final String CIDR = "cidr"; public static final String IP6_CIDR = "ip6cidr"; public static final String CIDR_LIST = "cidrlist"; diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java index 65d2849632b..78d402b31d5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java @@ -47,6 +47,9 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.PATH, type = CommandType.STRING, description = "The path of the volume") private String path; + @Parameter(name = ApiConstants.CHAIN_INFO, type = CommandType.STRING, description = "The chain info of the volume") + private String chainInfo; + @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, @@ -86,7 +89,10 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { return displayVolume; } -///////////////////////////////////////////////////// + public String getChainInfo() { + return chainInfo; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -139,7 +145,8 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + getId()); - Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), getCustomId(), getEntityOwnerId()); + Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), + getCustomId(), getEntityOwnerId(), getChainInfo()); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(result); response.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java index daf53500eda..4cba2a1408e 100644 --- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java @@ -193,13 +193,17 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity private Boolean displayVolume; @SerializedName(ApiConstants.PATH) - @Param(description = "The path of the volume") + @Param(description = "the path of the volume") private String path; @SerializedName(ApiConstants.STORAGE_ID) @Param(description = "id of the primary storage hosting the disk volume; returned to admin user only", since = "4.3") private String storagePoolId; + @SerializedName(ApiConstants.CHAIN_INFO) + @Param(description = "the chain info of the volume", since = "4.4") + String chainInfo; + public String getPath() { return path; } @@ -417,4 +421,12 @@ public class VolumeResponse extends BaseResponse implements ControlledViewEntity public void setStoragePoolId(String storagePoolId) { this.storagePoolId = storagePoolId; } + + public String getChainInfo() { + return chainInfo; + } + + public void setChainInfo(String chainInfo) { + this.chainInfo = chainInfo; + } } diff --git a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java index 5fa27dc6572..0c5693542d6 100644 --- a/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java @@ -209,6 +209,7 @@ public class VolumeJoinDaoImpl extends GenericDaoBase implem volResponse.setExtractable(isExtractable); volResponse.setDisplayVolume(volume.isDisplayVolume()); + volResponse.setChainInfo(volume.getChainInfo()); // set async job if (volume.getJobId() != null) { diff --git a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java index f288c2fd649..1d1b37da1af 100644 --- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java +++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java @@ -264,6 +264,9 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name = "path") protected String path; + @Column(name = "chain_info", length = 65535) + String chainInfo; + public VolumeJoinVO() { } @@ -567,4 +570,7 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { return path; } + public String getChainInfo() { + return chainInfo; + } } diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index 252d9252cda..614834ea299 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -1205,7 +1205,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic @Override @ActionEvent(eventType = EventTypes.EVENT_VOLUME_UPDATE, eventDescription = "updating volume", async = true) - public Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long entityOwnerId) { + public Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long entityOwnerId, String chainInfo) { VolumeVO volume = _volumeDao.findById(volumeId); @@ -1217,6 +1217,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic volume.setDisplayVolume(displayVolume); } + if(chainInfo != null){ + volume.setChainInfo(chainInfo); + } + if (state != null) { try { Volume.State volumeState = Volume.State.valueOf(state); diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql index d1d0d0644db..a98df26ff04 100644 --- a/setup/db/db/schema-430to440.sql +++ b/setup/db/db/schema-430to440.sql @@ -122,9 +122,10 @@ CREATE VIEW `cloud`.`volume_view` AS volumes.attached, volumes.removed, volumes.pod_id, - volumes.display_volume, + volumes.display_volume, volumes.format, - volumes.path, + volumes.path, + volumes.chain_info, account.id account_id, account.uuid account_uuid, account.account_name account_name,