nova_client.py (openstack-cyborg-6.0.0) | : | nova_client.py (openstack-cyborg-7.0.0) | ||
---|---|---|---|---|
skipping to change at line 63 | skipping to change at line 63 | |||
events = [ev for ev in response.json()['events']] | events = [ev for ev in response.json()['events']] | |||
event_codes = {ev['code'] for ev in events} | event_codes = {ev['code'] for ev in events} | |||
if len(event_codes) == 1: # all events have same event code | if len(event_codes) == 1: # all events have same event code | |||
if event_codes == {422}: | if event_codes == {422}: | |||
LOG.info('Ignoring Nova notification error that the ' | LOG.info('Ignoring Nova notification error that the ' | |||
'instance %s is not yet associated with a host.', | 'instance %s is not yet associated with a host.', | |||
events[0]['server_uuid']) | events[0]['server_uuid']) | |||
else: | else: | |||
msg = _('Unexpected event code %(code)s ' | msg = _('Unexpected event code %(code)s ' | |||
'for instance %(inst)s') | 'for instance %(inst)s') | |||
msg = msg % {'code': event_codes[0], | msg = msg % {'code': event_codes.pop(), | |||
'inst': events[0]["server_uuid"]} | 'inst': events[0]["server_uuid"]} | |||
raise exception.InvalidAPIResponse( | raise exception.InvalidAPIResponse( | |||
service='Nova', api=url[1:], msg=msg) | service='Nova', api=url[1:], msg=msg) | |||
else: | else: | |||
msg = _('All event responses are expected to ' | msg = _('All event responses are expected to ' | |||
'have the same event code. Instance: %(inst)s') | 'have the same event code. Instance: %(inst)s') | |||
msg = msg % {'inst': events[0]['server_uuid']} | msg = msg % {'inst': events[0]['server_uuid']} | |||
raise exception.InvalidAPIResponse( | raise exception.InvalidAPIResponse( | |||
service='Nova', api=url[1:], msg=msg) | service='Nova', api=url[1:], msg=msg) | |||
else: | else: | |||
skipping to change at line 86 | skipping to change at line 86 | |||
msg = msg % {'ev': events, | msg = msg % {'ev': events, | |||
'code': response.status_code, | 'code': response.status_code, | |||
'txt': response.text} | 'txt': response.text} | |||
raise exception.InvalidAPIResponse( | raise exception.InvalidAPIResponse( | |||
service='Nova', api=url[1:], msg=msg) | service='Nova', api=url[1:], msg=msg) | |||
def notify_binding(self, instance_uuid, arq_bind_statuses): | def notify_binding(self, instance_uuid, arq_bind_statuses): | |||
"""Notify Nova that ARQ bindings are resolved for a given instance. | """Notify Nova that ARQ bindings are resolved for a given instance. | |||
:param instance_uuid: UUID of the instance whose ARQs are resolved | :param instance_uuid: UUID of the instance whose ARQs are resolved | |||
:param arq_bind_statuses: List of (arq_state, arq_bind_status) tuples | :param arq_bind_statuses: List of (arq_uuid, arq_bind_status) tuples | |||
:returns: None | :returns: None | |||
""" | """ | |||
events = self._get_acc_changed_events(instance_uuid, arq_bind_statuses) | events = self._get_acc_changed_events(instance_uuid, arq_bind_statuses) | |||
self._send_events(events) | self._send_events(events) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |