diff --git a/distributedcloud/dcmanager/api/controllers/v1/subclouds.py b/distributedcloud/dcmanager/api/controllers/v1/subclouds.py index ec024e73e..1f22d08bc 100644 --- a/distributedcloud/dcmanager/api/controllers/v1/subclouds.py +++ b/distributedcloud/dcmanager/api/controllers/v1/subclouds.py @@ -609,8 +609,7 @@ class SubcloudsController(object): consts.STATES_FOR_SUBCLOUD_RENAME): msg = ( 'Subcloud %s must be unmanaged and in a valid deploy state ' - 'for the subcloud rename operation.' % - subcloud.name + 'for the subcloud rename operation.' % subcloud.name ) pecan.abort(400, msg) diff --git a/distributedcloud/dcmanager/cmd/manager.py b/distributedcloud/dcmanager/cmd/manager.py index 9873906e5..4df473d29 100644 --- a/distributedcloud/dcmanager/cmd/manager.py +++ b/distributedcloud/dcmanager/cmd/manager.py @@ -21,6 +21,8 @@ DC Manager Engine Server. import eventlet +eventlet.monkey_patch() + # pylint: disable=wrong-import-position from oslo_config import cfg # noqa: E402 from oslo_i18n import _lazy # noqa: E402 @@ -33,7 +35,6 @@ from dcmanager.common import messaging # noqa: E402 from dcorch.common import messaging as dcorch_messaging # noqa: E402 # pylint: enable=wrong-import-position -eventlet.monkey_patch() _lazy.enable_lazy() config.register_options() config.register_keystone_options() diff --git a/distributedcloud/dcmanager/common/phased_subcloud_deploy.py b/distributedcloud/dcmanager/common/phased_subcloud_deploy.py index ed97cb488..549b3bf51 100644 --- a/distributedcloud/dcmanager/common/phased_subcloud_deploy.py +++ b/distributedcloud/dcmanager/common/phased_subcloud_deploy.py @@ -379,10 +379,10 @@ def validate_admin_network_config(admin_subnet_str, LOG.exception(e) pecan.abort(400, _("admin_end_address invalid: %s") % e) - if admin_start_ip > admin_end_ip: + if admin_start_ip >= admin_end_ip: pecan.abort( 400, - _("admin_start_address greater than " + _("admin_start_address greater than or equal to " "admin_end_address")) if len(netaddr.IPRange(admin_start_ip, admin_end_ip)) < \ diff --git a/distributedcloud/dcmanager/common/utils.py b/distributedcloud/dcmanager/common/utils.py index 8310d9741..1d137a215 100644 --- a/distributedcloud/dcmanager/common/utils.py +++ b/distributedcloud/dcmanager/common/utils.py @@ -1397,9 +1397,7 @@ def get_sw_version(release=None): def validate_release_version_supported(release_version_to_check): - """Given a release version, check whether it's supported by the current active - - version. + """Check if a release version is supported by the current active version. :param release_version_to_check: version string to validate diff --git a/distributedcloud/dcmanager/manager/peer_group_audit_manager.py b/distributedcloud/dcmanager/manager/peer_group_audit_manager.py index 882f91bfd..fc11a7dc2 100644 --- a/distributedcloud/dcmanager/manager/peer_group_audit_manager.py +++ b/distributedcloud/dcmanager/manager/peer_group_audit_manager.py @@ -161,7 +161,7 @@ class PeerGroupAuditManager(manager.Manager): # get remote subclouds. For 'managed+online' subclouds, # set 'unmanaged+secondary' to local on same subclouds elif remote_peer_group.get("migration_status") == \ - consts.PEER_GROUP_MIGRATION_COMPLETE or self.require_audit_flag: + consts.PEER_GROUP_MIGRATION_COMPLETE: remote_subclouds = \ self._get_subclouds_by_peer_group_from_system_peer( system_peer, diff --git a/distributedcloud/dcmanager/manager/peer_monitor_manager.py b/distributedcloud/dcmanager/manager/peer_monitor_manager.py index 57de89db1..c7a12d4eb 100644 --- a/distributedcloud/dcmanager/manager/peer_monitor_manager.py +++ b/distributedcloud/dcmanager/manager/peer_monitor_manager.py @@ -194,9 +194,7 @@ class PeerMonitor(object): return msg def _clean_peer_group_audit_threads(self): - for peer_group_id, _ in self.peer_group_audit_obj_map.items(): - pgam_obj = \ - self.peer_group_audit_obj_map[peer_group_id] + for pgam_obj in self.peer_group_audit_obj_map.values(): pgam_obj.stop() self.peer_group_audit_obj_map.clear() diff --git a/distributedcloud/dcmanager/orchestrator/states/firmware/utils.py b/distributedcloud/dcmanager/orchestrator/states/firmware/utils.py index f0b49fe1e..ebabc648a 100644 --- a/distributedcloud/dcmanager/orchestrator/states/firmware/utils.py +++ b/distributedcloud/dcmanager/orchestrator/states/firmware/utils.py @@ -106,7 +106,7 @@ def determine_image_fields(image): 'bmc', 'retimer_included'] fields = dict((k, str(v)) for (k, v) in vars(image).items() - if k in field_list and v) + if k in field_list and v is not None) return fields diff --git a/distributedcloud/dcmanager/orchestrator/states/software/deploy_start.py b/distributedcloud/dcmanager/orchestrator/states/software/deploy_start.py index 8dc0d88b7..1b4b88fcb 100644 --- a/distributedcloud/dcmanager/orchestrator/states/software/deploy_start.py +++ b/distributedcloud/dcmanager/orchestrator/states/software/deploy_start.py @@ -42,8 +42,8 @@ class DeployStartState(BaseState): # Find the max version deployed on the SystemController max_version = None - for release_id, _ in deployed_releases.items(): - release_sw_version = deployed_releases[release_id]['sw_version'] + for deployed_releases_values in deployed_releases.values(): + release_sw_version = deployed_releases_values['sw_version'] if max_version is None or release_sw_version > max_version: max_version = release_sw_version diff --git a/distributedcloud/dcmanager/orchestrator/states/software/finish_strategy.py b/distributedcloud/dcmanager/orchestrator/states/software/finish_strategy.py index 3cc6230f2..14a5f9607 100644 --- a/distributedcloud/dcmanager/orchestrator/states/software/finish_strategy.py +++ b/distributedcloud/dcmanager/orchestrator/states/software/finish_strategy.py @@ -68,9 +68,8 @@ class FinishStrategyState(BaseState): try: software_client.delete(releases_to_delete) except Exception: - message = \ - ("Cannot delete releases from subcloud. Please see logs for" - " details.") + message = ("Cannot delete releases from subcloud. Please see " + "logs for details.") self.exception_log(strategy_step, message) raise Exception(message) diff --git a/distributedcloud/dcmanager/orchestrator/states/software/upload.py b/distributedcloud/dcmanager/orchestrator/states/software/upload.py index ce4b74432..24b515842 100644 --- a/distributedcloud/dcmanager/orchestrator/states/software/upload.py +++ b/distributedcloud/dcmanager/orchestrator/states/software/upload.py @@ -136,8 +136,8 @@ class UploadState(BaseState): potential_missing_patches) if missing_patches: - message = \ - (f"Release files {missing_patches} are missing") + message = (f"Release files {missing_patches} " + "are missing") self.error_log(strategy_step, message) raise Exception(message) break @@ -150,8 +150,8 @@ class UploadState(BaseState): else: # No load was uploaded therefore the patches are really missing. if potential_missing_patches: - message = \ - (f"Release files {potential_missing_patches} are missing") + message = (f"Release files {potential_missing_patches} " + "are missing") self.error_log(strategy_step, message) raise Exception(message) diff --git a/distributedcloud/dcmanager/orchestrator/states/upgrade/pre_check.py b/distributedcloud/dcmanager/orchestrator/states/upgrade/pre_check.py index da4277459..8815233ce 100644 --- a/distributedcloud/dcmanager/orchestrator/states/upgrade/pre_check.py +++ b/distributedcloud/dcmanager/orchestrator/states/upgrade/pre_check.py @@ -44,9 +44,8 @@ class PreCheckState(BaseState): next_state=consts.STRATEGY_STATE_INSTALLING_LICENSE, region_name=region_name) - def _check_health( - self, strategy_step, subcloud_sysinv_client, subcloud_fm_client, - host, upgrades): + def _check_health(self, strategy_step, subcloud_sysinv_client, + subcloud_fm_client, host, upgrades): # Check system upgrade health # diff --git a/distributedcloud/dcmanager/orchestrator/states/upgrade/upgrading_simplex.py b/distributedcloud/dcmanager/orchestrator/states/upgrade/upgrading_simplex.py index 44fd9607d..c65187d10 100644 --- a/distributedcloud/dcmanager/orchestrator/states/upgrade/upgrading_simplex.py +++ b/distributedcloud/dcmanager/orchestrator/states/upgrade/upgrading_simplex.py @@ -243,8 +243,8 @@ class UpgradingSimplexState(BaseState): return upgrade_data_install - def _get_subcloud_upgrade_data( - self, strategy_step, subcloud_sysinv_client, subcloud_barbican_client): + def _get_subcloud_upgrade_data(self, strategy_step, subcloud_sysinv_client, + subcloud_barbican_client): """Get the subcloud data required for upgrades. In case the subcloud is no longer reachable, get upgrade_data from