Fix peer-group-association sync_message
The current message prints the error_msg.keys() directly, which returns a dict_keys object. This commit fix the SPA sync_message by casting it to a list. This commit also fixes a log message where the subcloud name and peer name order was inverted. Test Plan: 1. PASS - Try to sync a PGA that has the rehome-failed state in the non-primary site, causing the sync to fail. Verify that the sync_message prints the subcloud list without including the 'dict_keys' string; 2. PASS - Introduce an error during the _delete_subcloud() function and then try to delete the peer group association. Verify that the sync_message prints the subcloud list without including the 'dict_keys' string; 3. PASS - During SPG migration, verify that the modified log message prints the subcloud name and peer site name in the correct order. Closes-Bug: 2057934 Change-Id: Idfdc2cc1731a51c6098a06863b2469c3085aa813 Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
This commit is contained in:
parent
23f8df88ec
commit
0e24a87afb
@ -532,11 +532,12 @@ class SubcloudManager(manager.Manager):
|
|||||||
|
|
||||||
# Check if it's already in the correct state
|
# Check if it's already in the correct state
|
||||||
if is_unmanaged and is_rehome_pending:
|
if is_unmanaged and is_rehome_pending:
|
||||||
LOG.info("Remote subcloud %s from system peer %s is "
|
LOG.info(
|
||||||
"already unmanaged and rehome-pending, "
|
f"Remote subcloud {remote_subcloud.get('name')} "
|
||||||
"skipping unmanage attempt"
|
f"from system peer {system_peer.peer_name} is "
|
||||||
% (system_peer.peer_name,
|
"already unmanaged and rehome-pending, "
|
||||||
remote_subcloud.get('name')))
|
"skipping unmanage attempt"
|
||||||
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -808,8 +808,8 @@ class SystemPeerManager(manager.Manager):
|
|||||||
association_update['sync_status'] = \
|
association_update['sync_status'] = \
|
||||||
consts.ASSOCIATION_SYNC_STATUS_FAILED
|
consts.ASSOCIATION_SYNC_STATUS_FAILED
|
||||||
association_update['sync_message'] = \
|
association_update['sync_message'] = \
|
||||||
(f"Failed to sync {error_msg.keys()} in the Subcloud "
|
(f"Failed to sync {list(error_msg.keys())} in the "
|
||||||
f"Peer Group {peer_group_name}.")
|
f"Subcloud Peer Group {peer_group_name}.")
|
||||||
association = self._update_sync_status(
|
association = self._update_sync_status(
|
||||||
context, association_id, **association_update)
|
context, association_id, **association_update)
|
||||||
|
|
||||||
@ -899,9 +899,9 @@ class SystemPeerManager(manager.Manager):
|
|||||||
LOG.error(f"Failed to delete subcloud(s) from "
|
LOG.error(f"Failed to delete subcloud(s) from "
|
||||||
f"the Subcloud Peer Group {peer_group_name} "
|
f"the Subcloud Peer Group {peer_group_name} "
|
||||||
f"on peer site: {json.dumps(delete_error_msg)}")
|
f"on peer site: {json.dumps(delete_error_msg)}")
|
||||||
sync_message = (f"Deletion of {delete_error_msg.keys()} from "
|
sync_message = (f"Deletion of {list(delete_error_msg.keys())} "
|
||||||
f"the Subcloud Peer Group {peer_group_name} "
|
"from the Subcloud Peer Group "
|
||||||
f"on the peer site failed.")
|
f"{peer_group_name} on the peer site failed.")
|
||||||
self._update_sync_status_to_failed(context, association_id,
|
self._update_sync_status_to_failed(context, association_id,
|
||||||
sync_message)
|
sync_message)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user