Add BDM to InstancePayload

This patch adds bdm related data to InstancePayload. As loading BDM
can be expensive a new configuration flag 'bdms_in_notifications' is
introduced. If this is set to false (as by default) then the instance
notifications will contain 'null' value in block_devices field.
If this configuration flag is set to true then the block devices will
be loaded from the db and will be included in the notification payload.

Implements: bp additional-notification-fields-for-searchlight
Change-Id: I18e7483ec9a484a660e1d306fdc0986e1d5f952b
This commit is contained in:
Balazs Gibizer 2017-06-12 17:09:17 +02:00
parent 62e904bce5
commit 1928ec5606
60 changed files with 897 additions and 107 deletions

View File

@ -4,6 +4,7 @@
"nova_object.data":{
"architecture":"x86_64",
"availability_zone": "nova",
"block_devices":[],
"created_at":"2012-10-29T13:42:11Z",
"deleted_at":null,
"display_name":"some-server",
@ -81,7 +82,7 @@
},
"nova_object.name":"InstanceCreatePayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.4"
"nova_object.version":"1.5"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,7 @@
"nova_object.data":{
"architecture":"x86_64",
"availability_zone": "nova",
"block_devices":[],
"created_at":"2012-10-29T13:42:11Z",
"deleted_at":null,
"display_name":"some-server",
@ -78,7 +79,7 @@
},
"nova_object.name":"InstanceCreatePayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.4"
"nova_object.version":"1.5"
},
"priority":"ERROR",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,7 @@
"nova_object.data":{
"architecture":"x86_64",
"availability_zone": "nova",
"block_devices":[],
"created_at":"2012-10-29T13:42:11Z",
"deleted_at":null,
"display_name":"some-server",
@ -68,7 +69,7 @@
},
"nova_object.name":"InstanceCreatePayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.4"
"nova_object.version":"1.5"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,7 @@
"nova_object.data":{
"architecture":"x86_64",
"availability_zone": "nova",
"block_devices":[],
"created_at":"2012-10-29T13:42:11Z",
"deleted_at":"2012-10-29T13:42:11Z",
"display_name":"some-server",
@ -56,7 +57,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture": "x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture": "x86_64",
"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_name":"some-server",
@ -79,7 +91,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"ERROR",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture": "x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -3,7 +3,7 @@
"publisher_id": "nova-compute:compute",
"payload": {
"nova_object.namespace": "nova",
"nova_object.version":"1.3",
"nova_object.version": "1.4",
"nova_object.data": {
"node": "fake-mini",
"fault": null,
@ -65,6 +65,18 @@
"uuid": "b271fcb9-75c3-4c76-84eb-6ccad1150ece",
"locked": false,
"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"
}],
"ramdisk_id": "",
"architecture": null,
"progress": 0,

View File

@ -6,6 +6,18 @@
"state": "active",
"availability_zone": "nova",
"key_name": "my-key",
"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"
}],
"kernel_id": "",
"host_name": "some-server",
"progress": 0,
@ -78,7 +90,7 @@
"nova_object.namespace": "nova"
}
},
"nova_object.version":"1.3",
"nova_object.version": "1.4",
"nova_object.namespace": "nova"
},
"publisher_id": "nova-compute:compute",

View File

@ -5,7 +5,7 @@
"payload": {
"nova_object.name": "InstanceActionPayload",
"nova_object.namespace": "nova",
"nova_object.version":"1.3",
"nova_object.version": "1.4",
"nova_object.data": {
"display_description": "some-server",
"reservation_id": "r-rqe0mlje",
@ -67,6 +67,18 @@
],
"tenant_id": "6f70656e737461636b20342065766572",
"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"
}],
"host": "compute",
"image_uuid": "a2459075-d96c-40d5-893e-577ff92e721c",
"state": "active",

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -56,7 +68,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture": "x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture": "x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data":{
"architecture":"x86_64",
"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_name":"some-server",
@ -69,7 +81,7 @@
},
"nova_object.name":"InstanceActionPayload",
"nova_object.namespace":"nova",
"nova_object.version":"1.3"
"nova_object.version":"1.4"
},
"priority":"INFO",
"publisher_id":"nova-compute:compute"

View File

@ -12,6 +12,7 @@
"nova_object.version": "1.0"},
"auto_disk_config": "MANUAL",
"availability_zone": "nova",
"block_devices": [],
"bandwidth": [],
"created_at": "2012-10-29T13:42:11Z",
"deleted_at": null,
@ -85,7 +86,7 @@
"uuid": "d5ca7280-1f12-4238-a86f-378bb5d93c38"},
"nova_object.name": "InstanceUpdatePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.4"},
"nova_object.version": "1.5"},
"priority": "INFO",
"publisher_id": "nova-api:fake-mini"
}

View File

@ -12,6 +12,7 @@
"nova_object.version": "1.0"
},
"availability_zone": "nova",
"block_devices": [],
"bandwidth": [],
"created_at": "2012-10-29T13:42:11Z",
"deleted_at": null,
@ -74,7 +75,7 @@
"uuid": "c03c0bf9-f46e-4e4f-93f1-817568567ee2"},
"nova_object.name": "InstanceUpdatePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.4"},
"nova_object.version": "1.5"},
"priority": "INFO",
"publisher_id": "nova-compute:fake-mini"
}

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"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_name": "some-server",
@ -70,7 +82,7 @@
},
"nova_object.name": "InstanceActionVolumePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.1"
"nova_object.version": "1.2"
},
"priority": "INFO",
"publisher_id": "nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"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_name": "some-server",
@ -80,7 +92,7 @@
},
"nova_object.name": "InstanceActionVolumePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.1"
"nova_object.version": "1.2"
},
"priority": "ERROR",
"publisher_id": "nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"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_name": "some-server",
@ -70,7 +82,7 @@
},
"nova_object.name": "InstanceActionVolumePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.1"
"nova_object.version": "1.2"
},
"priority": "INFO",
"publisher_id": "nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"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_name": "some-server",
@ -70,7 +82,7 @@
},
"nova_object.name": "InstanceActionVolumePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.1"
"nova_object.version": "1.2"
},
"priority": "INFO",
"publisher_id": "nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"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_name": "some-server",
@ -70,7 +82,7 @@
},
"nova_object.name": "InstanceActionVolumePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.1"
"nova_object.version": "1.2"
},
"priority": "INFO",
"publisher_id": "nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"availability_zone": "nova",
"block_devices": [{
"nova_object.data": {
"boot_index": null,
"delete_on_termination": false,
"device_name": "/dev/sdb",
"tag": null,
"volume_id": "227cc671-f30b-4488-96fd-7d0bf13648d8"
},
"nova_object.name": "BlockDevicePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.0"
}],
"created_at": "2012-10-29T13:42:11Z",
"deleted_at": null,
"display_name": "some-server",
@ -71,7 +83,7 @@
},
"nova_object.name": "InstanceActionVolumeSwapPayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.3"
"nova_object.version": "1.4"
},
"priority": "INFO",
"publisher_id": "nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"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_name": "some-server",
@ -81,7 +93,7 @@
},
"nova_object.name": "InstanceActionVolumeSwapPayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.3"
"nova_object.version": "1.4"
},
"priority": "ERROR",
"publisher_id": "nova-compute:compute"

View File

@ -4,6 +4,18 @@
"nova_object.data": {
"architecture": "x86_64",
"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_name": "some-server",
@ -71,7 +83,7 @@
},
"nova_object.name": "InstanceActionVolumeSwapPayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.3"
"nova_object.version": "1.4"
},
"priority": "INFO",
"publisher_id": "nova-compute:compute"

View File

@ -117,6 +117,15 @@ topic queue in this list.
The list of versioned notifications is visible in
http://docs.openstack.org/developer/nova/notifications.html
"""),
cfg.BoolOpt(
'bdms_in_notifications',
default=False,
help="""
If enabled, include block device information in the versioned notification
payload. Sending block device information is disabled by default as providing
that information can incur some overhead on the system since the information
may need to be loaded from the database.
""")
]

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import nova.conf
from nova.notifications.objects import base
from nova.notifications.objects import flavor as flavor_payload
from nova.notifications.objects import keypair as keypair_payload
@ -17,6 +18,9 @@ from nova.objects import base as nova_base
from nova.objects import fields
CONF = nova.conf.CONF
@nova_base.NovaObjectRegistry.register_notification
class InstancePayload(base.NotificationPayloadBase):
SCHEMA = {
@ -58,7 +62,8 @@ class InstancePayload(base.NotificationPayloadBase):
# Version 1.1: add locked and display_description field
# Version 1.2: Add auto_disk_config field
# Version 1.3: Add key_name field
VERSION = '1.3'
# Version 1.4: Add BDM related data
VERSION = '1.4'
fields = {
'uuid': fields.UUIDField(),
'user_id': fields.StringField(nullable=True),
@ -92,6 +97,8 @@ class InstancePayload(base.NotificationPayloadBase):
'progress': fields.IntegerField(nullable=True),
'ip_addresses': fields.ListOfObjectsField('IpPayload'),
'block_devices': fields.ListOfObjectsField('BlockDevicePayload',
nullable=True),
'metadata': fields.DictOfStringsField(),
'locked': fields.BooleanField(),
@ -103,6 +110,9 @@ class InstancePayload(base.NotificationPayloadBase):
network_info = instance.get_network_info()
self.ip_addresses = IpPayload.from_network_info(network_info)
self.flavor = flavor_payload.FlavorPayload(flavor=instance.flavor)
# TODO(gibi): investigate the possibility to use already in scope bdm
# when available like in instance.create
self.block_devices = BlockDevicePayload.from_instance(instance)
self.populate_schema(instance=instance)
@ -114,7 +124,8 @@ class InstanceActionPayload(InstancePayload):
# Version 1.1: locked and display_description added to InstancePayload
# Version 1.2: Added auto_disk_config field to InstancePayload
# Version 1.3: Added key_name field to InstancePayload
VERSION = '1.3'
# Version 1.4: Add BDM related data
VERSION = '1.4'
fields = {
'fault': fields.ObjectField('ExceptionPayload', nullable=True),
}
@ -128,8 +139,9 @@ class InstanceActionPayload(InstancePayload):
class InstanceActionVolumePayload(InstanceActionPayload):
# Version 1.0: Initial version
# 1.1: Added key_name field to InstancePayload
# 1.2: Add BDM related data
VERSION = '1.1'
VERSION = '1.2'
fields = {
'volume_id': fields.UUIDField()
}
@ -148,7 +160,8 @@ class InstanceActionVolumeSwapPayload(InstanceActionPayload):
# Version 1.1: locked and display_description added to InstancePayload
# Version 1.2: Added auto_disk_config field to InstancePayload
# Version 1.3: Added key_name field to InstancePayload
VERSION = '1.3'
# Version 1.4: Add BDM related data
VERSION = '1.4'
fields = {
'old_volume_id': fields.UUIDField(),
'new_volume_id': fields.UUIDField(),
@ -173,7 +186,8 @@ class InstanceCreatePayload(InstanceActionPayload):
# have decreasing version.
# 1.3: Add keypairs field
# 1.4: Add key_name field to InstancePayload
VERSION = '1.4'
# 1.5: Add BDM related data to InstancePayload
VERSION = '1.5'
fields = {
'keypairs': fields.ListOfObjectsField('KeypairPayload')
@ -194,7 +208,8 @@ class InstanceUpdatePayload(InstancePayload):
# Version 1.2: Added tags field
# Version 1.3: Added auto_disk_config field to InstancePayload
# Version 1.4: Added key_name field to InstancePayload
VERSION = '1.4'
# Version 1.5: Add BDM related data
VERSION = '1.5'
fields = {
'state_update': fields.ObjectField('InstanceStateUpdatePayload'),
'audit_period': fields.ObjectField('AuditPeriodPayload'),
@ -291,6 +306,48 @@ class AuditPeriodPayload(base.NotificationPayloadBase):
self.audit_period_ending = audit_period_ending
@nova_base.NovaObjectRegistry.register_notification
class BlockDevicePayload(base.NotificationPayloadBase):
# Version 1.0: Initial version
VERSION = '1.0'
SCHEMA = {
'device_name': ('bdm', 'device_name'),
'boot_index': ('bdm', 'boot_index'),
'delete_on_termination': ('bdm', 'delete_on_termination'),
'volume_id': ('bdm', 'volume_id'),
'tag': ('bdm', 'tag')
}
fields = {
'device_name': fields.StringField(nullable=True),
'boot_index': fields.IntegerField(nullable=True),
'delete_on_termination': fields.BooleanField(default=False),
'volume_id': fields.UUIDField(),
'tag': fields.StringField(nullable=True)
}
def __init__(self, bdm):
super(BlockDevicePayload, self).__init__()
self.populate_schema(bdm=bdm)
@classmethod
def from_instance(cls, instance):
"""Returns a list of BlockDevicePayload objects based on the passed
bdms.
"""
if not CONF.notifications.bdms_in_notifications:
return None
instance_bdms = instance.get_bdms()
bdms = []
if instance_bdms is not None:
for bdm in instance_bdms:
if bdm.volume_id is not None:
bdms.append(cls(bdm))
return bdms
@nova_base.NovaObjectRegistry.register_notification
class InstanceStateUpdatePayload(base.NotificationPayloadBase):
# Version 1.0: Initial version

View File

@ -1168,6 +1168,10 @@ class Instance(base.NovaPersistentObject, base.NovaObject,
return network_model.NetworkInfo.hydrate([])
return self.info_cache.network_info
def get_bdms(self):
return objects.BlockDeviceMappingList.get_by_instance_uuid(
self._context, self.uuid)
def _make_instance_list(context, inst_list, db_inst_list, expected_attrs):
get_fault = expected_attrs and 'fault' in expected_attrs

View File

@ -1267,13 +1267,13 @@ class CinderFixture(fixtures.Fixture):
},
'attach_status': 'attached'
})
return volume
return volume
# Check to see if the volume is attached.
for instance_uuid, volumes in self.attachments.items():
if volume_id in volumes:
# The volume is attached.
return {
volume = {
'status': 'in-use',
'display_name': volume_id,
'attach_status': 'attached',
@ -1286,15 +1286,23 @@ class CinderFixture(fixtures.Fixture):
}
}
}
break
else:
# This is a test that does not care about the actual details.
volume = {
'status': 'available',
'display_name': 'TEST2',
'attach_status': 'detached',
'id': volume_id,
'size': 1
}
# This is a test that does not care about the actual details.
return {
'status': 'available',
'display_name': 'TEST2',
'attach_status': 'detached',
'id': volume_id,
'size': 1
}
# update the status based on existing attachments
has_attachment = any(
[volume['id'] in attachments
for attachments in self.attachments.values()])
volume['status'] = 'attached' if has_attachment else 'detached'
return volume
def fake_initialize_connection(self, context, volume_id, connector):
if volume_id == CinderFixture.SWAP_ERR_NEW_VOL:

View File

@ -247,3 +247,8 @@ class NotificationSampleTestBase(test.TestCase,
(event_type, expected_count, len(notifications),
notifications))
return notifications
def _attach_volume_to_server(self, server, volume_id):
self.api.post_server_volume(
server['id'], {"volumeAttachment": {"volumeId": volume_id}})
self._wait_for_notification('instance.volume_attach.end')

View File

@ -27,6 +27,7 @@ class TestInstanceNotificationSampleWithMultipleCompute(
def setUp(self):
self.flags(use_neutron=True)
self.flags(bdms_in_notifications='True', group='notifications')
super(TestInstanceNotificationSampleWithMultipleCompute, self).setUp()
self.neutron = fixtures.NeutronFixture(self)
self.useFixture(self.neutron)
@ -37,6 +38,7 @@ class TestInstanceNotificationSampleWithMultipleCompute(
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]})
self._wait_for_notification('instance.create.end')
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
# server will boot on host1
self.useFixture(fixtures.ConfPatcher(host='host2'))
self.compute2 = self.start_service('compute', host='host2')
@ -85,6 +87,7 @@ class TestInstanceNotificationSample(
def setUp(self):
self.flags(use_neutron=True)
self.flags(bdms_in_notifications='True', group='notifications')
super(TestInstanceNotificationSample, self).setUp()
self.neutron = fixtures.NeutronFixture(self)
self.useFixture(self.neutron)
@ -121,6 +124,8 @@ class TestInstanceNotificationSample(
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]})
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
actions = [
self._test_power_off_on_server,
self._test_restore_server,
@ -136,7 +141,7 @@ class TestInstanceNotificationSample(
self._test_reboot_server,
self._test_reboot_server_error,
self._test_trigger_crash_dump,
self._test_volume_attach_detach_server,
self._test_volume_detach_attach_server,
self._test_rescue_server,
self._test_unrescue_server,
self._test_soft_delete_server,
@ -152,15 +157,18 @@ class TestInstanceNotificationSample(
def test_create_delete_server(self):
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]})
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
self.api.delete_server(server['id'])
self._wait_until_deleted(server)
self.assertEqual(7, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(9, len(fake_notifier.VERSIONED_NOTIFICATIONS))
# This list needs to be in order.
expected_notifications = [
'instance-create-start',
'instance-create-end',
'instance-update-tags-action',
'instance-volume_attach-start',
'instance-volume_attach-end',
'instance-delete-start',
'instance-shutdown-start',
'instance-shutdown-end',
@ -223,6 +231,7 @@ class TestInstanceNotificationSample(
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]})
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
instance_updates = self._wait_for_notifications('instance.update', 8)
@ -336,7 +345,19 @@ class TestInstanceNotificationSample(
'out_bytes': 0,
'in_bytes': 0},
'nova_object.version': '1.0'}],
'tags': ["tag1"]
'tags': ["tag1"],
'block_devices': [{
"nova_object.data": {
"boot_index": None,
"delete_on_termination": False,
"device_name": "/dev/sdb",
"tag": None,
"volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113"
},
"nova_object.name": "BlockDevicePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.0"
}]
},
# deleting -> deleted
@ -350,7 +371,19 @@ class TestInstanceNotificationSample(
'ip_addresses': [],
'power_state': 'pending',
'bandwidth': [],
'tags': ["tag1"]
'tags': ["tag1"],
'block_devices': [{
"nova_object.data": {
"boot_index": None,
"delete_on_termination": False,
"device_name": "/dev/sdb",
"tag": None,
"volume_id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113"
},
"nova_object.name": "BlockDevicePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.0"
}]
},
]
@ -635,6 +668,7 @@ class TestInstanceNotificationSample(
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]})
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
fake_notifier.reset()
@ -652,19 +686,38 @@ class TestInstanceNotificationSample(
self._wait_for_state_change(self.api, server,
expected_status='ACTIVE')
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
# The compute/manager will detach every volume during rebuild
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self._verify_notification(
'instance-rebuild-start',
replacements={
'reservation_id': server['reservation_id'],
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
self._verify_notification(
'instance-volume_detach-start',
replacements={
'reservation_id': server['reservation_id'],
'task_state': 'rebuilding',
'architecture': None,
'image_uuid': 'a2459075-d96c-40d5-893e-577ff92e721c',
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
self._verify_notification(
'instance-volume_detach-end',
replacements={
'reservation_id': server['reservation_id'],
'task_state': 'rebuilding',
'architecture': None,
'image_uuid': 'a2459075-d96c-40d5-893e-577ff92e721c',
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
self._verify_notification(
'instance-rebuild-end',
replacements={
'reservation_id': server['reservation_id'],
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
@mock.patch('nova.compute.manager.ComputeManager.'
'_do_rebuild_instance_with_claim')
@ -675,6 +728,7 @@ class TestInstanceNotificationSample(
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]})
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
fake_notifier.reset()
@ -761,11 +815,6 @@ class TestInstanceNotificationSample(
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
def _attach_volume_to_server(self, server, volume_id):
self.api.post_server_volume(
server['id'], {"volumeAttachment": {"volumeId": volume_id}})
self._wait_for_notification('instance.volume_attach.end')
def _detach_volume_from_server(self, server, volume_id):
self.api.delete_server_volume(server['id'], volume_id)
self._wait_for_notification('instance.volume_detach.end')
@ -824,11 +873,24 @@ class TestInstanceNotificationSample(
# 6. instance-volume_swap-error
# 7. compute.exception
self.assertLessEqual(7, len(fake_notifier.VERSIONED_NOTIFICATIONS))
block_devices = [{
"nova_object.data": {
"boot_index": None,
"delete_on_termination": False,
"device_name": "/dev/sdb",
"tag": None,
"volume_id": self.cinder.SWAP_ERR_OLD_VOL
},
"nova_object.name": "BlockDevicePayload",
"nova_object.namespace": "nova",
"nova_object.version": "1.0"
}]
self._verify_notification(
'instance-volume_swap-start',
replacements={
'new_volume_id': self.cinder.SWAP_ERR_NEW_VOL,
'old_volume_id': self.cinder.SWAP_ERR_OLD_VOL,
'block_devices': block_devices,
'reservation_id': server['reservation_id'],
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[5])
@ -836,6 +898,7 @@ class TestInstanceNotificationSample(
'instance-volume_swap-error',
replacements={
'reservation_id': server['reservation_id'],
'block_devices': block_devices,
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[6])
@ -848,26 +911,7 @@ class TestInstanceNotificationSample(
def _test_trigger_crash_dump(self, server):
pass
def _test_volume_attach_detach_server(self, server):
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
# 0. volume_attach-start
# 1. volume_attach-end
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self._verify_notification(
'instance-volume_attach-start',
replacements={
'reservation_id': server['reservation_id'],
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
self._verify_notification(
'instance-volume_attach-end',
replacements={
'reservation_id': server['reservation_id'],
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
fake_notifier.reset()
def _test_volume_detach_attach_server(self, server):
self._detach_volume_from_server(server, self.cinder.SWAP_OLD_VOL)
# 0. volume_detach-start
@ -886,6 +930,25 @@ class TestInstanceNotificationSample(
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
fake_notifier.reset()
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
# 0. volume_attach-start
# 1. volume_attach-end
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self._verify_notification(
'instance-volume_attach-start',
replacements={
'reservation_id': server['reservation_id'],
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
self._verify_notification(
'instance-volume_attach-end',
replacements={
'reservation_id': server['reservation_id'],
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
def _test_rescue_server(self, server):
pass
@ -921,11 +984,31 @@ class TestInstanceNotificationSample(
reason="Connection timed out")
mock_attach.side_effect = attach_volume
post = {"volumeAttachment": {"volumeId": self.cinder.SWAP_OLD_VOL}}
post = {"volumeAttachment": {"volumeId": self.cinder.SWAP_NEW_VOL}}
self.api.post_server_volume(server['id'], post)
self._wait_for_notification('instance.volume_attach.error')
block_devices = [
# Add by default at boot
{'nova_object.data': {'boot_index': None,
'delete_on_termination': False,
'tag': None,
'device_name': '/dev/sdb',
'volume_id': self.cinder.SWAP_OLD_VOL},
'nova_object.name': 'BlockDevicePayload',
'nova_object.namespace': 'nova',
'nova_object.version': '1.0'},
# Attaching it right now
{'nova_object.data': {'boot_index': None,
'delete_on_termination': False,
'tag': None,
'device_name': '/dev/sdc',
'volume_id': self.cinder.SWAP_NEW_VOL},
'nova_object.name': 'BlockDevicePayload',
'nova_object.namespace': 'nova',
'nova_object.version': '1.0'}]
# 0. volume_attach-start
# 1. volume_attach-error
# 2. compute.exception
@ -936,11 +1019,15 @@ class TestInstanceNotificationSample(
'instance-volume_attach-start',
replacements={
'reservation_id': server['reservation_id'],
'block_devices': block_devices,
'volume_id': self.cinder.SWAP_NEW_VOL,
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
self._verify_notification(
'instance-volume_attach-error',
replacements={
'reservation_id': server['reservation_id'],
'block_devices': block_devices,
'volume_id': self.cinder.SWAP_NEW_VOL,
'uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])

View File

@ -21,9 +21,11 @@ from nova import exception
from nova.network import model as network_model
from nova.notifications import base as notification_base
from nova.notifications.objects import base as notification
from nova.notifications.objects import instance as instance_notification
from nova import objects
from nova.objects import base
from nova.objects import fields
from nova.objects import instance as instance_obj
from nova import test
from nova.tests.unit.objects import test_objects
from nova.tests import uuidsentinel as uuids
@ -369,24 +371,25 @@ notification_object_data = {
'AggregatePayload': '1.1-1eb9adcc4440d8627de6ec37c6398746',
'AuditPeriodPayload': '1.0-2b429dd307b8374636703b843fa3f9cb',
'BandwidthPayload': '1.0-ee2616a7690ab78406842a2b68e34130',
'BlockDevicePayload': '1.0-29751e1b6d41b1454e36768a1e764df8',
'EventType': '1.5-ffa6d332f4462c45a2a363356a14165f',
'ExceptionNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'ExceptionPayload': '1.0-27db46ee34cd97e39f2643ed92ad0cc5',
'FlavorNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'FlavorPayload': '1.3-6335e626893d7df5f96f87e6731fef56',
'InstanceActionNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'InstanceActionPayload': '1.3-b57b9564bf5a180c9d3999dfc2be4e29',
'InstanceActionPayload': '1.4-2a206cf87e4060c2ec43ed71c4a2ed42',
'InstanceActionVolumeNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'InstanceActionVolumePayload': '1.1-77163365e23cfff0bffa47d4ca5bf62e',
'InstanceActionVolumePayload': '1.2-414024a2ea54cf842482c1c6a4bef013',
'InstanceActionVolumeSwapNotification':
'1.0-a73147b93b520ff0061865849d3dfa56',
'InstanceActionVolumeSwapPayload': '1.3-5efb715850d07c496447009ca14cec83',
'InstanceActionVolumeSwapPayload': '1.4-8b82cef523c62020c24b3eb1c39ea2ef',
'InstanceCreateNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'InstanceCreatePayload': '1.4-125ba6eacf5a567213600221b1e4a74c',
'InstancePayload': '1.3-7c6f0360955b22b492d6eaedd2192001',
'InstanceCreatePayload': '1.5-97e9c0f516a68f20b25ce2f994cab081',
'InstancePayload': '1.4-46d922bd0a5cce46398b0cf7e8735fc4',
'InstanceStateUpdatePayload': '1.0-07e111c0fa0f6db0f79b0726d593e3da',
'InstanceUpdateNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'InstanceUpdatePayload': '1.4-052b015d109385f3cbb2f1a0f33381c2',
'InstanceUpdatePayload': '1.5-ec4d3d9c809842b1dcf4739b1d788f32',
'IpPayload': '1.0-8ecf567a99e516d4af094439a7632d34',
'KeypairNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'KeypairPayload': '1.0-6daebbbde0e1bf35c1556b1ecd9385c1',
@ -533,3 +536,50 @@ class TestInstanceNotification(test.NoDBTestCase):
self.assertFalse(mock_payload.called)
self.assertFalse(mock_notification.called)
class TestBlockDevicePayload(test.NoDBTestCase):
@mock.patch('nova.objects.instance.Instance.get_bdms')
def test_payload_contains_volume_bdms_if_requested(self, mock_get_bdms):
self.flags(bdms_in_notifications='True', group='notifications')
context = mock.Mock()
instance = instance_obj.Instance(uuid=uuids.instance_uuid)
image_bdm = objects.BlockDeviceMapping(
**{'context': context, 'source_type': 'image',
'destination_type': 'local',
'image_id': uuids.image_id,
'volume_id': None,
'device_name': '/dev/vda',
'instance_uuid': instance.uuid})
volume_bdm = objects.BlockDeviceMapping(
**{'context': context, 'source_type': 'volume',
'destination_type': 'volume',
'volume_id': uuids.volume_id,
'device_name': '/dev/vdb',
'instance_uuid': instance.uuid,
'boot_index': 0,
'delete_on_termination': True,
'tag': 'my-tag'})
mock_get_bdms.return_value = [image_bdm, volume_bdm]
bdms = instance_notification.BlockDevicePayload.from_instance(
instance)
self.assertEqual(1, len(bdms))
bdm = bdms[0]
self.assertIsInstance(bdm, instance_notification.BlockDevicePayload)
self.assertEqual('/dev/vdb', bdm.device_name)
self.assertEqual(0, bdm.boot_index)
self.assertTrue(bdm.delete_on_termination)
self.assertEqual('my-tag', bdm.tag)
self.assertEqual(uuids.volume_id, bdm.volume_id)
@mock.patch('nova.objects.instance.Instance.get_bdms',
return_value=mock.NonCallableMock())
def test_bdms_are_skipped_by_default(self, mock_get_bdms):
instance = instance_obj.Instance(uuid=uuids.instance_uuid)
bmds = instance_notification.BlockDevicePayload.from_instance(
instance)
self.assertIsNone(bmds)