mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4744: Enhance root admin API updateVolume with chaininfo parameter as a part of "Better control over first party objects" feature.
This commit is contained in:
parent
c93b0967ef
commit
c171e2c3e4
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ public class VolumeJoinDaoImpl extends GenericDaoBase<VolumeJoinVO, Long> implem
|
|||
|
||||
volResponse.setExtractable(isExtractable);
|
||||
volResponse.setDisplayVolume(volume.isDisplayVolume());
|
||||
volResponse.setChainInfo(volume.getChainInfo());
|
||||
|
||||
// set async job
|
||||
if (volume.getJobId() != null) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue