From 15d85067addf4751494e3f5cfa35e15a50bd8799 Mon Sep 17 00:00:00 2001 From: meenakshidembi691 <83949068+meenakshidembi691@users.noreply.github.com> Date: Mon, 13 May 2024 11:15:23 +0530 Subject: [PATCH 1/9] Create pytest.yml --- .github/workflows/pytest.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..e3a4563 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,28 @@ +name: Run Unit Test via Pytest + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install testtools + pip install requests + pip install pytest + pip install pytest-coverage + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + python -m unittest -v tests/test_*.py From 195d94c3d9455366860aa1eee73570384412eef3 Mon Sep 17 00:00:00 2001 From: Datta Date: Mon, 13 May 2024 20:46:46 +0530 Subject: [PATCH 2/9] Adding support for storagepool parameters --- PyPowerFlex/objects/storage_pool.py | 311 ++++++++++++++++++++++++++++ tests/test_storage_pool.py | 171 ++++++++++++++- 2 files changed, 481 insertions(+), 1 deletion(-) diff --git a/PyPowerFlex/objects/storage_pool.py b/PyPowerFlex/objects/storage_pool.py index 5559377..b62d24c 100644 --- a/PyPowerFlex/objects/storage_pool.py +++ b/PyPowerFlex/objects/storage_pool.py @@ -522,6 +522,317 @@ def set_zero_padding_policy(self, storage_pool_id, zero_padding_enabled): return self.get(entity_id=storage_pool_id) + def set_rep_cap_max_ratio(self, storage_pool_id, rep_cap_max_ratio): + """Set the replication journal capacity ratio on the specified Storage Pool. + + :type storage_pool_id: str + :type rep_cap_max_ratio: bool + :rtype: dict + """ + + action = 'setReplicationJournalCapacity' + + params = dict( + replicationJournalCapacityMaxRatio=rep_cap_max_ratio + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set the replication journal capacity ratio for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + + def set_cap_alert_thresholds(self, storage_pool_id, cap_alert_high_threshold, cap_alert_critical_threshold): + """Set the capacity alert thresholds on the specified Storage Pool. + + :type storage_pool_id: str + :type cap_alert_high_threshold: str + :type cap_alert_critical_threshold: str + :rtype: dict + """ + + action = 'setCapacityAlertThresholds' + + params = dict( + capacityAlertHighThresholdPercent=cap_alert_high_threshold, + capacityAlertCriticalThresholdPercent=cap_alert_critical_threshold + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set the capacity alert thresholds for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + def set_protected_maintenance_mode_io_priority_policy(self, storage_pool_id, policy, concurrent_ios_per_device, bw_limit_per_device): + """Set protected maintenance mode I/O priority policy. + + :type storage_pool_id: str + :type policy: str + :type concurrent_ios_per_device: str + :type bw_limit_per_device: str + :rtype: dict + """ + + action = 'setProtectedMaintenanceModeIoPriorityPolicy' + + params = dict( + policy=policy, + numOfConcurrentIosPerDevice=concurrent_ios_per_device, + bwLimitPerDeviceInKbps=bw_limit_per_device + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set the protected maintenance mode IO priority policy for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + + def set_vtree_migration_io_priority_policy(self, storage_pool_id, policy, concurrent_ios_per_device, bw_limit_per_device): + """Set the vtree migration I/O priority policy on the specified Storage Pool. + + :type storage_pool_id: str + :type policy: str + :type concurrent_ios_per_device: str + :type bw_limit_per_device: str + :rtype: dict + """ + + action = 'setVTreeMigrationIoPriorityPolicy' + + params = dict( + policy=policy, + numOfConcurrentIosPerDevice=concurrent_ios_per_device, + bwLimitPerDeviceInKbps=bw_limit_per_device + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set VTree migration I/O priority policy for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + def rebalance_io_priority_policy(self, storage_pool_id, policy, concurrent_ios_per_device, bw_limit_per_device): + """Set the rebalance I/O priority policy on the specified Storage Pool. + + :type storage_pool_id: str + :type policy: str + :type concurrent_ios_per_device: str + :type bw_limit_per_device: str + :rtype: dict + """ + + action = 'setRebalanceIoPriorityPolicy' + + params = dict( + policy=policy, + numOfConcurrentIosPerDevice=concurrent_ios_per_device, + bwLimitPerDeviceInKbps=bw_limit_per_device + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set the rebalance I/O priority policy for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + def set_rmcache_write_handling_mode(self, storage_pool_id, rmcache_write_handling_mode): + """Set the RM cache write handling mode on the specified Storage Pool. + + :type storage_pool_id: str + :type rmcache_write_handling_mode: str + :rtype: dict + """ + + action = 'setRmcacheWriteHandlingMode' + + params = dict( + rmcacheWriteHandlingMode=rmcache_write_handling_mode + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set the RM cache write handling mode for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + def set_rebuild_rebalance_parallelism_limit(self, storage_pool_id, no_of_parallel_rebuild_rebalance_jobs_per_device): + """Set the rebuild rebalance parallelism limit on the specified Storage Pool. + + :type storage_pool_id: str + :type no_of_parallel_rebuild_rebalance_jobs_per_device: str + :rtype: dict + """ + + action = 'setRebuildRebalanceParallelism' + + params = dict( + limit=no_of_parallel_rebuild_rebalance_jobs_per_device + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set rebuild rebalance parallelism limit for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + def set_persistent_checksum(self, storage_pool_id, enable, validate, builder_limit): + """Set the persistent_checksum on the specified Storage Pool. + + :type storage_pool_id: str + :type enable: bool + :type validate: bool + :type builder_limit: str + :rtype: dict + """ + + action = 'disablePersistentChecksum' + params = None + if enable is True: + action='enablePersistentChecksum' + params = dict( + validateOnRead=validate, + builderLimitInKb=builder_limit + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to set the persistent checksum for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + + def modify_persistent_checksum(self, storage_pool_id, validate, builder_limit): + """Modify the persistent_checksum on the specified Storage Pool. + + :type storage_pool_id: str + :type validate: bool + :type builder_limit: str + :rtype: dict + """ + + action = 'modifyPersistentChecksum' + params = dict( + validateOnRead=validate, + builderLimitInKb=builder_limit + ) + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id, + params=params) + if r.status_code != requests.codes.ok: + msg = ('Failed to modify the persistent checksum for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + + def set_fragmentation_enabled(self, storage_pool_id, enable_fragmentation): + """Enable/Disable the fragmentation on the specified Storage Pool. + + :type storage_pool_id: str + :type enable_fragmentation: bool + :rtype: dict + """ + + action = 'disableFragmentation' + if enable_fragmentation: + action = 'enableFragmentation' + + + r, response = self.send_post_request(self.base_action_url, + action=action, + entity=self.entity, + entity_id=storage_pool_id) + if r.status_code != requests.codes.ok: + msg = ('Failed to enable/disable fragmentation for PowerFlex {entity} ' + 'with id {_id}. Error: {response}' + .format(entity=self.entity, _id=storage_pool_id, + response=response)) + LOG.error(msg) + raise exceptions.PowerFlexClientException(msg) + + return self.get(entity_id=storage_pool_id) + def query_selected_statistics(self, properties, ids=None): """Query PowerFlex storage pool statistics. diff --git a/tests/test_storage_pool.py b/tests/test_storage_pool.py index e04e1aa..02ca25d 100644 --- a/tests/test_storage_pool.py +++ b/tests/test_storage_pool.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Dell Inc. or its subsidiaries. +# Copyright (c) 2020-24 Dell Inc. or its subsidiaries. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -86,6 +86,41 @@ def setUp(self): '/instances/StoragePool::{}' '/action/setZeroPaddingPolicy'.format(self.fake_sp_id): {}, + + + '/instances/StoragePool::{}' + '/action/setReplicationJournalCapacity'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/setCapacityAlertThresholds'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/setProtectedMaintenanceModeIoPriorityPolicy'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/setVTreeMigrationIoPriorityPolicy'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/setRebalanceIoPriorityPolicy'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/setRmcacheWriteHandlingMode'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/setRebuildRebalanceParallelism'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/disablePersistentChecksum'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/enablePersistentChecksum'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/disableFragmentation'.format(self.fake_sp_id): + {}, + '/instances/StoragePool::{}' + '/action/enableFragmentation'.format(self.fake_sp_id): + {}, '/types/StoragePool' '/instances/action/querySelectedStatistics': { self.fake_sp_id: {'rfcacheWritesSkippedCacheMiss': 0} @@ -333,6 +368,140 @@ def test_storage_pool_set_zero_padding_policy_bad_status(self): zero_padding_enabled=True ) + def test_storage_pool_set_rep_cap_max_ratio(self): + self.client.storage_pool.set_rep_cap_max_ratio( + self.fake_sp_id, + rep_cap_max_ratio=60 + ) + + def test_storage_pool_set_rep_cap_max_ratio_bad_status(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_rep_cap_max_ratio, + self.fake_sp_id, + rep_cap_max_ratio=60 + ) + + def test_storage_pool_set_cap_alert_thresholds(self): + self.client.storage_pool.set_cap_alert_thresholds( + self.fake_sp_id, + cap_alert_high_threshold=20, + cap_alert_critical_threshold=60 + ) + + def test_storage_pool_set_cap_alert_thresholds_bad_status(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_cap_alert_thresholds, + self.fake_sp_id, + cap_alert_high_threshold=20, + cap_alert_critical_threshold=60 + ) + + def test_storage_pool_set_protected_maintenance_mode_io_priority_policy(self): + self.client.storage_pool.set_protected_maintenance_mode_io_priority_policy( + self.fake_sp_id, + policy='unlimited', + concurrent_ios_per_device='4', + bw_limit_per_device="2048" + ) + + def test_storage_pool_set_protected_maintenance_mode_io_priority_policy(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_protected_maintenance_mode_io_priority_policy, + self.fake_sp_id, + policy='unlimited', + concurrent_ios_per_device='4', + bw_limit_per_device="2048" + ) + + def test_storage_pool_set_vtree_migration_io_priority_policy(self): + self.client.storage_pool.set_vtree_migration_io_priority_policy( + self.fake_sp_id, + policy='unlimited', + concurrent_ios_per_device='4', + bw_limit_per_device="2048" + ) + + def test_storage_pool_set_vtree_migration_io_priority_policy_bad_status(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_vtree_migration_io_priority_policy, + self.fake_sp_id, + policy='unlimited', + concurrent_ios_per_device='4', + bw_limit_per_device="2048" + ) + + def test_storage_pool_set_rmcache_write_handling_mode(self): + self.client.storage_pool.set_rmcache_write_handling_mode( + self.fake_sp_id, + rmcache_write_handling_mode="Passthrough" + ) + + def test_storage_pool_set_rmcache_write_handling_mode_bad_status(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_rmcache_write_handling_mode, + self.fake_sp_id, + rmcache_write_handling_mode="Passthrough" + ) + + def test_storage_pool_set_rebuild_rebalance_parallelism_limit(self): + self.client.storage_pool.set_rebuild_rebalance_parallelism_limit( + self.fake_sp_id, + no_of_parallel_rebuild_rebalance_jobs_per_device="3" + ) + + def test_storage_pool_set_rebuild_rebalance_parallelism_limit_bad_status(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_rebuild_rebalance_parallelism_limit, + self.fake_sp_id, + no_of_parallel_rebuild_rebalance_jobs_per_device="3" + ) + + def test_storage_pool_set_persistent_checksum(self): + self.client.storage_pool.set_persistent_checksum( + self.fake_sp_id, + enable=True, + validate=True, + builder_limit="2048" + ) + + def test_storage_pool_set_persistent_checksum_bad_status(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_persistent_checksum, + self.fake_sp_id, + enable=True, + validate=True, + builder_limit="2048" + ) + + def test_storage_pool_set_fragmentation_enabled(self): + self.client.storage_pool.set_fragmentation_enabled( + self.fake_sp_id, + enable_fragmentation=True + ) + + def test_storage_pool_set_fragmentation_enabled_bad_status(self): + with self.http_response_mode(self.RESPONSE_MODE.BadStatus): + self.assertRaises( + exceptions.PowerFlexClientException, + self.client.storage_pool.set_fragmentation_enabled, + self.fake_sp_id, + enable_fragmentation=True + ) + def test_storage_pool_query_selected_statistics(self): ret = self.client.storage_pool.query_selected_statistics( properties=["rfcacheWritesSkippedCacheMiss"] From 3a181e1b38a99aa888713875986dd527530523bc Mon Sep 17 00:00:00 2001 From: meenakshidembi691 <83949068+meenakshidembi691@users.noreply.github.com> Date: Wed, 22 May 2024 16:01:52 +0530 Subject: [PATCH 3/9] Update pytest.yml --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index e3a4563..657fe71 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10"] + python-version: ['3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 From e6de37dca53d4c0b24699003655ecc8d8440e476 Mon Sep 17 00:00:00 2001 From: Datta Date: Wed, 22 May 2024 21:22:39 +0530 Subject: [PATCH 4/9] Addressing review comments --- PyPowerFlex/objects/storage_pool.py | 127 +++++++++------------------- 1 file changed, 42 insertions(+), 85 deletions(-) diff --git a/PyPowerFlex/objects/storage_pool.py b/PyPowerFlex/objects/storage_pool.py index b62d24c..85e8367 100644 --- a/PyPowerFlex/objects/storage_pool.py +++ b/PyPowerFlex/objects/storage_pool.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Dell Inc. or its subsidiaries. +# Copyright (c) 2020-24 Dell Inc. or its subsidiaries. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -228,10 +228,8 @@ def set_checksum_enabled(self, storage_pool_id, checksum_enabled): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to enable/disable checksum for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to enable/disable checksum for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -257,10 +255,8 @@ def set_compression_method(self, storage_pool_id, compression_method): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set compression method for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set compression method for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -302,10 +298,8 @@ def set_external_acceleration_type( entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set external acceleration type for PowerFlex ' - '{entity} with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set external acceleration type for PowerFlex ' + f'{self.entity} with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -337,11 +331,8 @@ def set_media_type(self, entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set media type for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) - + msg = (f'Failed to set media type for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -367,10 +358,9 @@ def set_rebalance_enabled(self, storage_pool_id, rebalance_enabled): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to enable/disable rebalance for PowerFlex {entity}' - ' with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to enable/disable rebalance for PowerFlex {self.entity}' + ' with id {storage_pool_id}. Error: {response}' + ) LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -396,10 +386,8 @@ def set_rebuild_enabled(self, storage_pool_id, rebuild_enabled): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to enable/disable rebuild for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to enable/disable rebuild for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -425,11 +413,8 @@ def set_spare_percentage(self, storage_pool_id, spare_percentage): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set spare percentage for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) - + msg = (f'Failed to set spare percentage for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -452,11 +437,8 @@ def set_use_rfcache(self, storage_pool_id, use_rfcache): entity=self.entity, entity_id=storage_pool_id) if r.status_code != requests.codes.ok: - msg = ('Failed to set Rfcache usage for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) - + msg = (f'Failed to set Rfcache usage for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -482,11 +464,8 @@ def set_use_rmcache(self, storage_pool_id, use_rmcache): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set Rmcache usage for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) - + msg = (f'Failed to set Rmcache usage for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -513,10 +492,8 @@ def set_zero_padding_policy(self, storage_pool_id, zero_padding_enabled): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set Zero Padding policy for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set Zero Padding policy for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -542,10 +519,8 @@ def set_rep_cap_max_ratio(self, storage_pool_id, rep_cap_max_ratio): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set the replication journal capacity ratio for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set the replication journal capacity ratio for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -574,10 +549,8 @@ def set_cap_alert_thresholds(self, storage_pool_id, cap_alert_high_threshold, ca entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set the capacity alert thresholds for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set the capacity alert thresholds for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -607,10 +580,8 @@ def set_protected_maintenance_mode_io_priority_policy(self, storage_pool_id, pol entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set the protected maintenance mode IO priority policy for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set the protected maintenance mode IO priority policy for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -641,10 +612,8 @@ def set_vtree_migration_io_priority_policy(self, storage_pool_id, policy, concur entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set VTree migration I/O priority policy for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set VTree migration I/O priority policy for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -674,10 +643,8 @@ def rebalance_io_priority_policy(self, storage_pool_id, policy, concurrent_ios_p entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set the rebalance I/O priority policy for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set the rebalance I/O priority policy for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -703,10 +670,8 @@ def set_rmcache_write_handling_mode(self, storage_pool_id, rmcache_write_handlin entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set the RM cache write handling mode for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set the RM cache write handling mode for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -732,10 +697,8 @@ def set_rebuild_rebalance_parallelism_limit(self, storage_pool_id, no_of_paralle entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set rebuild rebalance parallelism limit for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set rebuild rebalance parallelism limit for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -766,10 +729,8 @@ def set_persistent_checksum(self, storage_pool_id, enable, validate, builder_lim entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to set the persistent checksum for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to set the persistent checksum for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -797,10 +758,8 @@ def modify_persistent_checksum(self, storage_pool_id, validate, builder_limit): entity_id=storage_pool_id, params=params) if r.status_code != requests.codes.ok: - msg = ('Failed to modify the persistent checksum for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to modify the persistent checksum for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) @@ -824,10 +783,8 @@ def set_fragmentation_enabled(self, storage_pool_id, enable_fragmentation): entity=self.entity, entity_id=storage_pool_id) if r.status_code != requests.codes.ok: - msg = ('Failed to enable/disable fragmentation for PowerFlex {entity} ' - 'with id {_id}. Error: {response}' - .format(entity=self.entity, _id=storage_pool_id, - response=response)) + msg = (f'Failed to enable/disable fragmentation for PowerFlex {self.entity} ' + f'with id {storage_pool_id}. Error: {response}') LOG.error(msg) raise exceptions.PowerFlexClientException(msg) From 3d960fa9b69df181fea8b842f6743591ecd97c72 Mon Sep 17 00:00:00 2001 From: meenakshidembi691 <83949068+meenakshidembi691@users.noreply.github.com> Date: Thu, 23 May 2024 16:40:34 +0530 Subject: [PATCH 5/9] Update pytest.yml --- .github/workflows/pytest.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 657fe71..904a803 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -25,4 +25,5 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | - python -m unittest -v tests/test_*.py + # python -m unittest -v tests/test_*.py + pytest tests/test_*.py From fb357229cbd8d355d57a87ea358f5beb0b3651d2 Mon Sep 17 00:00:00 2001 From: meenakshidembi691 <83949068+meenakshidembi691@users.noreply.github.com> Date: Thu, 23 May 2024 17:01:43 +0530 Subject: [PATCH 6/9] Update pytest.yml --- .github/workflows/pytest.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 904a803..657fe71 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -25,5 +25,4 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | - # python -m unittest -v tests/test_*.py - pytest tests/test_*.py + python -m unittest -v tests/test_*.py From cfe5a62cd11f821028895498c365e7e4c9e1fecc Mon Sep 17 00:00:00 2001 From: meenakshidembi691 <83949068+meenakshidembi691@users.noreply.github.com> Date: Fri, 24 May 2024 13:54:01 +0530 Subject: [PATCH 7/9] Update pytest.yml --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 657fe71..0fa0157 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11', 3.12] steps: - uses: actions/checkout@v3 From 2cfee82e042cbe5bae45c4f77622dcdc91dac38c Mon Sep 17 00:00:00 2001 From: Datta Date: Fri, 24 May 2024 14:25:13 +0530 Subject: [PATCH 8/9] Updating docs --- ChangeLog.md | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 395fdcd..8e0cc93 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,8 @@ # PyPowerFlex Change Log +## Version 1.12.0 - released on 31/05/24 +- Enhanced the storage pool module by adding support for more functionalities. + ## Version 1.11.0 - released on 30/04/24 - Added support to query selected statistics to all relevant objects/entities from PowerFlex Manager. diff --git a/setup.py b/setup.py index 4b51ef0..4b8d21c 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ setup( name='PyPowerFlex', - version='1.11.0', + version='1.12.0', description='Python library for Dell PowerFlex', author='Ansible Team at Dell', author_email='ansible.team@dell.com', From 4843ca872fb59d8e96e4f8aa36219795ee5351a7 Mon Sep 17 00:00:00 2001 From: meenakshidembi691 <83949068+meenakshidembi691@users.noreply.github.com> Date: Fri, 24 May 2024 16:47:23 +0530 Subject: [PATCH 9/9] Update pytest.yml --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 0fa0157..faed19e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', 3.12] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3