Don't create deployment when changing transport

Earlier when changing software config transport we used to
create a dummy deployment to push the metadata. However
this would not work with convergence as we take
resource lock for the update which updates the config
transport (another engine would try to update the resource
metadata for deployment when one engine has locked it).

Currently it works when updating transport as we ignore
the error in creating dummy deployment, but if there are
any new depoyments for the server they would fail.

We don't need to push the metadata as it would be pushed
when the there is a new/updated deployment.

Few additional changes in the patch:

- We don't need to ignore the error as servers are now
not replaced if the resource is in ERROR when nova server
is good/ACTIVE.
- Delete the existing tempurls and zaqar queues when
  changing transport.

Task: 41744
Change-Id: Id592b29df36320d8697bd370252ada02612ba7d0
(cherry picked from commit 79fb6509a9)
This commit is contained in:
ramishra 2021-02-03 09:42:20 +05:30 committed by Brendan Shephard
parent 40a3494c86
commit 86354c2d7d
1 changed files with 9 additions and 22 deletions

View File

@ -241,29 +241,14 @@ class BaseServer(stack_user.StackUser):
if not self.user_data_software_config():
return
try:
metadata = self.metadata_get(True) or {}
self._create_transport_credentials(prop_diff)
self._populate_deployments_metadata(metadata, prop_diff)
# push new metadata to all sources by creating a dummy
# deployment
sc = self.rpc_client().create_software_config(
self.context, 'ignored', 'ignored', '')
sd = self.rpc_client().create_software_deployment(
self.context, self.resource_id, sc['id'])
self.rpc_client().delete_software_deployment(
self.context, sd['id'])
self.rpc_client().delete_software_config(
self.context, sc['id'])
self._delete_queue()
self._delete_temp_url()
except Exception:
# Updating the software config transport is on a best-effort
# basis as any raised exception here would result in the resource
# going into an ERROR state, which will be replaced on the next
# stack update. This is not desirable for a server. The old
# transport will continue to work, and the new transport may work
# despite exceptions in the above block.
LOG.exception(
'Error while updating software config transport'
)
pass
metadata = self.metadata_get(True) or {}
self._create_transport_credentials(prop_diff)
self._populate_deployments_metadata(metadata, prop_diff)
def metadata_update(self, new_metadata=None):
"""Refresh the metadata if new_metadata is None."""
@ -300,6 +285,8 @@ class BaseServer(stack_user.StackUser):
headers = swift.head_container(container)
if int(headers['x-container-object-count']) == 0:
swift.delete_container(container)
self.data_delete('metadata_object_name')
self.data_delete('metadata_put_url')
def _delete_queue(self):
queue_id = self.data().get('metadata_queue_id')