Gilad Chaplik has uploaded a new change for review.

Change subject: common: Adding the CpuQos entity
......................................................................

common: Adding the CpuQos entity

Adding a Cpu Qos entity that will be used by the cpu profile.
the cpu profile will be used to set cpu sla parameters of the vm.

Change-Id: I2134a778d70b3c9ff3e78cc38282a515250b7cf2
Bug-Url: https://bugzilla.redhat.com/1084930
Signed-off-by: Gilad Chaplik <[email protected]>
---
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/CpuQos.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/QosType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
4 files changed, 66 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/31819/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/CpuQos.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/CpuQos.java
new file mode 100644
index 0000000..8f43ad4
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/CpuQos.java
@@ -0,0 +1,59 @@
+package org.ovirt.engine.core.common.businessentities.qos;
+
+import org.ovirt.engine.core.common.config.ConfigValues;
+import org.ovirt.engine.core.common.utils.ObjectUtils;
+import org.ovirt.engine.core.common.validation.annotation.ConfiguredRange;
+
+public class CpuQos extends QosBase {
+    private static final long serialVersionUID = -5870254800787534586L;
+
+    @ConfiguredRange(min = 1, maxConfigValue = 
ConfigValues.MaxCpuLimitQosValue,
+            message = "ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES")
+    private Integer cpuLimit;
+
+    public CpuQos() {
+        super(QosType.CPU);
+    }
+
+    public Integer getCpuLimit() {
+        return cpuLimit;
+    }
+
+    public void setCpuLimit(Integer cpuLimit) {
+        this.cpuLimit = cpuLimit;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return super.equals(obj)
+                && equalValues((QosBase) obj);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((cpuLimit == null) ? 0 : 
cpuLimit.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equalValues(QosBase obj) {
+        if (!(obj instanceof CpuQos)) {
+            return false;
+        }
+        CpuQos other = (CpuQos) obj;
+        return ObjectUtils.objectsEqual(cpuLimit, other.getCpuLimit());
+    }
+
+    @Override
+    public String getString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("[")
+                .append("cpu limit=")
+                .append(cpuLimit)
+                .append("]");
+        return builder.toString();
+    }
+
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/QosType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/QosType.java
index 8425713..cdb00a3 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/QosType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/QosType.java
@@ -7,7 +7,8 @@
 
 public enum QosType implements Identifiable {
     ALL(0),
-    STORAGE(1);
+    STORAGE(1),
+    CPU(2);
 
     private int value;
     private static final Map<Integer, QosType> valueToStatus = new 
HashMap<Integer, QosType>();
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index 9869611..24eab1d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -1918,5 +1918,9 @@
     @DefaultValueAttribute("1000000")
     MaxWriteIopsUpperBoundQosValue,
 
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("100")
+    MaxCpuLimitQosValue,
+
     Invalid;
 }
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
 
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
index 40ac0f3..8c69725 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
@@ -214,6 +214,7 @@
                <include name="common/businessentities/qos/QosBase.java"/>
                <include name="common/businessentities/qos/QosType.java"/>
                <include name="common/businessentities/qos/StorageQos.java"/>
+               <include name="common/businessentities/qos/CpuQos.java"/>
 
                <!-- Misc -->
                <include name="common/AuditLogType.java" />


-- 
To view, visit http://gerrit.ovirt.org/31819
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2134a778d70b3c9ff3e78cc38282a515250b7cf2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Gilad Chaplik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to