-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform compute_task notifications
The following notifications have been transformed to the versioned notification framework. * compute_task.build_instances * compute_task.migrate_server * compute_task.rebuild_server Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp> Change-Id: Ibfb0a6db5920d921c4fc7cabf3f4d2838ea7f421 Implements: bp versioned-notification-transformation-stein
- Loading branch information
1 parent
7217e38
commit fe4e47d
Showing
28 changed files
with
1,031 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,7 @@ | |
} | ||
], | ||
"metadata": { | ||
"architecture": "x86_64", | ||
"kernel_id": "nokernel", | ||
"ramdisk_id": "nokernel" | ||
}, | ||
|
11 changes: 11 additions & 0 deletions
11
doc/notification_samples/common_payloads/ComputeTaskPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"nova_object.version": "1.0", | ||
"nova_object.namespace": "nova", | ||
"nova_object.name": "ComputeTaskPayload", | ||
"nova_object.data": { | ||
"instance_uuid": "d5e6a7b7-80e5-4166-85a3-cd6115201082", | ||
"reason": {"$ref": "ExceptionPayload.json#"}, | ||
"request_spec": {"$ref": "RequestSpecPayload.json#"}, | ||
"state": "error" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
doc/notification_samples/common_payloads/ExceptionPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"nova_object.version": "1.1", | ||
"nova_object.namespace": "nova", | ||
"nova_object.name": "ExceptionPayload", | ||
"nova_object.data": { | ||
"function_name": "_schedule_instances", | ||
"module_name": "nova.conductor.manager", | ||
"exception": "NoValidHost", | ||
"exception_message": "No valid host was found. There are not enough hosts available.", | ||
"traceback": "Traceback (most recent call last):\n File \"nova/conductor/manager.py\", line ..." | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
doc/notification_samples/common_payloads/ImageMetaPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"nova_object.namespace": "nova", | ||
"nova_object.data": { | ||
"checksum": null, | ||
"container_format": "raw", | ||
"created_at": "2011-01-01T01:02:03Z", | ||
"direct_url": null, | ||
"disk_format": "raw", | ||
"id": "155d900f-4e14-4e4c-a73d-069cbf4541e6", | ||
"min_disk": 0, | ||
"min_ram": 0, | ||
"name": "fakeimage123456", | ||
"owner": null, | ||
"properties": {"$ref":"ImageMetaPropsPayload.json#"}, | ||
"protected": false, | ||
"size": 25165824, | ||
"status": "active", | ||
"tags": [ | ||
"tag1", | ||
"tag2" | ||
], | ||
"updated_at": "2011-01-01T01:02:03Z", | ||
"virtual_size": null, | ||
"visibility": "public" | ||
}, | ||
"nova_object.name": "ImageMetaPayload", | ||
"nova_object.version": "1.0" | ||
} |
8 changes: 8 additions & 0 deletions
8
doc/notification_samples/common_payloads/ImageMetaPropsPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"nova_object.namespace": "nova", | ||
"nova_object.data": { | ||
"hw_architecture": "x86_64" | ||
}, | ||
"nova_object.name": "ImageMetaPropsPayload", | ||
"nova_object.version": "1.0" | ||
} |
16 changes: 16 additions & 0 deletions
16
doc/notification_samples/common_payloads/InstanceNUMACellPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"nova_object.version": "1.0", | ||
"nova_object.namespace": "nova", | ||
"nova_object.name": "InstanceNUMACellPayload", | ||
"nova_object.data": { | ||
"cpu_pinning_raw": null, | ||
"cpu_policy": null, | ||
"cpu_thread_policy": null, | ||
"cpu_topology": null, | ||
"cpuset": [0], | ||
"cpuset_reserved": null, | ||
"id": 0, | ||
"memory": 512, | ||
"pagesize": null | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
doc/notification_samples/common_payloads/InstanceNUMATopologyPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"nova_object.version": "1.0", | ||
"nova_object.namespace": "nova", | ||
"nova_object.name": "InstanceNUMATopologyPayload", | ||
"nova_object.data": { | ||
"cells": [ | ||
{"$ref": "InstanceNUMACellPayload.json#"} | ||
], | ||
"emulator_threads_policy": null, | ||
"instance_uuid": "75cab9f7-57e2-4bd1-984f-a0383d9ee60e" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
doc/notification_samples/common_payloads/InstancePCIRequestsPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"nova_object.version": "1.0", | ||
"nova_object.namespace": "nova", | ||
"nova_object.name": "InstancePCIRequestsPayload", | ||
"nova_object.data":{ | ||
"instance_uuid": "d5e6a7b7-80e5-4166-85a3-cd6115201082", | ||
"requests": [] | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
doc/notification_samples/common_payloads/RequestSpecPayload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"nova_object.namespace": "nova", | ||
"nova_object.data": { | ||
"availability_zone": null, | ||
"flavor": { | ||
"$ref": "FlavorPayload.json#", | ||
"nova_object.data": { | ||
"extra_specs": { | ||
"hw:numa_cpus.0": "0", | ||
"hw:numa_mem.0": "512", | ||
"hw:numa_nodes": "1" | ||
} | ||
} | ||
}, | ||
"image": {"$ref": "ImageMetaPayload.json#"}, | ||
"instance_uuid": "d5e6a7b7-80e5-4166-85a3-cd6115201082", | ||
"num_instances": 1, | ||
"numa_topology": {"$ref": "InstanceNUMATopologyPayload.json#"}, | ||
"pci_requests": {"$ref": "InstancePCIRequestsPayload.json#"}, | ||
"project_id": "6f70656e737461636b20342065766572", | ||
"user_id": "fake" | ||
}, | ||
"nova_object.name": "RequestSpecPayload", | ||
"nova_object.version": "1.0" | ||
} |
6 changes: 6 additions & 0 deletions
6
doc/notification_samples/compute_task-build_instances-error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"event_type": "compute_task.build_instances.error", | ||
"payload": {"$ref":"common_payloads/ComputeTaskPayload.json#"}, | ||
"priority": "ERROR", | ||
"publisher_id": "nova-conductor:fake-mini" | ||
} |
11 changes: 11 additions & 0 deletions
11
doc/notification_samples/compute_task-migrate_server-error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"event_type": "compute_task.migrate_server.error", | ||
"payload": { | ||
"$ref":"common_payloads/ComputeTaskPayload.json#", | ||
"nova_object.data":{ | ||
"state": "active" | ||
} | ||
}, | ||
"priority": "ERROR", | ||
"publisher_id": "nova-conductor:fake-mini" | ||
} |
8 changes: 8 additions & 0 deletions
8
doc/notification_samples/compute_task-rebuild_server-error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"event_type": "compute_task.rebuild_server.error", | ||
"payload": { | ||
"$ref": "common_payloads/ComputeTaskPayload.json#" | ||
}, | ||
"priority": "ERROR", | ||
"publisher_id": "nova-conductor:fake-mini" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from nova.notifications.objects import base | ||
from nova.notifications.objects import request_spec as reqspec_payload | ||
from nova.objects import base as nova_base | ||
from nova.objects import fields | ||
|
||
|
||
@nova_base.NovaObjectRegistry.register_notification | ||
class ComputeTaskPayload(base.NotificationPayloadBase): | ||
# Version 1.0: Initial version | ||
VERSION = '1.0' | ||
|
||
fields = { | ||
'instance_uuid': fields.UUIDField(), | ||
# There are some cases that request_spec is None. | ||
# e.g. Old instances can still have no RequestSpec object | ||
# attached to them. | ||
'request_spec': fields.ObjectField('RequestSpecPayload', | ||
nullable=True), | ||
'state': fields.InstanceStateField(nullable=True), | ||
'reason': fields.ObjectField('ExceptionPayload') | ||
} | ||
|
||
def __init__(self, instance_uuid, request_spec, state, reason): | ||
super(ComputeTaskPayload, self).__init__() | ||
self.instance_uuid = instance_uuid | ||
self.request_spec = reqspec_payload.RequestSpecPayload( | ||
request_spec) if request_spec is not None else None | ||
self.state = state | ||
self.reason = reason | ||
|
||
|
||
@base.notification_sample('compute_task-build_instances-error.json') | ||
@base.notification_sample('compute_task-migrate_server-error.json') | ||
@base.notification_sample('compute_task-rebuild_server-error.json') | ||
@nova_base.NovaObjectRegistry.register_notification | ||
class ComputeTaskNotification(base.NotificationBase): | ||
# Version 1.0: Initial version | ||
VERSION = '1.0' | ||
|
||
fields = { | ||
'payload': fields.ObjectField('ComputeTaskPayload') | ||
} |
Oops, something went wrong.