Martin Sivák has uploaded a new change for review.

Change subject: engine: Use proper units in Storage QoS when talking to VDSM
......................................................................

engine: Use proper units in Storage QoS when talking to VDSM

The engine used Mbps and VDSM expects B/s. This patch changes
the engine side to use MB/s (as is more common when dealing with
storage) and properly translates that to Bytes when sending the
value to VDSM.

Change-Id: I2644e9e029c8b6ebe4b5b7626f7b1ed6b6b5aea4
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1145621
Signed-off-by: Martin Sivák <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/StorageQos.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
3 files changed, 20 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/35275/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/StorageQos.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/StorageQos.java
index a7210ed..3984675 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/StorageQos.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/StorageQos.java
@@ -14,6 +14,8 @@
 
     private static final long serialVersionUID = 1122123549710787758L;
 
+    /* All Throughput values are in MiBs per second */
+
     @ConfiguredRange(min = 0, maxConfigValue = 
ConfigValues.MaxThroughputUpperBoundQosValue,
             message = "ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES")
     private Integer maxThroughput;
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
index 865a7f2..59e54e3 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
@@ -262,7 +262,7 @@
         int sPaprVscsiIndex = 
controllerIndexMap.get(DiskInterface.SPAPR_VSCSI);
         // map to avoid fetching qos object for same disk profile id
         Map<Guid, Guid> diskProfileStorageQosMap = new HashMap<>();
-        Map<Guid, Map<String, Integer>> storageQosIoTuneMap = new HashMap<>();
+        Map<Guid, Map<String, Long>> storageQosIoTuneMap = new HashMap<>();
 
         for (Disk disk : disks) {
             Map<String, Object> struct = new HashMap<String, Object>();
@@ -329,7 +329,7 @@
                     struct.put(VdsProperties.PropagateErrors, 
disk.getPropagateErrors().toString()
                             .toLowerCase());
                     if 
(FeatureSupported.storageQoS(vm.getVdsGroupCompatibilityVersion())) {
-                        Map<String, Integer> ioTune =
+                        Map<String, Long> ioTune =
                                 buildIoTune(diskImage, 
diskProfileStorageQosMap, storageQosIoTuneMap);
                         if (ioTune != null) {
                             if (vmDevice.getSpecParams() == null) {
@@ -362,9 +362,9 @@
         ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new 
CreateAdditionalControllers(devices));
     }
 
-    private Map<String, Integer> buildIoTune(DiskImage diskImage,
+    private Map<String, Long> buildIoTune(DiskImage diskImage,
             Map<Guid, Guid> diskProfileStorageQosMap,
-            Map<Guid, Map<String, Integer>> storageQosIoTuneMap) {
+            Map<Guid, Map<String, Long>> storageQosIoTuneMap) {
         Guid diskProfileId = diskImage.getDiskProfileId();
         if (diskProfileId == null) {
             return null;
@@ -380,7 +380,7 @@
             storageQosIoTuneMap.put(storageQosId, buildIoTuneMap(storageQos));
         }
 
-        Map<String, Integer> ioTuneMap = storageQosIoTuneMap.get(storageQosId);
+        Map<String, Long> ioTuneMap = storageQosIoTuneMap.get(storageQosId);
         // return map with values
         if (!ioTuneMap.isEmpty()) {
             return ioTuneMap;
@@ -388,26 +388,30 @@
         return null;
     }
 
-    private Map<String, Integer> buildIoTuneMap(StorageQos storageQos) {
+    private Map<String, Long> buildIoTuneMap(StorageQos storageQos) {
         // build map
-        Map<String, Integer> ioTuneMap = new HashMap<>();
+        Map<String, Long> ioTuneMap = new HashMap<>();
         if (storageQos.getMaxThroughput() != null) {
-            ioTuneMap.put(VdsProperties.TotalBytesSec, 
storageQos.getMaxThroughput());
+            // Convert MiB/s to B/s vdsm is expecting
+            ioTuneMap.put(VdsProperties.TotalBytesSec, 
storageQos.getMaxThroughput() * 1024 * 1024L);
         }
         if (storageQos.getMaxReadThroughput() != null) {
-            ioTuneMap.put(VdsProperties.ReadBytesSec, 
storageQos.getMaxReadThroughput());
+            // Convert MiB/s to B/s vdsm is expecting
+
+            ioTuneMap.put(VdsProperties.ReadBytesSec, 
storageQos.getMaxReadThroughput() * 1024 * 1024L);
         }
         if (storageQos.getMaxWriteThroughput() != null) {
-            ioTuneMap.put(VdsProperties.WriteBytesSec, 
storageQos.getMaxWriteThroughput());
+            // Convert MiB/s to B/s vdsm is expecting
+            ioTuneMap.put(VdsProperties.WriteBytesSec, 
storageQos.getMaxWriteThroughput() * 1024 * 1024L);
         }
         if (storageQos.getMaxIops() != null) {
-            ioTuneMap.put(VdsProperties.TotalIopsSec, storageQos.getMaxIops());
+            ioTuneMap.put(VdsProperties.TotalIopsSec, 
storageQos.getMaxIops().longValue());
         }
         if (storageQos.getMaxReadIops() != null) {
-            ioTuneMap.put(VdsProperties.ReadIopsSec, 
storageQos.getMaxReadIops());
+            ioTuneMap.put(VdsProperties.ReadIopsSec, 
storageQos.getMaxReadIops().longValue());
         }
         if (storageQos.getMaxWriteIops() != null) {
-            ioTuneMap.put(VdsProperties.WriteIopsSec, 
storageQos.getMaxWriteIops());
+            ioTuneMap.put(VdsProperties.WriteIopsSec, 
storageQos.getMaxWriteIops().longValue());
         }
 
         return ioTuneMap;
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index 75b95c8..d4723eb 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -3829,7 +3829,7 @@
     @DefaultStringValue("Write")
     String writeStorageQosPopup();
 
-    @DefaultStringValue("Mbps")
+    @DefaultStringValue("MB/s")
     String mbpsLabelStorageQosPopup();
 
     @DefaultStringValue("Count")


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

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

Reply via email to