Gilad Chaplik has uploaded a new change for review. Change subject: core: Add CRUD commands and queries for QoS objects (storage) ......................................................................
core: Add CRUD commands and queries for QoS objects (storage) For more information see: http://www.ovirt.org/Features/aggregate_QoS, http://www.ovirt.org/Features/blkio-support Change-Id: I1a9af59277b5055453159f002f19046c00522ddb Signed-off-by: Gilad Chaplik <gchap...@redhat.com> --- A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllQosByStoragePoolIdAndTypeQuery.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetQosByIdQuery.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddQosCommand.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddStorageQosCommand.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/QosCommandBase.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveQosCommandBase.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveStorageQosCommand.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateQosCommandBase.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateStorageQosCommand.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/QosValidator.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageQosValidator.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/QosParametersBase.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/QosQueryParameterBase.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 22 files changed, 604 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/05/31805/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllQosByStoragePoolIdAndTypeQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllQosByStoragePoolIdAndTypeQuery.java new file mode 100644 index 0000000..ce42696 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllQosByStoragePoolIdAndTypeQuery.java @@ -0,0 +1,16 @@ +package org.ovirt.engine.core.bll; + +import org.ovirt.engine.core.common.queries.QosQueryParameterBase; + +public class GetAllQosByStoragePoolIdAndTypeQuery extends QosQueryBase { + + public GetAllQosByStoragePoolIdAndTypeQuery(QosQueryParameterBase parameters) { + super(parameters); + } + + @Override + protected void executeQueryCommand() { + getQueryReturnValue().setReturnValue(getQosDao().getAllForStoragePoolId(getParameters().getId())); + } + +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetQosByIdQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetQosByIdQuery.java new file mode 100644 index 0000000..7457ffd --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetQosByIdQuery.java @@ -0,0 +1,16 @@ +package org.ovirt.engine.core.bll; + +import org.ovirt.engine.core.common.queries.IdQueryParameters; + +public class GetQosByIdQuery extends QueriesCommandBase<IdQueryParameters> { + + public GetQosByIdQuery(IdQueryParameters parameters) { + super(parameters); + } + + @Override + protected void executeQueryCommand() { + getQueryReturnValue().setReturnValue(getDbFacade().getStorageQosDao().get(getParameters().getId())); + } + +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java new file mode 100644 index 0000000..0f3ee1c --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java @@ -0,0 +1,32 @@ +package org.ovirt.engine.core.bll; + + +import org.ovirt.engine.core.common.businessentities.qos.QosType; +import org.ovirt.engine.core.common.queries.QosQueryParameterBase; +import org.ovirt.engine.core.dao.qos.QosDao; + + +public abstract class QosQueryBase extends QueriesCommandBase<QosQueryParameterBase> { + private QosDao<?> qosDao; + + public QosQueryBase(QosQueryParameterBase parameters) { + super(parameters); + } + + protected QosDao<?> getQosDao() { + QosType qosType = getParameters().getQosType(); + if (qosType == null) { + qosType = QosType.STORAGE; + } + switch (qosType) { + case STORAGE: + qosDao = getDbFacade().getStorageQosDao(); + break; + + default: + break; + } + return qosDao; + } + +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddQosCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddQosCommand.java new file mode 100644 index 0000000..0e26292 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddQosCommand.java @@ -0,0 +1,41 @@ +package org.ovirt.engine.core.bll.qos; + + +import org.ovirt.engine.core.bll.validator.QosValidator; +import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.action.QosParametersBase; +import org.ovirt.engine.core.common.businessentities.qos.QosBase; +import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.compat.Guid; + +public abstract class AddQosCommand<T extends QosBase, M extends QosValidator<T>> extends QosCommandBase<T, M> { + + public AddQosCommand(QosParametersBase<T> parameters) { + super(parameters); + } + + @Override + protected boolean canDoAction() { + return super.canDoAction() && validate(getQosValidator(getQos()).nameNotTakenInDc()); + } + + @Override + protected void executeCommand() { + getQos().setId(Guid.newGuid()); + getQosDao().save(getQos()); + getReturnValue().setActionReturnValue(getQos().getId()); + setSucceeded(true); + } + + @Override + public AuditLogType getAuditLogTypeValue() { + return getSucceeded() ? AuditLogType.USER_ADDED_QOS : AuditLogType.USER_FAILED_TO_ADD_QOS; + } + + @Override + protected void setActionMessageParameters() { + super.setActionMessageParameters(); + addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); + } + +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddStorageQosCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddStorageQosCommand.java new file mode 100644 index 0000000..8fb9d73 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/AddStorageQosCommand.java @@ -0,0 +1,25 @@ +package org.ovirt.engine.core.bll.qos; + +import org.ovirt.engine.core.bll.validator.QosValidator; +import org.ovirt.engine.core.bll.validator.StorageQosValidator; +import org.ovirt.engine.core.common.action.QosParametersBase; +import org.ovirt.engine.core.common.businessentities.qos.StorageQos; +import org.ovirt.engine.core.dao.qos.QosDao; + +public class AddStorageQosCommand extends AddQosCommand<StorageQos, QosValidator<StorageQos>> { + + public AddStorageQosCommand(QosParametersBase<StorageQos> parameters) { + super(parameters); + } + + @Override + protected QosDao<StorageQos> getQosDao() { + return getDbFacade().getStorageQosDao(); + } + + @Override + protected QosValidator<StorageQos> getQosValidator(StorageQos qos) { + return new StorageQosValidator(qos); + } + +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/QosCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/QosCommandBase.java new file mode 100644 index 0000000..ec768f6 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/QosCommandBase.java @@ -0,0 +1,92 @@ +package org.ovirt.engine.core.bll.qos; + +import java.util.Collections; +import java.util.List; + +import org.ovirt.engine.core.bll.CommandBase; +import org.ovirt.engine.core.bll.utils.PermissionSubject; +import org.ovirt.engine.core.bll.validator.QosValidator; +import org.ovirt.engine.core.common.VdcObjectType; +import org.ovirt.engine.core.common.action.QosParametersBase; +import org.ovirt.engine.core.common.businessentities.qos.QosBase; +import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.dao.qos.QosDao; + + +public abstract class QosCommandBase<T extends QosBase, M extends QosValidator<T>> extends CommandBase<QosParametersBase<T>> { + + private T qos; + private Guid qosId; + + public QosCommandBase(QosParametersBase<T> parameters) { + super(parameters); + if (getQos() != null) { + setStoragePoolId(getQos().getStoragePoolId()); + addCustomValue("QosName", getQos().getName()); + } + getParameters().setShouldBeLogged(true); + } + + @Override + protected boolean canDoAction() { + M validator = getQosValidator(getQos()); + return (validateParameters() + && validate(validator.allValuesPresent())); + } + + public T getQos() { + if (qos == null) { + if (getParameters().getQos() == null) { + if (getParameters().getQosId() != null) { + qos = getQosDao().get(getParameters().getQosId()); + } + } else { + qos = getParameters().getQos(); + } + } + return qos; + } + + public Guid getQosId() { + if (qosId == null) { + if (getParameters().getQosId() != null) { + qosId = getParameters().getQosId(); + } else if (getParameters().getQos() != null) { + qosId = getParameters().getQos().getId(); + } + } + return qosId; + } + + @Override + public Guid getStoragePoolId() { + if (super.getStoragePoolId() == null && getQos() != null) { + setStoragePoolId(getQos().getStoragePoolId()); + } + return super.getStoragePoolId(); + } + + protected boolean validateParameters() { + if (getQos() == null) { + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_QOS_NOT_FOUND); + } + return true; + } + + @Override + public List<PermissionSubject> getPermissionCheckSubjects() { + return Collections.singletonList(new PermissionSubject(getStoragePoolId(), + VdcObjectType.StoragePool, getActionType().getActionGroup())); + } + + protected abstract QosDao<T> getQosDao(); + + @Override + protected void setActionMessageParameters() { + addCanDoActionMessage(VdcBllMessages.VAR__TYPE__QOS); + } + + protected abstract M getQosValidator(T qosBase); + +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveQosCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveQosCommandBase.java new file mode 100644 index 0000000..933ca5f --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveQosCommandBase.java @@ -0,0 +1,41 @@ +package org.ovirt.engine.core.bll.qos; + +import org.ovirt.engine.core.bll.validator.QosValidator; +import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.action.QosParametersBase; +import org.ovirt.engine.core.common.businessentities.qos.QosBase; +import org.ovirt.engine.core.common.errors.VdcBllMessages; + +public abstract class RemoveQosCommandBase<T extends QosBase, M extends QosValidator<T>> extends QosCommandBase<T, M> { + + public RemoveQosCommandBase(QosParametersBase<T> parameters) { + super(parameters); + } + + @Override + protected boolean canDoAction() { + if (!validateParameters()) { + return false; + } + QosValidator<T> validator = getQosValidator(getQos()); + return super.canDoAction() && validate(validator.qosExists()); + } + + @Override + protected void executeCommand() { + getQosDao().remove(getQos().getId()); + getReturnValue().setActionReturnValue(getQos().getId()); + setSucceeded(true); + } + + @Override + protected void setActionMessageParameters() { + super.setActionMessageParameters(); + addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); + } + + @Override + public AuditLogType getAuditLogTypeValue() { + return getSucceeded() ? AuditLogType.USER_REMOVED_QOS : AuditLogType.USER_FAILED_TO_REMOVE_QOS; + } +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveStorageQosCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveStorageQosCommand.java new file mode 100644 index 0000000..6d80b15 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/RemoveStorageQosCommand.java @@ -0,0 +1,25 @@ +package org.ovirt.engine.core.bll.qos; + +import org.ovirt.engine.core.bll.validator.QosValidator; +import org.ovirt.engine.core.bll.validator.StorageQosValidator; +import org.ovirt.engine.core.common.action.QosParametersBase; +import org.ovirt.engine.core.common.businessentities.qos.StorageQos; +import org.ovirt.engine.core.dao.qos.QosDao; + +public class RemoveStorageQosCommand extends RemoveQosCommandBase<StorageQos, QosValidator<StorageQos>> { + + public RemoveStorageQosCommand(QosParametersBase<StorageQos> parameters) { + super(parameters); + } + + @Override + protected QosDao<StorageQos> getQosDao() { + return getDbFacade().getStorageQosDao(); + } + + @Override + protected QosValidator<StorageQos> getQosValidator(StorageQos qos) { + return new StorageQosValidator(qos); + } + +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateQosCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateQosCommandBase.java new file mode 100644 index 0000000..c1b8756 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateQosCommandBase.java @@ -0,0 +1,41 @@ +package org.ovirt.engine.core.bll.qos; + + +import org.ovirt.engine.core.bll.validator.QosValidator; +import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.action.QosParametersBase; +import org.ovirt.engine.core.common.businessentities.qos.QosBase; +import org.ovirt.engine.core.common.errors.VdcBllMessages; + +public abstract class UpdateQosCommandBase<T extends QosBase, M extends QosValidator<T>> extends QosCommandBase<T, M> { + + public UpdateQosCommandBase(QosParametersBase<T> parameters) { + super(parameters); + } + + @Override + protected boolean canDoAction() { + M qosValidator = getQosValidator(getQos()); + return super.canDoAction() + && validate(qosValidator.qosExists()) + && validate(qosValidator.consistentDataCenter()); + } + + @Override + protected void executeCommand() { + getQosDao().update(getQos()); + getReturnValue().setActionReturnValue(getQos().getId()); + setSucceeded(true); + } + + @Override + protected void setActionMessageParameters() { + super.setActionMessageParameters(); + addCanDoActionMessage(VdcBllMessages.VAR__ACTION__UPDATE); + } + + @Override + public AuditLogType getAuditLogTypeValue() { + return getSucceeded() ? AuditLogType.USER_UPDATED_QOS : AuditLogType.USER_FAILED_TO_UPDATE_QOS; + } +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateStorageQosCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateStorageQosCommand.java new file mode 100644 index 0000000..c357a97 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateStorageQosCommand.java @@ -0,0 +1,25 @@ +package org.ovirt.engine.core.bll.qos; + + +import org.ovirt.engine.core.bll.validator.QosValidator; +import org.ovirt.engine.core.bll.validator.StorageQosValidator; +import org.ovirt.engine.core.common.action.QosParametersBase; +import org.ovirt.engine.core.common.businessentities.qos.StorageQos; +import org.ovirt.engine.core.dao.qos.QosDao; + +public class UpdateStorageQosCommand extends UpdateQosCommandBase<StorageQos, QosValidator<StorageQos>> { + + public UpdateStorageQosCommand(QosParametersBase<StorageQos> parameters) { + super(parameters); + } + + @Override + protected QosDao<StorageQos> getQosDao() { + return getDbFacade().getStorageQosDao(); + } + + @Override + protected QosValidator<StorageQos> getQosValidator(StorageQos qos) { + return new StorageQosValidator(qos); + } +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/QosValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/QosValidator.java new file mode 100644 index 0000000..059a9ce --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/QosValidator.java @@ -0,0 +1,78 @@ +package org.ovirt.engine.core.bll.validator; + +import java.util.List; + +import org.apache.commons.lang.ObjectUtils; +import org.ovirt.engine.core.bll.ValidationResult; +import org.ovirt.engine.core.common.businessentities.qos.QosBase; +import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.dao.qos.QosDao; + +public abstract class QosValidator<T extends QosBase> { + + private final T qos; + private T oldQos; + private List<T> allQos; + + public QosValidator(T qos) { + this.qos = qos; + } + + protected T getQos() { + return qos; + } + + protected T getOldQos() { + if (oldQos == null && qos != null) { + oldQos = getQosDao().get(qos.getId()); + } + return oldQos; + } + + protected abstract QosDao<T> getQosDao(); + + protected List<T> getAllQosInDcByType() { + if (allQos == null) { + allQos = getQosDao().getAllForStoragePoolId(qos.getStoragePoolId()); + } + return allQos; + } + + /** + * Verify that the QoS entity had previously existed in the database. + */ + public ValidationResult qosExists() { + return (getOldQos() == null) + ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_QOS_NOT_FOUND) + : ValidationResult.VALID; + } + + /** + * Verify that the QoS entity has the same DC ID as the one stored in the database. + */ + public ValidationResult consistentDataCenter() { + return (getOldQos() == null || !qos.getStoragePoolId().equals(getOldQos().getStoragePoolId())) + ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_CONSISTENT) + : ValidationResult.VALID; + } + + /** + * Verify that a name isn't already taken by another QoS entity in the same DC. + */ + public ValidationResult nameNotTakenInDc() { + List<T> allQosInDcByType = getAllQosInDcByType(); + if (allQosInDcByType != null) { + for (T iterQos : allQosInDcByType) { + if (ObjectUtils.equals(iterQos.getName(), qos.getName())) { + return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_QOS_NAME_EXIST); + } + } + } + return ValidationResult.VALID; + } + + /** + * Verify that if any capping was specified, that all parameters are present. + */ + public abstract ValidationResult allValuesPresent(); +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageQosValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageQosValidator.java new file mode 100644 index 0000000..e85b162 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageQosValidator.java @@ -0,0 +1,47 @@ +package org.ovirt.engine.core.bll.validator; + +import org.ovirt.engine.core.bll.ValidationResult; +import org.ovirt.engine.core.common.businessentities.qos.StorageQos; +import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.dal.dbbroker.DbFacade; +import org.ovirt.engine.core.dao.qos.QosDao; + +public class StorageQosValidator extends QosValidator<StorageQos> { + + public StorageQosValidator(StorageQos qos) { + super(qos); + } + + @Override + protected QosDao<StorageQos> getQosDao() { + return DbFacade.getInstance().getStorageQosDao(); + } + + /* + * Bytes and iops values are independent categories. + * Setting one value leads to reseting the other two in the same + * category to unlimited. + * A non-zero total value cannot be used with non-zero read or + * write value. + */ + @Override + public ValidationResult allValuesPresent() { + if (missingCategoryValues(getQos().getMaxThroughput(), + getQos().getMaxReadThroughput(), + getQos().getMaxWriteThroughput()) + || missingCategoryValues(getQos().getMaxIops(), + getQos().getMaxReadIops(), + getQos().getMaxWriteIops())) { + return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_QOS_MISSING_VALUES); + } + return ValidationResult.VALID; + } + + private boolean missingCategoryValues(Integer total, Integer read, Integer write) { + return isPositive(total) && (isPositive(read) || isPositive(write)); + } + + private boolean isPositive(Integer value) { + return value != null && value > 0; + } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java index dcbecd0..5c1eb29 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java @@ -994,6 +994,14 @@ USER_UPDATED_NETWORK_QOS(10104), USER_FAILED_TO_UPDATE_NETWORK_QOS(10105, AuditLogSeverity.ERROR), + // Qos + USER_ADDED_QOS(10110), + USER_FAILED_TO_ADD_QOS(10111, AuditLogSeverity.ERROR), + USER_REMOVED_QOS(10112), + USER_FAILED_TO_REMOVE_QOS(10113, AuditLogSeverity.ERROR), + USER_UPDATED_QOS(10114), + USER_FAILED_TO_UPDATE_QOS(10115, AuditLogSeverity.ERROR), + //mom policies USER_UPDATED_MOM_POLICIES(10200), USER_FAILED_TO_UPDATE_MOM_POLICIES(10201, AuditLogSeverity.WARNING), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/QosParametersBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/QosParametersBase.java new file mode 100644 index 0000000..19d4839 --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/QosParametersBase.java @@ -0,0 +1,32 @@ +package org.ovirt.engine.core.common.action; + +import javax.validation.Valid; + +import org.ovirt.engine.core.common.businessentities.qos.QosBase; +import org.ovirt.engine.core.compat.Guid; + +public class QosParametersBase<T extends QosBase> extends VdcActionParametersBase { + + private static final long serialVersionUID = 1304387921254822524L; + + @Valid + private T qos; + private Guid qosId; + + public T getQos() { + return qos; + } + + public void setQos(T qos) { + this.qos = qos; + } + + public Guid getQosId() { + return qosId; + } + + public void setQosId(Guid qosId) { + this.qosId = qosId; + } + +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java index ffa9b86..f8bf499 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java @@ -328,6 +328,10 @@ AddNetworkQoS(1750, ActionGroup.CONFIGURE_STORAGE_POOL_NETWORK, false, QuotaDependency.NONE), UpdateNetworkQoS(1751, ActionGroup.CONFIGURE_STORAGE_POOL_NETWORK, false, QuotaDependency.NONE), RemoveNetworkQoS(1752, ActionGroup.CONFIGURE_STORAGE_POOL_NETWORK, false, QuotaDependency.NONE), + // qos + AddStorageQos(1753, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, QuotaDependency.NONE), + UpdateStorageQos(1754, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, QuotaDependency.NONE), + RemoveStorageQos(1755, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, QuotaDependency.NONE), // External Tasks AddExternalJob(1800, ActionGroup.INJECT_EXTERNAL_TASKS, false, QuotaDependency.NONE), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index cd55a46..2b2e9b9 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -30,6 +30,7 @@ VAR__TYPE__PERMISSION, VAR__TYPE__HOST_CAPABILITIES, VAR__TYPE__NETWORK_QOS, + VAR__TYPE__QOS, VAR__TYPE__SPM, VAR__TYPE__CLUSTER_POLICY, VAR__TYPE__POLICY_UNIT, @@ -957,9 +958,14 @@ // QoS ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_EXIST(ErrorType.BAD_PARAMETERS), + ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_CONSISTENT(ErrorType.BAD_PARAMETERS), QOS_NAME_NOT_NULL(ErrorType.BAD_PARAMETERS), QOS_NAME_TOO_LONG(ErrorType.BAD_PARAMETERS), QOS_NAME_INVALID(ErrorType.BAD_PARAMETERS), + ACTION_TYPE_FAILED_QOS_MISSING_VALUES(ErrorType.BAD_PARAMETERS), + ACTION_TYPE_FAILED_QOS_NEGATIVE_VALUES(ErrorType.BAD_PARAMETERS), + ACTION_TYPE_FAILED_QOS_NAME_EXIST(ErrorType.BAD_PARAMETERS), + ACTION_TYPE_FAILED_QOS_NOT_FOUND(ErrorType.BAD_PARAMETERS), // network QoS ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_VALUES(ErrorType.BAD_PARAMETERS), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/QosQueryParameterBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/QosQueryParameterBase.java new file mode 100644 index 0000000..c3b1d34 --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/QosQueryParameterBase.java @@ -0,0 +1,35 @@ +package org.ovirt.engine.core.common.queries; + +import org.ovirt.engine.core.common.businessentities.qos.QosType; +import org.ovirt.engine.core.compat.Guid; + + +/** + * Parameter class for the "GetById" queries + */ +public class QosQueryParameterBase extends IdQueryParameters { + + private static final long serialVersionUID = -4601447034328553847L; + private QosType qosType; + + public QosQueryParameterBase() { + } + + public QosQueryParameterBase(Guid dataCenterId, QosType qosType) { + super(dataCenterId); + this.qosType = qosType; + } + + public QosQueryParameterBase(Guid dataCenterId) { + super(dataCenterId); + } + + public QosType getQosType() { + return qosType; + } + + public void setQosType(QosType qosType) { + this.qosType = qosType; + } + +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java index 8490f69..a03ed4b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java @@ -340,6 +340,10 @@ //Network QoS GetAllNetworkQosByStoragePoolId, + // QoS + GetQosById, + GetAllQosByStoragePoolIdAndType, + GetWatchdog(VdcQueryAuthType.User), GetConsoleDevices(VdcQueryAuthType.User), GetRngDevice(VdcQueryAuthType.User), diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index cd64d03..0609c9d 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -299,6 +299,7 @@ VAR__TYPE__PERMISSION=$type Permission VAR__TYPE__HOST_CAPABILITIES=$type Host capabilities VAR__TYPE__NETWORK_QOS=$type Network QoS +VAR__TYPE__QOS=$type QoS VAR__TYPE__SPM=$type SPM VAR__TYPE__CLUSTER_POLICY=$type Cluster Policy VAR__TYPE__POLICY_UNIT=$type Policy Unit @@ -1113,6 +1114,7 @@ ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES=Cannot ${action} ${type}. Values are out of range. ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_EXIST=Cannot ${action} ${type}. Invalid data center. +ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_CONSISTENT=Cannot ${action} ${type}. Cannot change QoS data center. ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_VALUES=Cannot ${action} ${type}. All three values are needed in order to define QoS on each network directions. ACTION_TYPE_FAILED_NETWORK_QOS_NEGATIVE_VALUES=Cannot ${action} ${type}. Negative values are not allowed. @@ -1127,6 +1129,10 @@ QOS_NAME_NOT_NULL=QoS name cannot be empty. QOS_NAME_INVALID=Invalid QoS name (name must be formed of "a-z0-9A-Z" or "-_ ") QOS_NAME_TOO_LONG=QoS name length must be under 50 characters. +ACTION_TYPE_FAILED_QOS_MISSING_VALUES=Cannot ${action} ${type}. QoS element has missing values. +ACTION_TYPE_FAILED_QOS_NEGATIVE_VALUES=Cannot ${action} ${type}. QoS element cannot have negative values. +ACTION_TYPE_FAILED_QOS_NAME_EXIST=Cannot ${action} ${type}. QoS element name already exists. +ACTION_TYPE_FAILED_QOS_NOT_FOUND=Cannot ${action} ${type}. QoS element not found. # cluster policy errors ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID=Cannot ${action} ${type}. Parameters are invalid. diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties index e144d4d..8a4a37a 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -795,6 +795,12 @@ USER_FAILED_TO_REMOVE_NETWORK_QOS=Failed to remove Network QoS ${NetworkQoSName}. (User: ${UserName}) USER_UPDATED_NETWORK_QOS=Network QoS ${NetworkQoSName} was updated. (User: ${UserName}) USER_FAILED_TO_UPDATE_NETWORK_QOS=Failed to update Network QoS ${NetworkQoSName}. (User: ${UserName}) +USER_ADDED_QOS=QoS ${QoSName} was added. (User: ${UserName}) +USER_FAILED_TO_ADD_QOS=Failed to add QoS ${QoSName}. (User: ${UserName}) +USER_REMOVED_QOS=QoS ${QoSName} was removed. (User: ${UserName}) +USER_FAILED_TO_REMOVE_QOS=Failed to remove QoS ${QoSName}. (User: ${UserName}) +USER_UPDATED_QOS=QoS ${QoSName} was updated. (User: ${UserName}) +USER_FAILED_TO_UPDATE_QOS=Failed to update QoS ${QoSName}. (User: ${UserName}) USER_ADD_CLUSTER_POLICY=Clsuter Policy ${ClusterPolicy} was added. (User: ${UserName}) USER_FAILED_TO_ADD_CLUSTER_POLICY=Failed to add Clsuter Policy: ${ClusterPolicy}. (User: ${UserName}) USER_UPDATE_CLUSTER_POLICY=Clsuter Policy ${ClusterPolicy} was updated. (User: ${UserName}) diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index a25b257..2e88900 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -811,6 +811,9 @@ @DefaultStringValue("$type Network QoS") String VAR__TYPE__NETWORK_QOS(); + @DefaultStringValue("$type QoS") + String VAR__TYPE__QOS(); + @DefaultStringValue("$type SPM") String VAR__TYPE__SPM(); @@ -3054,6 +3057,9 @@ @DefaultStringValue("Cannot ${action} ${type}. Invalid data center") String ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_EXIST(); + @DefaultStringValue("Cannot ${action} ${type}. Cannot change QoS data center.") + String ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_CONSISTENT(); + @DefaultStringValue("QoS name cannot be empty.") String QOS_NAME_NOT_NULL(); @@ -3063,6 +3069,18 @@ @DefaultStringValue("QoS name length must be under 50 characters.") String QOS_NAME_TOO_LONG(); + @DefaultStringValue("Cannot ${action} ${type}. QoS element has missing values.") + String ACTION_TYPE_FAILED_QOS_MISSING_VALUES(); + + @DefaultStringValue("Cannot ${action} ${type}. QoS element cannot have negative values.") + String ACTION_TYPE_FAILED_QOS_NEGATIVE_VALUES(); + + @DefaultStringValue("Cannot ${action} ${type}. QoS element name already exists.") + String ACTION_TYPE_FAILED_QOS_NAME_EXIST(); + + @DefaultStringValue("Cannot ${action} ${type}. QoS element not found.") + String ACTION_TYPE_FAILED_QOS_NOT_FOUND(); + @DefaultStringValue("Cannot ${action}. New disk size cannot be smaller than the current.") String ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL(); diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index e6dc7ce..f12e50f 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -308,6 +308,7 @@ VAR__TYPE__GLUSTER_HOOK=$type Gluster Hook VAR__TYPE__GLUSTER_SERVICE=$type Service VAR__TYPE__NETWORK_QOS=$type Network QoS +VAR__TYPE__QOS=$type QoS VAR__TYPE__SPM=$type SPM VAR__TYPE__ISCSI_BOND=$type iSCSI Bond VAR__TYPE__DISK__SNAPSHOT=$type Disk Snapshot @@ -1088,6 +1089,7 @@ ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES=Cannot ${action} ${type}. Values are out of range. ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_EXIST=Cannot ${action} ${type}. Invalid data center. +ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_CONSISTENT=Cannot ${action} ${type}. Cannot change QoS data center. ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_VALUES=Cannot ${action} ${type}. All three values are needed in order to define QoS on each network directions. ACTION_TYPE_FAILED_NETWORK_QOS_NEGATIVE_VALUES=Cannot ${action} ${type}. Negative values are not allowed. @@ -1102,6 +1104,10 @@ QOS_NAME_NOT_NULL=QoS name cannot be empty. QOS_NAME_INVALID=Invalid QoS name (name must be formed of "a-z0-9A-Z" or "-_ ") QOS_NAME_TOO_LONG=QoS name length must be under 50 characters. +ACTION_TYPE_FAILED_QOS_MISSING_VALUES=Cannot ${action} ${type}. QoS element has missing values. +ACTION_TYPE_FAILED_QOS_NEGATIVE_VALUES=Cannot ${action} ${type}. QoS element cannot have negative values. +ACTION_TYPE_FAILED_QOS_NAME_EXIST=Cannot ${action} ${type}. QoS element name already exists. +ACTION_TYPE_FAILED_QOS_NOT_FOUND=Cannot ${action} ${type}. QoS element not found. # cluster policy errors ACTION_TYPE_FAILED_CLUSTER_POLICY_PARAMETERS_INVALID=Cannot ${action} ${type}. Parameters are invalid. -- To view, visit http://gerrit.ovirt.org/31805 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a9af59277b5055453159f002f19046c00522ddb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches