Ala Hino has uploaded a new change for review.

Change subject: core: Gluster disk as network device
......................................................................

core: Gluster disk as network device

In 3.6, vdsm supports gluster libgfapi. This patch checks that cluster version
is 3.6 (or higher). If so and the vm uses gluster disk, engine sets diskType to
'network'. Setting diskType to 'network' provides info to vdsm to use libgfapi.

Change-Id: I061594c83342883804fc379a00a953591474bdbb
Signed-off-by: Ala Hino <ah...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
5 files changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/41899/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
index 0719b33..f64d2dc 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
@@ -550,4 +550,13 @@
     public static boolean 
liveStorageMigrationBetweenDifferentStorageTypesSupported(Version version) {
         return 
supportedInConfig(ConfigValues.LiveStorageMigrationBetweenDifferentStorageTypes,
 version);
     }
+
+    /**
+     * @param version
+     *            Compatibility version to check for.
+     * @return <code>true</code> if libgfapi is supported for the given version
+     */
+    public static boolean libgfApiSupported(Version version) {
+        return supportedInConfig(ConfigValues.LibgfApiSupported, version);
+    }
 }
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 3d772d6..09fc859 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
@@ -2171,6 +2171,13 @@
     @DefaultValueAttribute("10000")
     VMConsoleTicketTolerance,
 
+    /**
+     * In 3.6 gluster libgfapi is supported.
+     */
+    @TypeConverterAttribute(Boolean.class)
+    @DefaultValueAttribute("true")
+    LibgfApiSupported,
+
     Invalid
 
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
index df348a6..6d1a2fa 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
@@ -105,6 +105,7 @@
     UserDefinedNetworkCustomProperties,
     MultipleGatewaysSupported,
     VirtIoScsiEnabled(ConfigAuthType.User),
+    LibgfApiSupported(ConfigAuthType.User),
     OvfStoreOnAnyDomain,
     SshSoftFencingCommand,
     MemorySnapshotSupported(ConfigAuthType.User),
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 8103f62..f3a2b01 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
@@ -18,6 +18,7 @@
 import org.ovirt.engine.core.common.businessentities.GraphicsInfo;
 import org.ovirt.engine.core.common.businessentities.GraphicsType;
 import org.ovirt.engine.core.common.businessentities.NumaTuneMode;
+import org.ovirt.engine.core.common.businessentities.StorageDomain;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VdsNumaNode;
 import org.ovirt.engine.core.common.businessentities.VmDevice;
@@ -40,6 +41,7 @@
 import org.ovirt.engine.core.common.businessentities.storage.DiskInterface;
 import org.ovirt.engine.core.common.businessentities.storage.LunDisk;
 import org.ovirt.engine.core.common.businessentities.storage.PropagateErrors;
+import org.ovirt.engine.core.common.businessentities.storage.StorageType;
 import org.ovirt.engine.core.common.businessentities.storage.VolumeFormat;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
@@ -373,6 +375,12 @@
                 switch (disk.getDiskStorageType()) {
                     case IMAGE:
                         DiskImage diskImage = (DiskImage) disk;
+                        Guid storageDomainId = 
diskImage.getStorageIds().get(0);
+                        StorageDomain sd = 
DbFacade.getInstance().getStorageDomainDao().get(storageDomainId);
+                        if (sd.getStorageType() == StorageType.GLUSTERFS &&
+                                
FeatureSupported.libgfApiSupported(vm.getVdsGroupCompatibilityVersion())) {
+                            struct.put(VdsProperties.DiskType, 
VdsProperties.NETWORK);
+                        }
                         struct.put(VdsProperties.PoolId, 
diskImage.getStoragePoolId().toString());
                         struct.put(VdsProperties.DomainId, 
diskImage.getStorageIds().get(0).toString());
                         struct.put(VdsProperties.ImageId, 
diskImage.getId().toString());
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index eeb3e66..ecb2479 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -677,6 +677,8 @@
 
 select fn_db_add_config_value_for_versions_up_to('MigrateDowntime', 'false', 
'3.5');
 
+select 
fn_db_add_config_value_for_versions_up_to('LibgfApiSupported','false','3.5');
+
 -- Cluster HA Reservation
 select 
fn_db_add_config_value('OverUtilizationForHaReservation','200','general');
 select fn_db_add_config_value('ScaleDownForHaReservation','1','general');


-- 
To view, visit https://gerrit.ovirt.org/41899
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I061594c83342883804fc379a00a953591474bdbb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ala Hino <ah...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to