Ramesh N has uploaded a new change for review. Change subject: engine: filter out volume snapshots from storage devices list ......................................................................
engine: filter out volume snapshots from storage devices list Filter out all the lvmsnapshots which are created as part of gluster volume snapshot from the storage devices list. All the LVM snapshots created by gluster volume snapshots will be mounted at the location /var/run/gluster/snaps/. Note: Additionally fixing the typo 'Igore' in GlusterStorageDeviceListMountPointsToIgore and GlusterStorageDeviceListFileSystemTypesToIgore Change-Id: Ib8e8fa3049e271db8a4919afc72716fb459d22e5 Bug-Url: https://bugzilla.redhat.com/1227885 Signed-off-by: Ramesh Nachimuthu <rnach...@redhat.com> --- M 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 packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 3 files changed, 22 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/42276/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 index 4f5a99a..88c8230 100644 --- 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 @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import org.ovirt.engine.core.bll.QueriesCommandBase; import org.ovirt.engine.core.common.businessentities.gluster.StorageDevice; @@ -27,12 +28,11 @@ private List<StorageDevice> filterStorageDevices(List<StorageDevice> storageDevices) { List<StorageDevice> filteredStorageDevices = new ArrayList<>(); - List<String> mountPointsToFilterOutList = getMountPointsFilter(); + Pattern mountPointsFilterPattern = Pattern.compile(getMountPointsFilterPattern()); 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())) + if ((device.getMountPoint() != null && mountPointsFilterPattern.matcher(device.getMountPoint()).matches()) || (device.getFsType() != null && fsTypesToFilterOutList.contains(device.getFsType()))) { continue; } @@ -43,13 +43,22 @@ return filteredStorageDevices; } - private List<String> getMountPointsFilter() { - return Arrays.asList(Config.<String> getValue(ConfigValues.GlusterStorageDeviceListMountPointsToIgore).split(",")); - + private String getMountPointsFilterPattern() { + String[] mountPointsToIgnore = Config.<String> getValue(ConfigValues.GlusterStorageDeviceListMountPointsToIgnore).split(","); + // Mounts to be ignored can be exact mount point or a regular expression which should be with the starting part + // of the mount point. So create a regex which can match against any given pattern in the list. + StringBuilder pattern = new StringBuilder(); + for(String mointPoint:mountPointsToIgnore){ + pattern.append("^"); + pattern.append(mointPoint); + pattern.append("$"); + pattern.append("|"); + } + return pattern.toString(); } private List<String> getFsTypesFilter() { - return Arrays.asList(Config.<String> getValue(ConfigValues.GlusterStorageDeviceListFileSystemTypesToIgore) + return Arrays.asList(Config.<String> getValue(ConfigValues.GlusterStorageDeviceListFileSystemTypesToIgnore) .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 d510e47..c779123 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 @@ -1474,11 +1474,11 @@ @TypeConverterAttribute(String.class) @DefaultValueAttribute("/,/home,/boot") - GlusterStorageDeviceListMountPointsToIgore, + GlusterStorageDeviceListMountPointsToIgnore, @TypeConverterAttribute(String.class) @DefaultValueAttribute("swap") - GlusterStorageDeviceListFileSystemTypesToIgore, + GlusterStorageDeviceListFileSystemTypesToIgnore, @TypeConverterAttribute(Integer.class) @DefaultValueAttribute("300") diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql index 9c0f2ea..1ea86fa 100644 --- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -211,8 +211,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('GlusterStorageDeviceListMountPointsToIgore','/,/home,/boot','general'); -select fn_db_add_config_value('GlusterStorageDeviceListFileSystemTypesToIgore','swap','general'); +select fn_db_add_config_value('GlusterStorageDeviceListMountPointsToIgnore','/,/home,/boot,/run/gluster/snaps/.*','general'); +select fn_db_add_config_value('GlusterStorageDeviceListFileSystemTypesToIgnore','swap','general'); select fn_db_add_config_value('GlusterDefaultBrickMountPoint','/gluster-bricks','general'); @@ -1070,7 +1070,6 @@ select fn_db_update_default_config_value('VdsmSSLProtocol','SSLv3','TLSv1','general', false); select fn_db_update_default_config_value('ExternalCommunicationProtocol','SSLv3','TLSv1','general', false); - ------------------------------------------------------------------------------------ -- Cleanup deprecated configuration values section ------------------------------------------------------------------------------------ @@ -1126,6 +1125,8 @@ select fn_db_delete_config_value('ProductKeyWindows8x64','general'); select fn_db_delete_config_value('ProductKeyWindows2012x64','general'); select fn_db_delete_config_value('VdsFenceOptionMapping','general'); +select fn_db_delete_config_value('GlusterStorageDeviceListMountPointsToIgore','general'); +select fn_db_delete_config_value('GlusterStorageDeviceListFileSystemTypesToIgore','general'); -- removing power client select fn_db_delete_config_value('PowerClientAllowUsingAsIRS','general'); select fn_db_delete_config_value('PowerClientGUI','general'); -- To view, visit https://gerrit.ovirt.org/42276 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib8e8fa3049e271db8a4919afc72716fb459d22e5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: Ramesh N <rnach...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches