This is an automated email from the ASF dual-hosted git repository. harikrishna pushed a commit to branch CheckVolumeAPI in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit d80782b145b106dee35d42ab0ccdf1e2ab38b6be Author: Harikrishna Patnala <[email protected]> AuthorDate: Mon Feb 5 13:54:26 2024 +0530 Changed the API to Async and the setting scope to storage pool --- .../api/command/user/volume/CheckAndRepairVolumeCmd.java | 15 +++++++++++++-- .../main/java/com/cloud/storage/VolumeApiServiceImpl.java | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java index ce1559c4342..9c0d1a1058a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; +import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.ServerApiException; @@ -41,7 +42,7 @@ import java.util.Arrays; @APICommand(name = "checkVolume", description = "Check the volume for any errors or leaks and also repairs when repair parameter is passed, this is currently supported for KVM only", responseObject = VolumeResponse.class, entityType = {Volume.class}, since = "4.19.1", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) -public class CheckAndRepairVolumeCmd extends BaseCmd { +public class CheckAndRepairVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CheckAndRepairVolumeCmd.class.getName()); private static final String s_name = "checkandrepairvolumeresponse"; @@ -98,6 +99,16 @@ public class CheckAndRepairVolumeCmd extends BaseCmd { return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked } + @Override + public String getEventType() { + return EventTypes.EVENT_VOLUME_CHECK; + } + + @Override + public String getEventDescription() { + return String.format("check and repair operation on volume: %s", this._uuidMgr.getUuid(Volume.class, getId())); + } + @Override public Long getApiResourceId() { return id; diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java index 0daa82a4bf2..c8b39d180f2 100644 --- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java @@ -382,7 +382,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic + " in milliseconds, to execute a storage tag rule; if it is reached, a timeout will happen.", true); public static final ConfigKey<Boolean> AllowCheckAndRepairVolume = new ConfigKey<Boolean>("Advanced", Boolean.class, "volume.check.and.repair.leaks.before.use", "false", - "To check and repair the volume if it has any leaks before performing volume attach or VM start operations", true); + "To check and repair the volume if it has any leaks before performing volume attach or VM start operations", true, ConfigKey.Scope.StoragePool); private final StateMachine2<Volume.State, Volume.Event, Volume> _volStateMachine;
