diff --git a/releasenotes/notes/consume-nova-versioned-notifications-f98361b37e546b4d.yaml b/releasenotes/notes/consume-nova-versioned-notifications-f98361b37e546b4d.yaml new file mode 100644 index 000000000..0916b4e58 --- /dev/null +++ b/releasenotes/notes/consume-nova-versioned-notifications-f98361b37e546b4d.yaml @@ -0,0 +1,60 @@ +--- +features: + - | + Watcher consumes Nova notifications to update its internal + Compute CDM(Cluster Data Model). + All the notifications as below + + pre-existing: + + * service.update + + * instance.update + + * instance.delete.end + + new: + + * instance.lock + + * instance.unlock + + * instance.pause.end + + * instance.power_off.end + + * instance.power_on.end + + * instance.resize_confirm.end + + * instance.restore.end + + * instance.resume.end + + * instance.shelve.end + + * instance.shutdown.end + + * instance.suspend.end + + * instance.unpause.end + + * instance.unrescue.end + + * instance.unshelve.end + + * instance.rebuild.end + + * instance.rescue.end + + * instance.create.end + + * instance.live_migration_force_complete.end + + * instance.live_migration_post_dest.end + + * instance.soft_delete.end + + * service.create + + * service.delete diff --git a/watcher/decision_engine/model/collector/nova.py b/watcher/decision_engine/model/collector/nova.py index 7ad311c9f..ae15a49c0 100644 --- a/watcher/decision_engine/model/collector/nova.py +++ b/watcher/decision_engine/model/collector/nova.py @@ -159,11 +159,7 @@ class NovaClusterDataModelCollector(base.BaseClusterDataModelCollector): :rtype: List of :py:class:`~.EventsNotificationEndpoint` instances """ return [ - nova.ServiceUpdated(self), - - nova.InstanceCreated(self), - nova.InstanceUpdated(self), - nova.InstanceDeletedEnd(self), + nova.VersionedNotification(self), ] def get_audit_scope_handler(self, audit_scope): @@ -354,7 +350,8 @@ class ModelBuilder(object): "vcpus": flavor["vcpus"], "state": getattr(instance, "OS-EXT-STS:vm_state"), "metadata": instance.metadata, - "project_id": instance.tenant_id} + "project_id": instance.tenant_id, + "locked": instance.locked} # node_attributes = dict() # node_attributes["layer"] = "virtual" diff --git a/watcher/decision_engine/model/element/instance.py b/watcher/decision_engine/model/element/instance.py index c0ef7dcaa..3d631c750 100644 --- a/watcher/decision_engine/model/element/instance.py +++ b/watcher/decision_engine/model/element/instance.py @@ -30,6 +30,7 @@ class InstanceState(enum.Enum): RESCUED = 'rescued' # A rescue image is running with the original image # attached. RESIZED = 'resized' # an Instance with the new size is active. + SHELVED = 'shelved' SOFT_DELETED = 'soft-delete' # still available to restore. @@ -53,6 +54,7 @@ class Instance(compute_resource.ComputeResource): "vcpus": wfields.NonNegativeIntegerField(), "metadata": wfields.JsonField(), "project_id": wfields.UUIDField(), + "locked": wfields.BooleanField(default=False), } def accept(self, visitor): diff --git a/watcher/decision_engine/model/notification/nova.py b/watcher/decision_engine/model/notification/nova.py index b55566517..48b6ac454 100644 --- a/watcher/decision_engine/model/notification/nova.py +++ b/watcher/decision_engine/model/notification/nova.py @@ -59,6 +59,7 @@ class NovaNotification(base.NotificationEndpoint): return instance def update_instance(self, instance, data): + n_version = float(data['nova_object.version']) instance_data = data['nova_object.data'] instance_flavor_data = instance_data['flavor']['nova_object.data'] @@ -78,6 +79,9 @@ class NovaNotification(base.NotificationEndpoint): 'metadata': instance_metadata, 'project_id': instance_data['tenant_id'] }) + # locked was added in nova notification payload version 1.1 + if n_version > 1.0: + instance.update({'locked': instance_data['locked']}) try: node = self.get_or_create_node(instance_data['host']) @@ -181,30 +185,17 @@ class NovaNotification(base.NotificationEndpoint): except Exception: LOG.info("Instance %s already deleted", instance.uuid) - -class VersionedNotificationEndpoint(NovaNotification): - publisher_id_regex = r'^nova-compute.*' + def delete_node(self, node): + try: + self.cluster_data_model.remove_node(node) + except Exception: + LOG.info("Node %s already deleted", node.uuid) -class ServiceUpdated(VersionedNotificationEndpoint): +class VersionedNotification(NovaNotification): + publisher_id_regex = r'^nova-.*' - @property - def filter_rule(self): - """Nova service.update notification filter""" - return filtering.NotificationFilter( - publisher_id=self.publisher_id_regex, - event_type='service.update', - ) - - def info(self, ctxt, publisher_id, event_type, payload, metadata): - ctxt.request_id = metadata['message_id'] - ctxt.project_domain = event_type - LOG.info("Event '%(event)s' received from %(publisher)s " - "with metadata %(metadata)s", - dict(event=event_type, - publisher=publisher_id, - metadata=metadata)) - LOG.debug(payload) + def service_updated(self, payload): node_data = payload['nova_object.data'] node_uuid = node_data['host'] try: @@ -213,44 +204,16 @@ class ServiceUpdated(VersionedNotificationEndpoint): except exception.ComputeNodeNotFound as exc: LOG.exception(exc) + def service_deleted(self, payload): + node_data = payload['nova_object.data'] + node_uuid = node_data['host'] + try: + node = self.get_or_create_node(node_uuid) + self.delete_node(node) + except exception.ComputeNodeNotFound as exc: + LOG.exception(exc) -class InstanceCreated(VersionedNotificationEndpoint): - - @property - def filter_rule(self): - """Nova instance.update notification filter""" - return filtering.NotificationFilter( - publisher_id=self.publisher_id_regex, - event_type='instance.update', - # To be "fully" created, an instance transitions - # from the 'building' state to the 'active' one. - # See https://docs.openstack.org/nova/latest/reference/ - # vm-states.html - - payload={ - 'nova_object.data': { - 'state': element.InstanceState.ACTIVE.value, - 'state_update': { - 'nova_object.data': { - 'old_state': element.InstanceState.BUILDING.value, - 'state': element.InstanceState.ACTIVE.value, - }, - 'nova_object.name': 'InstanceStateUpdatePayload', - 'nova_object.namespace': 'nova', - }, - } - } - ) - - def info(self, ctxt, publisher_id, event_type, payload, metadata): - ctxt.request_id = metadata['message_id'] - ctxt.project_domain = event_type - LOG.info("Event '%(event)s' received from %(publisher)s " - "with metadata %(metadata)s", - dict(event=event_type, - publisher=publisher_id, - metadata=metadata)) - LOG.debug(payload) + def instance_updated(self, payload): instance_data = payload['nova_object.data'] instance_uuid = instance_data['uuid'] node_uuid = instance_data.get('host') @@ -258,62 +221,7 @@ class InstanceCreated(VersionedNotificationEndpoint): self.update_instance(instance, payload) - -class InstanceUpdated(VersionedNotificationEndpoint): - - @staticmethod - def _match_not_new_instance_state(data): - is_new_instance = ( - data['old_state'] == element.InstanceState.BUILDING.value and - data['state'] == element.InstanceState.ACTIVE.value) - - return not is_new_instance - - @property - def filter_rule(self): - """Nova instance.update notification filter""" - return filtering.NotificationFilter( - publisher_id=self.publisher_id_regex, - event_type='instance.update', - ) - - def info(self, ctxt, publisher_id, event_type, payload, metadata): - ctxt.request_id = metadata['message_id'] - ctxt.project_domain = event_type - LOG.info("Event '%(event)s' received from %(publisher)s " - "with metadata %(metadata)s", - dict(event=event_type, - publisher=publisher_id, - metadata=metadata)) - LOG.debug(payload) - instance_data = payload['nova_object.data'] - instance_uuid = instance_data['uuid'] - node_uuid = instance_data.get('host') - instance = self.get_or_create_instance(instance_uuid, node_uuid) - - self.update_instance(instance, payload) - - -class InstanceDeletedEnd(VersionedNotificationEndpoint): - - @property - def filter_rule(self): - """Nova service.update notification filter""" - return filtering.NotificationFilter( - publisher_id=self.publisher_id_regex, - event_type='instance.delete.end', - ) - - def info(self, ctxt, publisher_id, event_type, payload, metadata): - ctxt.request_id = metadata['message_id'] - ctxt.project_domain = event_type - LOG.info("Event '%(event)s' received from %(publisher)s " - "with metadata %(metadata)s", - dict(event=event_type, - publisher=publisher_id, - metadata=metadata)) - LOG.debug(payload) - + def instance_deleted(self, payload): instance_data = payload['nova_object.data'] instance_uuid = instance_data['uuid'] node_uuid = instance_data.get('host') @@ -327,3 +235,49 @@ class InstanceDeletedEnd(VersionedNotificationEndpoint): node = None self.delete_instance(instance, node) + + notification_mapping = { + 'instance.create.end': instance_updated, + 'instance.lock': instance_updated, + 'instance.unlock': instance_updated, + 'instance.pause.end': instance_updated, + 'instance.power_off.end': instance_updated, + 'instance.power_on.end': instance_updated, + 'instance.resize_confirm.end': instance_updated, + 'instance.restore.end': instance_updated, + 'instance.resume.end': instance_updated, + 'instance.shelve.end': instance_updated, + 'instance.shutdown.end': instance_updated, + 'instance.suspend.end': instance_updated, + 'instance.unpause.end': instance_updated, + 'instance.unrescue.end': instance_updated, + 'instance.unshelve.end': instance_updated, + 'instance.rebuild.end': instance_updated, + 'instance.rescue.end': instance_updated, + 'instance.update': instance_updated, + 'instance.live_migration_force_complete.end': instance_updated, + 'instance.live_migration_post_dest.end': instance_updated, + 'instance.delete.end': instance_deleted, + 'instance.soft_delete.end': instance_deleted, + 'service.create': service_updated, + 'service.delete': service_deleted, + 'service.update': service_updated, + } + + @property + def filter_rule(self): + """Nova notification filter""" + return filtering.NotificationFilter( + publisher_id=self.publisher_id_regex, + ) + + def info(self, ctxt, publisher_id, event_type, payload, metadata): + LOG.info("Event '%(event)s' received from %(publisher)s " + "with metadata %(metadata)s", + dict(event=event_type, + publisher=publisher_id, + metadata=metadata)) + func = self.notification_mapping.get(event_type) + if func: + LOG.debug(payload) + func(self, payload) diff --git a/watcher/tests/decision_engine/model/notification/data/instance-create-end.json b/watcher/tests/decision_engine/model/notification/data/instance-create-end.json new file mode 100644 index 000000000..6095355cf --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-create-end.json @@ -0,0 +1,105 @@ +{ + "event_type": "instance.create.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "keypairs": [ + { + "nova_object.data": { + "fingerprint": "1e:2c:9b:56:79:4b:45:77:f9:ca:7a:98:2c:b0:d5:3c", + "name": "my-key", + "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGgB4rMYmIf+6A4l6Rr+o/6lHBQdW5aYd44bd8JttDCE/F/pNRr0lRE+PiqSPO8nDPHw0010JeMH9gYgnnFlyY3/OcJ02RhIPyyxYpv9FhY+2YiUkpwFOcLImyrxEsYXpD/0d3ac30bNH6Sw9JD9UZHYcpSxsIbECHw== Generated-by-Nova", + "type": "ssh", + "user_id": "fake" + }, + "nova_object.name": "KeypairPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "tags": [ + "tag" + ], + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "trusted_image_certificates": [ + "cert-id-1", + "cert-id-2" + ], + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "c03c0bf9-f46e-4e4f-93f1-817568567ee2" + }, + "nova_object.name": "InstanceCreatePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.10" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-create.json b/watcher/tests/decision_engine/model/notification/data/instance-create.json deleted file mode 100644 index ddb1aa056..000000000 --- a/watcher/tests/decision_engine/model/notification/data/instance-create.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "event_type": "instance.update", - "payload": { - "nova_object.data": { - "architecture": "x86_64", - "audit_period": { - "nova_object.data": { - "audit_period_beginning": "2012-10-01T00:00:00Z", - "audit_period_ending": "2012-10-29T13:42:11Z" - }, - "nova_object.name": "AuditPeriodPayload", - "nova_object.namespace": "nova", - "nova_object.version": "1.0" - }, - "availability_zone": null, - "bandwidth": [], - "created_at": "2012-10-29T13:42:11Z", - "deleted_at": null, - "display_name": "some-server", - "host": "compute", - "host_name": "some-server", - "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", - "kernel_id": "", - "launched_at": null, - "metadata": {}, - "node": "fake-mini", - "old_display_name": null, - "os_type": null, - "progress": 0, - "ramdisk_id": "", - "reservation_id": "r-sd3ygfjj", - "state": "active", - "task_state": "scheduling", - "power_state": "pending", - "ip_addresses": [], - "state_update": { - "nova_object.version": "1.0", - "nova_object.name": "InstanceStateUpdatePayload", - "nova_object.namespace": "nova", - "nova_object.data": { - "old_state": "building", - "new_task_state": null, - "old_task_state": "spawning", - "state": "active" - } - }, - "tenant_id": "6f70656e737461636b20342065766572", - "terminated_at": null, - "flavor": { - "nova_object.name": "FlavorPayload", - "nova_object.data": { - "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", - "root_gb": 1, - "vcpus": 1, - "ephemeral_gb": 0, - "memory_mb": 512 - }, - "nova_object.version": "1.0", - "nova_object.namespace": "nova" - }, - "user_id": "fake", - "uuid": "c03c0bf9-f46e-4e4f-93f1-817568567ee2" - }, - "nova_object.name": "InstanceUpdatePayload", - "nova_object.namespace": "nova", - "nova_object.version": "1.0" - }, - "priority": "INFO", - "publisher_id": "nova-compute:compute" -} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-delete-end.json b/watcher/tests/decision_engine/model/notification/data/instance-delete-end.json index 75eaffaa5..933e43370 100644 --- a/watcher/tests/decision_engine/model/notification/data/instance-delete-end.json +++ b/watcher/tests/decision_engine/model/notification/data/instance-delete-end.json @@ -38,7 +38,7 @@ "nova_object.namespace": "nova" }, "user_id":"fake", - "uuid":"178b0921-8f85-4257-88b6-2e743b5a975c" + "uuid":"73b09e16-35b7-4922-804e-e8f5d9b740fc" }, "nova_object.name":"InstanceActionPayload", "nova_object.namespace":"nova", diff --git a/watcher/tests/decision_engine/model/notification/data/instance-live_migration_force_complete-end.json b/watcher/tests/decision_engine/model/notification/data/instance-live_migration_force_complete-end.json new file mode 100644 index 000000000..6bd116429 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-live_migration_force_complete-end.json @@ -0,0 +1,98 @@ +{ + "event_type": "instance.live_migration_force_complete.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "admin", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "Node_1", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": "migrating", + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} + diff --git a/watcher/tests/decision_engine/model/notification/data/instance-live_migration_post_dest-end.json b/watcher/tests/decision_engine/model/notification/data/instance-live_migration_post_dest-end.json new file mode 100644 index 000000000..ea49d379a --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-live_migration_post_dest-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.live_migration_post_dest.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "admin", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "Node_1", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "host2", + "os_type": null, + "power_state": "pending", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:host2" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-lock.json b/watcher/tests/decision_engine/model/notification/data/instance-lock.json new file mode 100644 index 000000000..9c995f1e2 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-lock.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.lock", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": true, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-api:fake-mini" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-pause-end.json b/watcher/tests/decision_engine/model/notification/data/instance-pause-end.json new file mode 100644 index 000000000..9c90df0ee --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-pause-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.pause.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "paused", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-power_off-end.json b/watcher/tests/decision_engine/model/notification/data/instance-power_off-end.json new file mode 100644 index 000000000..ec5fc7ae6 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-power_off-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.power_off.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "shutdown", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "stopped", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-power_on-end.json b/watcher/tests/decision_engine/model/notification/data/instance-power_on-end.json new file mode 100644 index 000000000..2d10bfe11 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-power_on-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.power_on.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-rebuild-end.json b/watcher/tests/decision_engine/model/notification/data/instance-rebuild-end.json new file mode 100644 index 000000000..87bb042ef --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-rebuild-end.json @@ -0,0 +1,101 @@ +{ + "event_type": "instance.rebuild.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": null, + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "Node_1", + "host_name": "some-server", + "image_uuid": "a2459075-d96c-40d5-893e-577ff92e721c", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "trusted_image_certificates": [ + "rebuild-cert-id-1", + "rebuild-cert-id-2" + ], + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionRebuildPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.8" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-rescue-end.json b/watcher/tests/decision_engine/model/notification/data/instance-rescue-end.json new file mode 100644 index 000000000..cd41b9b61 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-rescue-end.json @@ -0,0 +1,98 @@ +{ + "event_type": "instance.rescue.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "shutdown", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "rescue_image_ref": "a2459075-d96c-40d5-893e-577ff92e721c", + "reservation_id": "r-npxv0e40", + "state": "rescued", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionRescuePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.2" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-resize_confirm-end.json b/watcher/tests/decision_engine/model/notification/data/instance-resize_confirm-end.json new file mode 100644 index 000000000..5d1bb3c38 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-resize_confirm-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.resize_confirm.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "2", + "is_public": true, + "memory_mb": 2048, + "name": "m1.small", + "projects": null, + "root_gb": 20, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "Node_1", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-restore-end.json b/watcher/tests/decision_engine/model/notification/data/instance-restore-end.json new file mode 100644 index 000000000..bd50c0daa --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-restore-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.restore.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-resume-end.json b/watcher/tests/decision_engine/model/notification/data/instance-resume-end.json new file mode 100644 index 000000000..bb6eaf222 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-resume-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.resume.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-shelve-end.json b/watcher/tests/decision_engine/model/notification/data/instance-shelve-end.json new file mode 100644 index 000000000..9e12a8d14 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-shelve-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.shelve.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "shutdown", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "shelved", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-shutdown-end.json b/watcher/tests/decision_engine/model/notification/data/instance-shutdown-end.json new file mode 100644 index 000000000..341cff3be --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-shutdown-end.json @@ -0,0 +1,82 @@ +{ + "event_type": "instance.shutdown.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "stopped", + "task_state": "deleting", + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-soft_delete-end.json b/watcher/tests/decision_engine/model/notification/data/instance-soft_delete-end.json new file mode 100644 index 000000000..99f531007 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-soft_delete-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.soft_delete.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": "2012-10-29T13:42:11Z", + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "soft-delete", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:fake-mini" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-suspend-end.json b/watcher/tests/decision_engine/model/notification/data/instance-suspend-end.json new file mode 100644 index 000000000..48d6efc7d --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-suspend-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.suspend.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "suspended", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-unlock.json b/watcher/tests/decision_engine/model/notification/data/instance-unlock.json new file mode 100644 index 000000000..8a2589fff --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-unlock.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.unlock", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-api:fake-mini" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-unpause-end.json b/watcher/tests/decision_engine/model/notification/data/instance-unpause-end.json new file mode 100644 index 000000000..1329e6ad3 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-unpause-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.unpause.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-unrescue-end.json b/watcher/tests/decision_engine/model/notification/data/instance-unrescue-end.json new file mode 100644 index 000000000..06236124a --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-unrescue-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.unrescue.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-unshelve-end.json b/watcher/tests/decision_engine/model/notification/data/instance-unshelve-end.json new file mode 100644 index 000000000..5c69bad37 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/instance-unshelve-end.json @@ -0,0 +1,97 @@ +{ + "event_type": "instance.unshelve.end", + "payload": { + "nova_object.data": { + "action_initiator_project": "6f70656e737461636b20342065766572", + "action_initiator_user": "fake", + "architecture": "x86_64", + "auto_disk_config": "MANUAL", + "availability_zone": "nova", + "block_devices": [ + { + "nova_object.data": { + "boot_index": null, + "delete_on_termination": false, + "device_name": "/dev/sdb", + "tag": null, + "volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" + }, + "nova_object.name": "BlockDevicePayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "created_at": "2012-10-29T13:42:11Z", + "deleted_at": null, + "display_description": "some-server", + "display_name": "some-server", + "fault": null, + "flavor": { + "nova_object.data": { + "description": null, + "disabled": false, + "ephemeral_gb": 0, + "extra_specs": { + "hw:watchdog_action": "disabled" + }, + "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", + "is_public": true, + "memory_mb": 512, + "name": "test_flavor", + "projects": null, + "root_gb": 1, + "rxtx_factor": 1.0, + "swap": 0, + "vcpu_weight": 0, + "vcpus": 1 + }, + "nova_object.name": "FlavorPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.4" + }, + "host": "compute", + "host_name": "some-server", + "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", + "ip_addresses": [ + { + "nova_object.data": { + "address": "192.168.1.3", + "device_name": "tapce531f90-19", + "label": "private-network", + "mac": "fa:16:3e:4c:2c:30", + "meta": {}, + "port_uuid": "ce531f90-199f-48c0-816c-13e38010b442", + "version": 4 + }, + "nova_object.name": "IpPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.0" + } + ], + "kernel_id": "", + "key_name": "my-key", + "launched_at": "2012-10-29T13:42:11Z", + "locked": false, + "metadata": {}, + "node": "fake-mini", + "os_type": null, + "power_state": "running", + "progress": 0, + "ramdisk_id": "", + "request_id": "req-5b6c791d-5709-4f36-8fbe-c3e02869e35d", + "reservation_id": "r-npxv0e40", + "state": "active", + "task_state": null, + "tenant_id": "6f70656e737461636b20342065766572", + "terminated_at": null, + "updated_at": "2012-10-29T13:42:11Z", + "user_id": "fake", + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc" + }, + "nova_object.name": "InstanceActionPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.7" + }, + "priority": "INFO", + "publisher_id": "nova-compute:compute" +} diff --git a/watcher/tests/decision_engine/model/notification/data/instance-update.json b/watcher/tests/decision_engine/model/notification/data/instance-update.json index f79485a04..01d60ce8a 100644 --- a/watcher/tests/decision_engine/model/notification/data/instance-update.json +++ b/watcher/tests/decision_engine/model/notification/data/instance-update.json @@ -28,7 +28,7 @@ "progress": 0, "ramdisk_id": "", "reservation_id": "r-sd3ygfjj", - "state": "active", + "state": "paused", "task_state": "scheduling", "power_state": "pending", "ip_addresses": [], @@ -56,7 +56,7 @@ "nova_object.namespace": "nova" }, "user_id": "fake", - "uuid": "c03c0bf9-f46e-4e4f-93f1-817568567ee2"}, + "uuid": "73b09e16-35b7-4922-804e-e8f5d9b740fc"}, "nova_object.name": "InstanceUpdatePayload", "nova_object.namespace": "nova", "nova_object.version": "1.0"}, diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_instance-create.json b/watcher/tests/decision_engine/model/notification/data/scenario3_instance-create.json deleted file mode 100644 index d180f8d85..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_instance-create.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "event_type": "instance.update", - "payload": { - "nova_object.data": { - "architecture": "x86_64", - "audit_period": { - "nova_object.data": { - "audit_period_beginning": "2012-10-01T00:00:00Z", - "audit_period_ending": "2012-10-29T13:42:11Z" - }, - "nova_object.name": "AuditPeriodPayload", - "nova_object.namespace": "nova", - "nova_object.version": "1.0" - }, - "availability_zone": null, - "bandwidth": [], - "created_at": "2012-10-29T13:42:11Z", - "deleted_at": null, - "display_name": "some-server", - "host": "Node_0", - "host_name": "some-server", - "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", - "kernel_id": "", - "launched_at": null, - "metadata": {}, - "node": "hostname_0", - "old_display_name": null, - "os_type": null, - "progress": 0, - "ramdisk_id": "", - "reservation_id": "r-sd3ygfjj", - "state": "active", - "task_state": "scheduling", - "power_state": "pending", - "ip_addresses": [], - "state_update": { - "nova_object.version": "1.0", - "nova_object.name": "InstanceStateUpdatePayload", - "nova_object.namespace": "nova", - "nova_object.data": { - "old_state": "building", - "new_task_state": null, - "old_task_state": "spawning", - "state": "active" - } - }, - "tenant_id": "6f70656e737461636b20342065766572", - "terminated_at": null, - "flavor": { - "nova_object.name": "FlavorPayload", - "nova_object.data": { - "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", - "root_gb": 1, - "vcpus": 1, - "ephemeral_gb": 0, - "memory_mb": 512 - }, - "nova_object.version": "1.0", - "nova_object.namespace": "nova" - }, - "user_id": "fake", - "uuid": "c03c0bf9-f46e-4e4f-93f1-817568567ee2" - }, - "nova_object.name": "InstanceUpdatePayload", - "nova_object.namespace": "nova", - "nova_object.version": "1.0" - }, - "priority": "INFO", - "publisher_id": "nova-compute:Node_0" -} diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_instance-delete-end.json b/watcher/tests/decision_engine/model/notification/data/scenario3_instance-delete-end.json deleted file mode 100644 index 90898b8a7..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_instance-delete-end.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "event_type":"instance.delete.end", - "payload":{ - "nova_object.data":{ - "architecture":"x86_64", - "availability_zone":null, - "created_at":"2012-10-29T13:42:11Z", - "deleted_at":"2012-10-29T13:42:11Z", - "display_name":"some-server", - "fault":null, - "host":"Node_0", - "host_name":"some-server", - "ip_addresses":[], - "kernel_id":"", - "launched_at":"2012-10-29T13:42:11Z", - "image_uuid": "155d900f-4e14-4e4c-a73d-069cbf4541e6", - "metadata":{}, - "node":"fake-mini", - "os_type":null, - "progress":0, - "ramdisk_id":"", - "reservation_id":"r-npxv0e40", - "state":"deleted", - "task_state":null, - "power_state":"pending", - "tenant_id":"6f70656e737461636b20342065766572", - "terminated_at":"2012-10-29T13:42:11Z", - "flavor": { - "nova_object.name": "FlavorPayload", - "nova_object.data": { - "flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3", - "root_gb": 1, - "vcpus": 1, - "ephemeral_gb": 0, - "memory_mb": 512 - }, - "nova_object.version": "1.0", - "nova_object.namespace": "nova" - }, - "user_id":"fake", - "uuid":"73b09e16-35b7-4922-804e-e8f5d9b740fc" - }, - "nova_object.name":"InstanceActionPayload", - "nova_object.namespace":"nova", - "nova_object.version":"1.0" - }, - "priority":"INFO", - "publisher_id":"nova-compute:Node_0" -} diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-create-end.json b/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-create-end.json deleted file mode 100644 index 3a0b36658..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-create-end.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "event_type": "compute.instance.create.end", - "metadata": { - "message_id": "577bfd11-88e0-4044-b8ae-496e3257efe2", - "timestamp": "2016-08-19 10:20:59.279903" - }, - "payload": { - "access_ip_v4": null, - "access_ip_v6": null, - "architecture": null, - "availability_zone": "nova", - "cell_name": "", - "created_at": "2016-08-19 10:20:49+00:00", - "deleted_at": "", - "disk_gb": 1, - "display_name": "INSTANCE_0", - "ephemeral_gb": 0, - "fixed_ips": [ - { - "address": "192.168.1.197", - "floating_ips": [], - "label": "demo-net", - "meta": {}, - "type": "fixed", - "version": 4, - "vif_mac": "fa:16:3e:a3:c0:0f" - } - ], - "host": "Node_0", - "hostname": "INSTANCE_0", - "image_meta": { - "base_image_ref": "205f96f5-91f9-42eb-9138-03fffcea2b97", - "container_format": "bare", - "disk_format": "qcow2", - "min_disk": "1", - "min_ram": "0" - }, - "image_ref_url": "http://127.0.0.1:9292/images/205f96f5-91f9-42eb-9138-03fffcea2b97", - "instance_flavor_id": "1", - "instance_id": "c03c0bf9-f46e-4e4f-93f1-817568567ee2", - "instance_type": "m1.tiny", - "instance_type_id": 2, - "kernel_id": "", - "launched_at": "2016-08-19T10:20:59.135390", - "memory_mb": 512, - "message": "Success", - "metadata": {}, - "node": "Node_0", - "os_type": null, - "progress": "", - "ramdisk_id": "", - "reservation_id": "r-56edz88e", - "root_gb": 1, - "state": "active", - "state_description": "", - "tenant_id": "57ab04ad6d3b495789a58258bc00842b", - "terminated_at": "", - "user_id": "cd7d93be51e4460ab51514b2a925b23a", - "vcpus": 1 - }, - "publisher_id": "compute.Node_0" -} diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-delete-end.json b/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-delete-end.json deleted file mode 100644 index 12b0a129d..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-delete-end.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "publisher_id": "compute:compute", - "event_type": "compute.instance.delete.end", - "payload": { - "access_ip_v4": null, - "access_ip_v6": null, - "architecture": null, - "availability_zone": "nova", - "cell_name": "", - "created_at": "2016-08-17 15:10:12+00:00", - "deleted_at": "2016-08-17T15:10:33.000000", - "disk_gb": 1, - "display_name": "some-server", - "ephemeral_gb": 0, - "host": "Node_0", - "hostname": "some-server", - "image_meta": { - "base_image_ref": "205f96f5-91f9-42eb-9138-03fffcea2b97", - "container_format": "bare", - "disk_format": "qcow2", - "min_disk": "1", - "min_ram": "0" - }, - "image_ref_url": "http://10.50.254.222:9292/images/205f96f5-91f9-42eb-9138-03fffcea2b97", - "instance_flavor_id": "1", - "instance_id": "73b09e16-35b7-4922-804e-e8f5d9b740fc", - "instance_type": "m1.tiny", - "instance_type_id": 2, - "kernel_id": "", - "launched_at": "2016-08-17T15:10:23.000000", - "memory_mb": 512, - "metadata": {}, - "node": "Node_0", - "os_type": null, - "progress": "", - "ramdisk_id": "", - "reservation_id": "r-z76fnsyy", - "root_gb": 1, - "state": "deleted", - "state_description": "", - "tenant_id": "15995ea2694e4268b3631db32e38678b", - "terminated_at": "2016-08-17T15:10:33.008164", - "user_id": "cd7d93be51e4460ab51514b2a925b23a", - "vcpus": 1 - } -} diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-rebuild-end.json b/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-rebuild-end.json deleted file mode 100644 index 8e2b793aa..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-rebuild-end.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "event_type": "compute.instance.rebuild.end", - "payload": { - "state_description": "", - "availability_zone": "nova", - "terminated_at": "", - "ephemeral_gb": 0, - "instance_type_id": 5, - "deleted_at": "", - "fixed_ips": [ - { - "version": 4, - "vif_mac": "fa:16:3e:78:e1:a0", - "floating_ips": [], - "label": "test-net", - "meta": {}, - "address": "192.168.200.16", - "type": "fixed" - } - ], - "instance_id": "73b09e16-35b7-4922-804e-e8f5d9b740fc", - "display_name": "INSTANCE_0", - "reservation_id": "r-jmbnz8nc", - "hostname": "INSTANCE_1", - "state": "active", - "progress": "", - "launched_at": "2017-09-13T06:10:42.751392", - "metadata": {}, - "node": "Node_1", - "ramdisk_id": "", - "access_ip_v6": null, - "disk_gb": 20, - "access_ip_v4": null, - "kernel_id": "", - "image_name": "", - "host": "Node_1", - "user_id": "0c1add55e6d149108deedee780fdb540", - "image_ref_url": "http://10.21.1.16:9292/images/886eae2b-b41f-4340-acd1-a1b926671b0a", - "cell_name": "", - "root_gb": 20, - "tenant_id": "b18faa9487864b20b61386438b7ae2ce", - "created_at": "2017-09-11 09:48:05+00:00", - "memory_mb": 2048, - "instance_type": "m1.small", - "vcpus": 1, - "image_meta": { - "min_disk": "20", - "container_format": "bare", - "min_ram": "0", - "disk_format": "raw", - "base_image_ref": "886eae2b-b41f-4340-acd1-a1b926671b0a" - }, - "architecture": null, - "os_type": null, - "instance_flavor_id": "2" - }, - "priority": "INFO", - "publisher_id": "compute.Node_1" -} diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-resize-confirm-end.json b/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-resize-confirm-end.json deleted file mode 100644 index eaa42ffe2..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-resize-confirm-end.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "event_type": "compute.instance.resize.confirm.end", - "payload": { - "state_description": "", - "availability_zone": "nova", - "terminated_at": "", - "ephemeral_gb": 0, - "instance_type_id": 15, - "deleted_at": "", - "fixed_ips": [ - { - "version": 4, - "vif_mac": "fa:16:3e:cb:26:a3", - "floating_ips": [], - "label": "test-net", - "meta": {}, - "address": "192.168.200.14", - "type": "fixed" - } - ], - "instance_id": "73b09e16-35b7-4922-804e-e8f5d9b740fc", - "display_name": "INSTANCE_0", - "reservation_id": "r-jmbnz8nc", - "hostname": "INSTANCE_0", - "state": "active", - "progress": "", - "launched_at": "2017-09-13T06:26:01.559215", - "metadata": {}, - "node": "Node_1", - "ramdisk_id": "", - "access_ip_v6": null, - "disk_gb": 20, - "access_ip_v4": null, - "kernel_id": "", - "host": "Node_1", - "user_id": "0c1add55e6d149108deedee780fdb540", - "image_ref_url": "http://10.21.1.14:9292/images/886eae2b-b41f-4340-acd1-a1b926671b0a", - "cell_name": "", - "root_gb": 20, - "tenant_id": "b18faa9487864b20b61386438b7ae2ce", - "created_at": "2017-09-11 09:48:05+00:00", - "memory_mb": 2048, - "instance_type": "U2M2D20", - "vcpus": 2, - "image_meta": { - "min_disk": "20", - "container_format": "bare", - "min_ram": "0", - "disk_format": "raw", - "base_image_ref": "886eae2b-b41f-4340-acd1-a1b926671b0a" - }, - "architecture": null, - "os_type": null, - "instance_flavor_id": "5a0665e0-d2ec-4e4b-85f9-cc0ce4ab052b" - }, - "priority": "INFO", - "publisher_id": "compute.Node_1" -} diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-update.json b/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-update.json deleted file mode 100644 index ce2b9979c..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_instance-update.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "publisher_id": "compute:Node_0", - "event_type": "compute.instance.update", - "payload": { - "access_ip_v4": null, - "access_ip_v6": null, - "architecture": null, - "audit_period_beginning": "2016-08-17T13:00:00.000000", - "audit_period_ending": "2016-08-17T13:56:05.262440", - "availability_zone": "nova", - "bandwidth": {}, - "cell_name": "", - "created_at": "2016-08-17 13:53:23+00:00", - "deleted_at": "", - "disk_gb": 1, - "display_name": "NEW_INSTANCE0", - "ephemeral_gb": 0, - "host": "Node_0", - "hostname": "NEW_INSTANCE0", - "image_meta": { - "base_image_ref": "205f96f5-91f9-42eb-9138-03fffcea2b97", - "container_format": "bare", - "disk_format": "qcow2", - "min_disk": "1", - "min_ram": "0" - }, - "image_ref_url": "http://10.50.0.222:9292/images/205f96f5-91f9-42eb-9138-03fffcea2b97", - "instance_flavor_id": "1", - "instance_id": "73b09e16-35b7-4922-804e-e8f5d9b740fc", - "instance_type": "m1.tiny", - "instance_type_id": 2, - "kernel_id": "", - "launched_at": "2016-08-17T13:53:35.000000", - "memory_mb": 512, - "metadata": {}, - "new_task_state": null, - "node": "hostname_0", - "old_state": "paused", - "old_task_state": null, - "os_type": null, - "progress": "", - "ramdisk_id": "", - "reservation_id": "r-0822ymml", - "root_gb": 1, - "state": "paused", - "state_description": "paused", - "tenant_id": "a4b4772d93c74d5e8b7c68cdd2a014e1", - "terminated_at": "", - "user_id": "ce64facc93354bbfa90f4f9f9a3e1e75", - "vcpus": 1 - } -} diff --git a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_livemigration-post-dest-end.json b/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_livemigration-post-dest-end.json deleted file mode 100644 index 916b91b0c..000000000 --- a/watcher/tests/decision_engine/model/notification/data/scenario3_legacy_livemigration-post-dest-end.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "event_type": "compute.instance.live_migration.post.dest.end", - "metadata": { - "message_id": "9f58cad4-ff90-40f8-a8e4-633807f4a995", - "timestamp": "2016-08-19 10:13:44.645575" - }, - "payload": { - "access_ip_v4": null, - "access_ip_v6": null, - "architecture": null, - "availability_zone": "nova", - "cell_name": "", - "created_at": "2016-08-18 09:49:23+00:00", - "deleted_at": "", - "disk_gb": 1, - "display_name": "INSTANCE_0", - "ephemeral_gb": 0, - "fixed_ips": [ - { - "address": "192.168.1.196", - "floating_ips": [], - "label": "demo-net", - "meta": {}, - "type": "fixed", - "version": 4, - "vif_mac": "fa:16:3e:cc:ba:81" - } - ], - "host": "Node_1", - "hostname": "INSTANCE_0", - "image_meta": { - "base_image_ref": "205f96f5-91f9-42eb-9138-03fffcea2b97", - "container_format": "bare", - "disk_format": "qcow2", - "min_disk": "1", - "min_ram": "0" - }, - "image_ref_url": "http://10.50.254.222:9292/images/205f96f5-91f9-42eb-9138-03fffcea2b97", - "instance_flavor_id": "1", - "instance_id": "73b09e16-35b7-4922-804e-e8f5d9b740fc", - "instance_type": "m1.tiny", - "instance_type_id": 2, - "kernel_id": "", - "launched_at": "2016-08-18T09:49:33.000000", - "memory_mb": 512, - "metadata": {}, - "node": "Node_1", - "os_type": null, - "progress": "", - "ramdisk_id": "", - "reservation_id": "r-he04tfco", - "root_gb": 1, - "state": "active", - "state_description": "", - "tenant_id": "57ab04ad6d3b495789a58258bc00842b", - "terminated_at": "", - "user_id": "cd7d93be51e4460ab51514b2a925b23a", - "vcpus": 1 - }, - "publisher_id": "compute.Node_1" -} diff --git a/watcher/tests/decision_engine/model/notification/data/service-create.json b/watcher/tests/decision_engine/model/notification/data/service-create.json new file mode 100644 index 000000000..4b8ac0bb7 --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/service-create.json @@ -0,0 +1,24 @@ +{ + "event_type": "service.create", + "payload": { + "nova_object.data": { + "availability_zone": null, + "binary": "nova-compute", + "disabled": false, + "disabled_reason": null, + "forced_down": false, + "host": "host2", + "last_seen_up": null, + "report_count": 0, + "topic": "compute", + "uuid": "fa69c544-906b-4a6a-a9c6-c1f7a8078c73", + "version": 23 + }, + "nova_object.name": "ServiceStatusPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.1" + }, + "priority": "INFO", + "publisher_id": "nova-compute:host2" +} + diff --git a/watcher/tests/decision_engine/model/notification/data/service-delete.json b/watcher/tests/decision_engine/model/notification/data/service-delete.json new file mode 100644 index 000000000..b1a2c421c --- /dev/null +++ b/watcher/tests/decision_engine/model/notification/data/service-delete.json @@ -0,0 +1,24 @@ +{ + "event_type": "service.delete", + "payload": { + "nova_object.data": { + "availability_zone": null, + "binary": "nova-compute", + "disabled": false, + "disabled_reason": null, + "forced_down": false, + "host": "Node_0", + "last_seen_up": null, + "report_count": 0, + "topic": "compute", + "uuid": "fa69c544-906b-4a6a-a9c6-c1f7a8078c73", + "version": 23 + }, + "nova_object.name": "ServiceStatusPayload", + "nova_object.namespace": "nova", + "nova_object.version": "1.1" + }, + "priority": "INFO", + "publisher_id": "nova-compute:host2" +} + diff --git a/watcher/tests/decision_engine/model/notification/fake_managers.py b/watcher/tests/decision_engine/model/notification/fake_managers.py index bc1ca651c..ec3ebd384 100644 --- a/watcher/tests/decision_engine/model/notification/fake_managers.py +++ b/watcher/tests/decision_engine/model/notification/fake_managers.py @@ -55,11 +55,7 @@ class FakeManager(service_manager.ServiceManager): @property def notification_endpoints(self): return [ - novanotification.ServiceUpdated(self.fake_cdmc), - - novanotification.InstanceCreated(self.fake_cdmc), - novanotification.InstanceUpdated(self.fake_cdmc), - novanotification.InstanceDeletedEnd(self.fake_cdmc), + novanotification.VersionedNotification(self.fake_cdmc), ] diff --git a/watcher/tests/decision_engine/model/notification/test_nova_notifications.py b/watcher/tests/decision_engine/model/notification/test_nova_notifications.py index 85147247a..c74364e3e 100644 --- a/watcher/tests/decision_engine/model/notification/test_nova_notifications.py +++ b/watcher/tests/decision_engine/model/notification/test_nova_notifications.py @@ -48,6 +48,35 @@ class NotificationTestCase(base_test.TestCase): class TestReceiveNovaNotifications(NotificationTestCase): FAKE_METADATA = {'message_id': None, 'timestamp': None} + FAKE_NOTIFICATIONS = { + 'instance.create.end': 'instance-create-end.json', + 'instance.lock': 'instance-lock.json', + 'instance.unlock': 'instance-unlock.json', + 'instance.pause.end': 'instance-pause-end.json', + 'instance.power_off.end': 'instance-power_off-end.json', + 'instance.power_on.end': 'instance-power_on-end.json', + 'instance.resize_confirm.end': 'instance-resize_confirm-end.json', + 'instance.restore.end': 'instance-restore-end.json', + 'instance.resume.end': 'instance-resume-end.json', + 'instance.shelve.end': 'instance-shelve-end.json', + 'instance.shutdown.end': 'instance-shutdown-end.json', + 'instance.suspend.end': 'instance-suspend-end.json', + 'instance.unpause.end': 'instance-unpause-end.json', + 'instance.unrescue.end': 'instance-unrescue-end.json', + 'instance.unshelve.end': 'instance-unshelve-end.json', + 'instance.rebuild.end': 'instance-rebuild-end.json', + 'instance.rescue.end': 'instance-rescue-end.json', + 'instance.update': 'instance-update.json', + 'instance.live_migration_force_complete.end': + 'instance-live_migration_force_complete-end.json', + 'instance.live_migration_post_dest.end': + 'instance-live_migration_post_dest-end.json', + 'instance.delete.end': 'instance-delete-end.json', + 'instance.soft_delete.end': 'instance-soft_delete-end.json', + 'service.create': 'service-create.json', + 'service.delete': 'service-delete.json', + 'service.update': 'service-update.json', + } def setUp(self): super(TestReceiveNovaNotifications, self).setUp() @@ -61,57 +90,22 @@ class TestReceiveNovaNotifications(NotificationTestCase): self.m_heartbeat = p_heartbeat.start() self.addCleanup(p_heartbeat.stop) - @mock.patch.object(novanotification.ServiceUpdated, 'info') - def test_nova_receive_service_update(self, m_info): - message = self.load_message('service-update.json') - expected_message = message['payload'] - + @mock.patch.object(novanotification.VersionedNotification, 'info') + def test_receive_nova_notifications(self, m_info): de_service = watcher_service.Service(fake_managers.FakeManager) - incoming = mock.Mock(ctxt=self.context.to_dict(), message=message) + n_dicts = novanotification.VersionedNotification.notification_mapping + for n_type in n_dicts.keys(): + n_json = self.FAKE_NOTIFICATIONS[n_type] + message = self.load_message(n_json) + expected_message = message['payload'] + publisher_id = message['publisher_id'] - de_service.notification_handler.dispatcher.dispatch(incoming) - m_info.assert_called_once_with( - self.context, 'nova-compute:host1', 'service.update', - expected_message, self.FAKE_METADATA) + incoming = mock.Mock(ctxt=self.context.to_dict(), message=message) - @mock.patch.object(novanotification.InstanceCreated, 'info') - def test_nova_receive_instance_create(self, m_info): - message = self.load_message('instance-create.json') - expected_message = message['payload'] - - de_service = watcher_service.Service(fake_managers.FakeManager) - incoming = mock.Mock(ctxt=self.context.to_dict(), message=message) - - de_service.notification_handler.dispatcher.dispatch(incoming) - m_info.assert_called_once_with( - self.context, 'nova-compute:compute', 'instance.update', - expected_message, self.FAKE_METADATA) - - @mock.patch.object(novanotification.InstanceUpdated, 'info') - def test_nova_receive_instance_update(self, m_info): - message = self.load_message('instance-update.json') - expected_message = message['payload'] - - de_service = watcher_service.Service(fake_managers.FakeManager) - incoming = mock.Mock(ctxt=self.context.to_dict(), message=message) - - de_service.notification_handler.dispatcher.dispatch(incoming) - m_info.assert_called_once_with( - self.context, 'nova-compute:compute', 'instance.update', - expected_message, self.FAKE_METADATA) - - @mock.patch.object(novanotification.InstanceDeletedEnd, 'info') - def test_nova_receive_instance_delete_end(self, m_info): - message = self.load_message('instance-delete-end.json') - expected_message = message['payload'] - - de_service = watcher_service.Service(fake_managers.FakeManager) - incoming = mock.Mock(ctxt=self.context.to_dict(), message=message) - - de_service.notification_handler.dispatcher.dispatch(incoming) - m_info.assert_called_once_with( - self.context, 'nova-compute:compute', 'instance.delete.end', - expected_message, self.FAKE_METADATA) + de_service.notification_handler.dispatcher.dispatch(incoming) + m_info.assert_called_with( + self.context, publisher_id, n_type, + expected_message, self.FAKE_METADATA) class TestNovaNotifications(NotificationTestCase): @@ -126,7 +120,7 @@ class TestNovaNotifications(NotificationTestCase): def test_nova_service_update(self): compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() self.fake_cdmc.cluster_data_model = compute_model - handler = novanotification.ServiceUpdated(self.fake_cdmc) + handler = novanotification.VersionedNotification(self.fake_cdmc) node0_uuid = 'Node_0' node0 = compute_model.get_node_by_uuid(node0_uuid) @@ -163,15 +157,81 @@ class TestNovaNotifications(NotificationTestCase): self.assertEqual(element.ServiceState.ONLINE.value, node0.state) self.assertEqual(element.ServiceState.ENABLED.value, node0.status) + @mock.patch.object(nova_helper, "NovaHelper") + def test_nova_service_create(self, m_nova_helper_cls): + m_get_compute_node_by_hostname = mock.Mock( + side_effect=lambda uuid: mock.Mock( + name='m_get_compute_node_by_hostname', + id=3, + hypervisor_hostname="host2", + state='up', + status='enabled', + uuid=uuid, + memory_mb=7777, + vcpus=42, + free_disk_gb=974, + local_gb=1337)) + m_nova_helper_cls.return_value = mock.Mock( + get_compute_node_by_hostname=m_get_compute_node_by_hostname, + name='m_nova_helper') + + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + new_node_uuid = 'host2' + + self.assertRaises( + exception.ComputeNodeNotFound, + compute_model.get_node_by_uuid, new_node_uuid) + + message = self.load_message('service-create.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + new_node = compute_model.get_node_by_uuid(new_node_uuid) + self.assertEqual('host2', new_node.hostname) + self.assertEqual(element.ServiceState.ONLINE.value, new_node.state) + self.assertEqual(element.ServiceState.ENABLED.value, new_node.status) + + def test_nova_service_delete(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + node0_uuid = 'Node_0' + + # Before + self.assertTrue(compute_model.get_node_by_uuid(node0_uuid)) + + message = self.load_message('service-delete.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + # After + self.assertRaises( + exception.ComputeNodeNotFound, + compute_model.get_node_by_uuid, node0_uuid) + def test_nova_instance_update(self): compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() self.fake_cdmc.cluster_data_model = compute_model - handler = novanotification.InstanceUpdated(self.fake_cdmc) + handler = novanotification.VersionedNotification(self.fake_cdmc) instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' instance0 = compute_model.get_instance_by_uuid(instance0_uuid) - message = self.load_message('scenario3_instance-update.json') + message = self.load_message('instance-update.json') self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) @@ -205,7 +265,7 @@ class TestNovaNotifications(NotificationTestCase): name='m_nova_helper') compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() self.fake_cdmc.cluster_data_model = compute_model - handler = novanotification.InstanceUpdated(self.fake_cdmc) + handler = novanotification.VersionedNotification(self.fake_cdmc) instance0_uuid = '9966d6bd-a45c-4e1c-9d57-3054899a3ec7' @@ -244,7 +304,7 @@ class TestNovaNotifications(NotificationTestCase): compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() self.fake_cdmc.cluster_data_model = compute_model - handler = novanotification.InstanceUpdated(self.fake_cdmc) + handler = novanotification.VersionedNotification(self.fake_cdmc) instance0_uuid = '9966d6bd-a45c-4e1c-9d57-3054899a3ec7' @@ -275,7 +335,7 @@ class TestNovaNotifications(NotificationTestCase): def test_nova_instance_create(self): compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() self.fake_cdmc.cluster_data_model = compute_model - handler = novanotification.InstanceCreated(self.fake_cdmc) + handler = novanotification.VersionedNotification(self.fake_cdmc) instance0_uuid = 'c03c0bf9-f46e-4e4f-93f1-817568567ee2' @@ -283,7 +343,7 @@ class TestNovaNotifications(NotificationTestCase): exception.InstanceNotFound, compute_model.get_instance_by_uuid, instance0_uuid) - message = self.load_message('scenario3_instance-create.json') + message = self.load_message('instance-create-end.json') handler.info( ctxt=self.context, publisher_id=message['publisher_id'], @@ -302,14 +362,14 @@ class TestNovaNotifications(NotificationTestCase): def test_nova_instance_delete_end(self): compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() self.fake_cdmc.cluster_data_model = compute_model - handler = novanotification.InstanceDeletedEnd(self.fake_cdmc) + handler = novanotification.VersionedNotification(self.fake_cdmc) instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' # Before self.assertTrue(compute_model.get_instance_by_uuid(instance0_uuid)) - message = self.load_message('scenario3_instance-delete-end.json') + message = self.load_message('instance-delete-end.json') handler.info( ctxt=self.context, publisher_id=message['publisher_id'], @@ -322,3 +382,364 @@ class TestNovaNotifications(NotificationTestCase): self.assertRaises( exception.InstanceNotFound, compute_model.get_instance_by_uuid, instance0_uuid) + + def test_nova_instance_soft_delete_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + + # Before + self.assertTrue(compute_model.get_instance_by_uuid(instance0_uuid)) + + message = self.load_message('instance-soft_delete-end.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + # After + self.assertRaises( + exception.InstanceNotFound, + compute_model.get_instance_by_uuid, instance0_uuid) + + def test_live_migrated_force_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_0', node.uuid) + message = self.load_message( + 'instance-live_migration_force_complete-end.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_1', node.uuid) + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_live_migrated_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_0', node.uuid) + message = self.load_message( + 'instance-live_migration_post_dest-end.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_1', node.uuid) + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_nova_instance_lock(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-lock.json') + + self.assertFalse(instance0.locked) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertTrue(instance0.locked) + + message = self.load_message('instance-unlock.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertFalse(instance0.locked) + + def test_nova_instance_pause(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-pause-end.json') + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.PAUSED.value, instance0.state) + + message = self.load_message('instance-unpause-end.json') + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_nova_instance_power_on_off(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-power_off-end.json') + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.STOPPED.value, instance0.state) + + message = self.load_message('instance-power_on-end.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_instance_rebuild_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_0', node.uuid) + message = self.load_message('instance-rebuild-end.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_1', node.uuid) + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_nova_instance_rescue(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-rescue-end.json') + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.RESCUED.value, instance0.state) + + message = self.load_message('instance-unrescue-end.json') + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_instance_resize_confirm_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_0', node.uuid) + message = self.load_message( + 'instance-resize_confirm-end.json') + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + node = compute_model.get_node_by_instance_uuid(instance0_uuid) + self.assertEqual('Node_1', node.uuid) + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_nova_instance_restore_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-restore-end.json') + instance0.state = element.InstanceState.ERROR.value + self.assertEqual(element.InstanceState.ERROR.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_nova_instance_resume_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-resume-end.json') + instance0.state = element.InstanceState.ERROR.value + self.assertEqual(element.InstanceState.ERROR.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_nova_instance_shelve(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-shelve-end.json') + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.SHELVED.value, instance0.state) + + message = self.load_message('instance-unshelve-end.json') + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + def test_nova_instance_shutdown_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-shutdown-end.json') + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual(element.InstanceState.STOPPED.value, instance0.state) + + def test_nova_instance_suspend_end(self): + compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() + self.fake_cdmc.cluster_data_model = compute_model + handler = novanotification.VersionedNotification(self.fake_cdmc) + + instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' + instance0 = compute_model.get_instance_by_uuid(instance0_uuid) + + message = self.load_message('instance-suspend-end.json') + self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state) + + handler.info( + ctxt=self.context, + publisher_id=message['publisher_id'], + event_type=message['event_type'], + payload=message['payload'], + metadata=self.FAKE_METADATA, + ) + + self.assertEqual( + element.InstanceState.SUSPENDED.value, instance0.state)