Ramesh N has uploaded a new change for review. Change subject: gluster: vdc query to list storage devices ......................................................................
gluster: vdc query to list storage devices Add VdcQuery to list all the storage devices in the given host. Change-Id: Ie1bb0481bd2b34654c28c5990441d1f6f5302ec2 Signed-off-by: Ramesh Nachimuthu <[email protected]> --- A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterStorageDevicesQuery.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/VdcQueryType.java M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 4 files changed, 66 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/39706/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterStorageDevicesQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterStorageDevicesQuery.java new file mode 100644 index 0000000..7641657 --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterStorageDevicesQuery.java @@ -0,0 +1,55 @@ +package org.ovirt.engine.core.bll.gluster; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.ovirt.engine.core.bll.QueriesCommandBase; +import org.ovirt.engine.core.common.businessentities.gluster.StorageDevice; +import org.ovirt.engine.core.common.config.Config; +import org.ovirt.engine.core.common.config.ConfigValues; +import org.ovirt.engine.core.common.queries.VdsIdParametersBase; + +public class GetGlusterStorageDevicesQuery<P extends VdsIdParametersBase> extends QueriesCommandBase<P> { + + public GetGlusterStorageDevicesQuery(P parameters) { + super(parameters); + } + + @Override + protected void executeQueryCommand() { + // Get Device List + List<StorageDevice> storageDevices = + getDbFacade().getStorageDeviceDao().getStorageDevicesInHost(getParameters().getVdsId()); + getQueryReturnValue().setReturnValue(filterStorageDevices(storageDevices)); + + } + + private List<StorageDevice> filterStorageDevices(List<StorageDevice> storageDevices) { + List<StorageDevice> filteredStorageDevices = new ArrayList<>(); + List<String> mountPointsToFilterOutList = getMountPointsFilter(); + List<String> fsTypesToFilterOutList = getFsTypesFilter(); + + // Filter out the devices which are not going to be used as storage device for gluster. + for (StorageDevice device : storageDevices) { + if ((device.getMountPoint() != null && mountPointsToFilterOutList.contains(device.getMountPoint())) + || (device.getFsType() != null && fsTypesToFilterOutList.contains(device.getFsType()))) { + continue; + } + if (device.getCanCreateBrick() || device.getMountPoint() != null || device.getFsType() != null) { + filteredStorageDevices.add(device); + } + } + return filteredStorageDevices; + } + + private List<String> getMountPointsFilter() { + return Arrays.asList(Config.<String> getValue(ConfigValues.MountPointsToIgoreInGlusterStorageList).split(",")); + + } + + private List<String> getFsTypesFilter() { + return Arrays.asList(Config.<String> getValue(ConfigValues.FileSystemTypesToIgoreInGlusterStorageList) + .split(",")); + } +} 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 63a9a51..b286263 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 @@ -1464,6 +1464,14 @@ @DefaultValueAttribute("true") GlusterBrickProvisioningEnabled, + @TypeConverterAttribute(String.class) + @DefaultValueAttribute("/,/home,/boot") + MountPointsToIgoreInGlusterStorageList, + + @TypeConverterAttribute(String.class) + @DefaultValueAttribute("swap") + FileSystemTypesToIgoreInGlusterStorageList, + @TypeConverterAttribute(Integer.class) @DefaultValueAttribute("300") GlusterRefreshRateSnapshotDiscovery, 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 e3593f2..6dde1bf 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 @@ -341,6 +341,7 @@ GetGlusterVolumeSnapshotsByVolumeId, GetGlusterVolumeGeoRepConfigList, GetGlusterVolumeSnapshotConfig, + GetGlusterStorageDevices, GetDefaultConfigurationVersion(VdcQueryAuthType.User), OsRepository(VdcQueryAuthType.User), diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql index 54a91ec..83caadc 100644 --- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -210,6 +210,8 @@ select fn_db_add_config_value('GlusterBrickProvisioningEnabled', 'false', '3.3'); select fn_db_add_config_value('GlusterBrickProvisioningEnabled', 'false', '3.4'); select fn_db_add_config_value('GlusterBrickProvisioningEnabled', 'false', '3.5'); +select fn_db_add_config_value('MountPointsToIgoreInGlusterStorageList','/,/home,/boot','general'); +select fn_db_add_config_value('FileSystemTypesToIgoreInGlusterStorageList','swap','general'); -- OpenStack related select fn_db_add_config_value('KeystoneAuthUrl', '', 'general'); -- To view, visit https://gerrit.ovirt.org/39706 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie1bb0481bd2b34654c28c5990441d1f6f5302ec2 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: Ramesh N <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
