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

Change subject: core: Push ioTune QoS info when hotplugging disk
......................................................................

core: Push ioTune QoS info when hotplugging disk

This adds the support for disk QoS for disks that are hotplugged
while the VM is already running.

Change-Id: Ic4bb85cd307089088be77cff28adbc783ebcaedd
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1145665
Signed-off-by: Martin Sivák <msi...@redhat.com>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/HotPlugDiskVDSCommand.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
2 files changed, 21 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/35353/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/HotPlugDiskVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/HotPlugDiskVDSCommand.java
index 0abdede..6a6a31a 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/HotPlugDiskVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/HotPlugDiskVDSCommand.java
@@ -16,6 +16,7 @@
 import org.ovirt.engine.core.common.businessentities.VolumeFormat;
 import org.ovirt.engine.core.common.utils.VmDeviceType;
 import org.ovirt.engine.core.common.vdscommands.HotPlugDiskVDSParameters;
+import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
 import org.ovirt.engine.core.utils.archstrategy.ArchStrategyFactory;
 import org.ovirt.engine.core.vdsbroker.architecture.GetControllerIndices;
@@ -66,6 +67,12 @@
             drive.put(VdsProperties.VolumeId, 
diskImage.getImageId().toString());
             drive.put(VdsProperties.ImageId, diskImage.getId().toString());
             drive.put(VdsProperties.PropagateErrors, 
disk.getPropagateErrors().toString().toLowerCase());
+
+            Map<String, Long> ioTune =
+                    VmInfoBuilder.buildIoTune(diskImage,
+                            new HashMap<Guid, Guid>(), new HashMap<Guid, 
Map<String, Long>>());
+            VmInfoBuilder.addIoTuneParams(getParameters().getVm(), vmDevice, 
ioTune);
+
         } else {
             LunDisk lunDisk = (LunDisk) disk;
 
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 59e54e3..d7a96d5 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
@@ -328,16 +328,9 @@
                             .toLowerCase());
                     struct.put(VdsProperties.PropagateErrors, 
disk.getPropagateErrors().toString()
                             .toLowerCase());
-                    if 
(FeatureSupported.storageQoS(vm.getVdsGroupCompatibilityVersion())) {
                         Map<String, Long> ioTune =
                                 buildIoTune(diskImage, 
diskProfileStorageQosMap, storageQosIoTuneMap);
-                        if (ioTune != null) {
-                            if (vmDevice.getSpecParams() == null) {
-                                vmDevice.setSpecParams(new HashMap<String, 
Object>());
-                            }
-                            vmDevice.getSpecParams().put(VdsProperties.Iotune, 
ioTune);
-                        }
-                    }
+                    addIoTuneParams(vm, vmDevice, ioTune);
                 } else {
                     LunDisk lunDisk = (LunDisk) disk;
                     struct.put(VdsProperties.Guid, 
lunDisk.getLun().getLUN_id());
@@ -362,7 +355,18 @@
         ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new 
CreateAdditionalControllers(devices));
     }
 
-    private Map<String, Long> buildIoTune(DiskImage diskImage,
+    static void addIoTuneParams(VM vm, VmDevice vmDevice, Map<String, Long> 
ioTune) {
+        if (FeatureSupported.storageQoS(vm.getVdsGroupCompatibilityVersion())) 
{
+            if (ioTune != null) {
+                if (vmDevice.getSpecParams() == null) {
+                    vmDevice.setSpecParams(new HashMap<String, Object>());
+                }
+                vmDevice.getSpecParams().put(VdsProperties.Iotune, ioTune);
+            }
+        }
+    }
+
+    static Map<String, Long> buildIoTune(DiskImage diskImage,
             Map<Guid, Guid> diskProfileStorageQosMap,
             Map<Guid, Map<String, Long>> storageQosIoTuneMap) {
         Guid diskProfileId = diskImage.getDiskProfileId();
@@ -388,7 +392,7 @@
         return null;
     }
 
-    private Map<String, Long> buildIoTuneMap(StorageQos storageQos) {
+    private static Map<String, Long> buildIoTuneMap(StorageQos storageQos) {
         // build map
         Map<String, Long> ioTuneMap = new HashMap<>();
         if (storageQos.getMaxThroughput() != null) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4bb85cd307089088be77cff28adbc783ebcaedd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Martin Sivák <msi...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to