Commit Graph

99 Commits

Author SHA1 Message Date
Takashi NATSUME bf17be9e8f Add 'updated_at' field to InstancePayload in notifications
Change-Id: Iddc5ec3b5053ddf5dce73c86edca26c4552d451b
Implements: bp versioned-notification-transformation-pike
Closes-Bug: #1684860
2017-07-25 19:31:21 +02:00
Kevin_Zheng f665565d69 Add tags to instance.create Notification
This patch added a new field 'tags' to InstanceCreatePayload.

Partial-implement: bp additional-notification-fields-for-searchlight
Partial-implement: blueprint support-tag-instance-when-boot

Change-Id: Iefaa9da4e136fd5e823bf7b11c8aa5b4cd6d7de8
2017-07-24 18:05:05 -04:00
Jenkins 5747308885 Merge "Handle Cinder 3.27 style attachments in swap_volume" 2017-07-17 21:33:21 +00:00
Balazs Gibizer 1928ec5606 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
2017-07-12 16:55:17 +02:00
Ildiko Vancsa ae53c22457 Handle Cinder 3.27 style attachments in swap_volume
This adds the support for new style volume attachments
to the swap volume operation.

If the existing volume attachment (old_volume) was created
using the new flow, it will have attachment_id set. Based
on that the API will create a new volume attachment for the
volume being swapped to and then pass that attachment to the
compute over RPC. Note that we do not yet create new-style
volume attachments so this is all no-op code for now. And
when we do start creating new-style volume attachments, that
will only be allowed when Cinder is new enough (3.27 microversion)
and all compute services are upgraded, so we don't perform
any nova-compute service version checks here.

Once on the compute, we key off the new_attachment_id being
passed from the API to tell if we should use the old or new
style calls to Cinder. For example, initialize_connection and
terminate_connection are replaced with attachment_update and
attachment_delete.

Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>
Co-Authored-By: John Griffith <john.griffith8@gmail.com>

Depends-On: I23391300468cc5e2f45a12d5ad8617ab48c21e6a

Partially Implements: blueprint cinder-new-attach-apis

Change-Id: I4b8bd01f1ffe2640fe7313213bf853d2e1bef9dd
2017-07-07 03:01:26 -04:00
Kevin_Zheng 115cf068a6 Don't delete neutron port when attach failed
Currently, when attaching neutron pre-existing
port to an instance, if the attach failed, it
will also be deleted in Neutron side due to
bad judgement of the who created the port by
reading not up-to-date info_cache.

The workflow starts at:
https://github.com/openstack/nova/blob/9ed0d6114/nova/network/neutronv2/api.py#L881
ordered_ports and preexisting_port_ids are
the same when attaching a preexisting port
to an instance and it calls
https://github.com/openstack/nova/blob/9ed0d6114/nova/network/base_api.py#L246
which calls back into the neutronv2 api code
https://github.com/openstack/nova/blob/9ed0d6114/nova/network/neutronv2/api.py#L1274
and at this point, compute_utils.refresh_info_cache_for_instance(context,
instance) won't have the newly attached port in it(see
debug log: http://paste.openstack.org/show/613232/)
because _build_network_info_model() is going to
process it. The instance obj in memoryt with old
info_cache will be used at rollback process and
causing the miss-judging.

This patch fixed it by updating instance.info_cache
to the new ic after it is created.

Co-Authored-By: huangtianhua@huawei.com
Change-Id: Ib323b74d4ea1e874b476ab5addfc6bc79cb7c751
closes-bug: #1645175
2017-07-03 15:40:12 +08:00
Balazs Gibizer bae0deb137 Add key_name field to InstancePayload
Add key_name field to InstancePayload which means every instance.<action>
notification now have key_name field based on the instance.key_name.

Change-Id: I39059c5077c790aa85dff6b4563f581c54536b86
Implements: bp additional-notification-fields-for-searchlight
2017-06-28 11:32:21 +02:00
Balazs Gibizer f756964b22 Add keypairs field to InstanceCreatePayload
Add keypairs field to instance.create notifications based on
instance.keypairs field.

Change-Id: I30e068d4de4b45f34308665de37d4cb9d6502111
Implements: bp additional-notification-fields-for-searchlight
2017-06-28 11:03:44 +02:00
Jenkins 520b6d6ba9 Merge "Plumbing for tagged nic attachment" 2017-06-27 08:07:53 +00:00
Jenkins 24b275756e Merge "Transform instance.live_migration_rollback notification" 2017-06-26 18:26:24 +00:00
Artom Lifshitz 0f3e85e136 Plumbing for tagged nic attachment
This patch adds support to the compute manager and Neutron API for
tagged attach for network interfaces.

Change-Id: I3ca96e6d791d609db8bf4368a3c71f880de8e7ad
Implements: blueprint virt-device-tagged-attach-detach
2017-06-23 20:06:42 +03:00
Artom Lifshitz 68c95c9290 Plumbing for tagged volume attachment
This patch adds support to the compute manager and API for tagged
attachment of block devices.

Change-Id: I1f25f8098a495c49e7021eb92b2cd5f048ced484
Implements: blueprint virt-device-tagged-attach-detach
2017-06-23 13:04:28 +03:00
JinLi 53bcae7f69 Transform instance.soft_delete notifications
The instance.soft_delete.start and instance.soft_delete.end notifications
are transformed to the versioned framework.

Change-Id: I608b13f843a623f549b38459902aaff287254a95
Co-Authored-By: Jin Li <jl7351@att.com>
Implements: bp versioned-notification-transformation-pike
2017-06-20 11:07:16 +02:00
Balazs Gibizer 3b72d60589 Add separate instance.create payload type
There are two parallel efforts to add new fields to the instance.create
notification only. Currently instance.create notification uses the generic
InstanceActionPayload ovo as the payload type. This patch creates a separate
InstanceCreatePayload ovo so that fields like keypairs and tags can be added
only to this specific payload class later in separate patches.

The keypair and tags field are not added directly to the base InstancePayload
class because both field need extra db query to fetch. So sending them at
every instance action (e.g. reboot) could cause db load.

The version of the instance.create payload is not bumped as the content
of the payload is the same just the name of the type is changed.

Change-Id: I90fb7beb450100de8f4e542921b99f043c529a0f
2017-06-16 15:28:57 +02:00
Béla Vancsics ad56be6d22 Transform keypair.create notification
The keypair.create.start and keypair.create.end notifications
has been transformed to the versioned notification framework.

Change-Id: I71e9d8dae55653ad3ee70f708a6d92c98ed20c1c
Implements: bp versioned-notification-transformation-pike
2017-06-14 07:28:47 +02:00
Jenkins aac977ebd3 Merge "Move rebuild notification tests into separate method" 2017-06-08 21:19:41 +00:00
Béla Vancsics ce893e37fa Transform instance.live_migration_rollback notification
Change-Id: Ic6cd58095cf5313325a7302a746467f57d0e0371
Implements: bp versioned-notification-transformation-pike
2017-06-08 21:03:33 +00:00
Gábor Antal 85d20dfa48 Move rebuild notification tests into separate method
The current rebuild testing in test_instance_action changes the image
used by the instance, therefore the actions tested in
test_instance_action had to be in specific order as testing rebuild
also changes the output json.

The rebuild test was moved from test_instance_action to its own method,
and now all the actions in test_instance_actions keeps the instance in
the same state.

Change-Id: Id0a7aaf8575d69deb89d3842b54fc23ee05b2153
Implements: bp versioned-notification-transformation-pike
2017-06-07 17:35:51 +02:00
Kevin_Zheng 1590f18c63 Send out notifications when instance tags changed
This patch adds notifications when instance
tags changed, as tag is commonly used for
searching and filtering, and projects like
searchlight depends on the notifications.

To avoid unnecessarily building a notification
payload when notifications are disabled, this
change also adds the if_notifications_enabled
decorator to send_instance_update_notification.

Change-Id: I03c8e8225e51fd80580772752c0b292987e34218
Implements: bp send-tag-notification
2017-06-06 12:53:28 -04:00
Jenkins 28ace935cd Merge "Don't lazy-load flavor.projects during destroy()" 2017-06-03 01:10:58 +00:00
Sergey Nikitin a6335343cf Replace diagnostics objects with Nova diagnostics objects
New objects are children of NovaObject class. Such parent
will give us a good control of objects versioning. Also it
will force contributors to dump objects version in case of
any changes. These objects will be used to transmit data
via RPC. Old objects were used only for storing data.
During RPC transmission they are transform into dictionaries.
It is not right approach because we will have some problems
in case of adding new diagnostics fields.

Version of compute RPC was bumped.

Also some changes were made in libvirt driver method
get_instance_diagnostics(). These changes were made to fill
new fields of 'Diagnostics' object.

Implementation of method get_instance_diagnostics()
for other virt drivers will be changed in future patches.

blueprint: restore-vm-diagnostics

Change-Id: I5e2d116df045f803c654f7810b939b5fc859cfbf
2017-05-30 00:39:45 +04:00
Jenkins 221427a043 Merge "Add uuid to service.update notification payload" 2017-05-15 10:40:37 +00:00
Jenkins 55a79f3bd7 Merge "Transform instance.volume_detach notification" 2017-05-05 17:50:19 +00:00
Jenkins bf5c0ffc76 Merge "Transform instance.volume_attach.error notification" 2017-05-05 13:34:56 +00:00
Matt Riedemann 14732e5571 Add uuid to service.update notification payload
Now that the services table has a uuid field and we'll be exposing
that out of the REST API, we should include the uuid in the
service.update notification payload.

Part of blueprint service-hyper-uuid-in-api

Change-Id: I8c400086a8dce9317a39f7e65c8d098d93af335d
2017-05-04 13:57:09 -04:00
Jenkins 31840ddfba Merge "Transform instance.volume_attach notification" 2017-05-04 00:23:33 +00:00
Gábor Antal 7fe677d71b Transform instance.volume_detach notification
Transform instance.volume_detach notification

Implements: bp versioned-notification-transformation-pike
Change-Id: I2d9af7c146681b2a20a1f1d8360c81d2e7d96796
2017-05-02 16:42:27 -04:00
Gábor Antal d34de60971 Transform instance.volume_attach.error notification
Change-Id: Id3a9e51e6256945e9b859ce62938e140580732e0
2017-05-02 16:38:45 -04:00
Gábor Antal 64ae9416e1 Transform instance.volume_attach notification
Change-Id: Ie10b3476c1d7cffeeb55d63cc8d9f2a166ec1109
Implements: bp versioned-notification-transformation-pike
2017-05-02 16:00:23 -04:00
Matt Riedemann 3936a3cfda Don't lazy-load flavor.projects during destroy()
When we destroy a flavor it's happening in the API database now.
Right after we delete the flavor, we send a delete notification
which will attempt to lazy-load projects, but because the flavor
is deleted, that will result in a FlavorNotFound from the API DB
in method _get_projects_from_db. Because of our fallback code to
the main cell DB we'll then call flavor_access_get_by_flavor_id
which returns an empty list and that's what goes into the
notification, but it's not accurate since the empty list implies
there are/were no projects with access to that flavor, when in
reality we don't know.

This handles the delete notification case by orphaning the flavor
object so that when the notification emit happens, the
NotificationPayloadBase gets an OrphanedObjectError and just
sets projects to None, which is a better representation in the
notification payload that we don't have that data.

The tests needed some work since they were not actually comparing
the payload to the flavor object before, they were comparing to
fields in the DB representation of the flavor, which doesn't
include the projects field as it's a joined column.

Change-Id: I6868efab22cf9f1eb9006589a5b62618434c3ba3
Closes-Bug: #1687012
2017-05-02 13:45:03 -04:00
Takashi NATSUME dccd839dfd Remove unnecessary execute permissions
TrivialFix
Change-Id: Ic3a634071b5b7629151f434c8549031b12f9baea
2017-05-02 14:39:25 +09:00
Sujitha bb7d5214a4 Adding auto_disk_config field to InstancePayload
Add auto_disk_config field to InstancePayload based on
instance.auto_disk_config boolean value. If true, set it to
AUTO else MANUAL.

Implements: bp additional-notification-fields-for-searchlight
Change-Id: I18af99479562e2fe5e74e6e1252b804b074fee58
2017-04-21 12:45:39 +02:00
Sujitha eb1ac77dd7 add tags field to instance.update notification
Tags field is added to the InstanceUpdatePayload based on the
tags field fo the related Instance object. Adding tags to instance.create
notification will be handled in the bp tag-instances-when-boot.

Implements: bp additional-notification-fields-for-searchlight

Change-Id: Ifad6487de200767fc16d035ad830c77bba49154a
2017-04-21 12:44:12 +02:00
Dan Smith 03b4c67b22 Set instance.availability_zone whenever we schedule
This ensures that instance.availability_zone reflects what AZ the
instance is actually in. In the case where no AZ was requested at
boot, previously this would always be some default value, which
isn't as useful to the things that need to consider what AZ the
instance is actually in (without doing all the aggregate math to
determine it on the fly).

Related to blueprint cells-aware-api
Change-Id: I8d426f2635232ffc4b510548a905794ca88d7f99
2017-03-23 09:30:40 -07:00
Jenkins 47d90a3028 Merge "Transform instance.reboot.error notification" 2017-03-18 23:20:25 +00:00
Jenkins dbbf5919ad Merge "Transform instance.reboot notifications" 2017-03-18 23:15:58 +00:00
Gábor Antal 896ee40d27 Transform instance.reboot.error notification
Change-Id: Icef17163538e3cff8242d12ae21ec2f0c19ee494
Implements: bp versioned-notification-transformation-pike
2017-03-16 14:43:50 +00:00
Maciej Szankin 391a0483e0 Transform instance.reboot notifications
instance.reboot notifications is transformed to the new versioned framework.

Co-Authored-By: Gábor Antal <antal@inf.u-szeged.hu>
Change-Id: Ie58365b9fea9e6d061cbcf1b59e61e276e3ff775
Implements: bp versioned-notification-transformation-pike
2017-03-16 15:38:38 +01:00
Stephen Finucane 66d7ca90d8 trivial: Remove \r\n line endings from JSON sample
These are invalid and are currently causing the docs target to fail.

Change-Id: I484f5b1b4785ce7b44992ca59f993c618f3ce0c2
Partial-Bug: #1673131
2017-03-15 16:03:28 +00:00
Gábor Antal 97084edce8 Transform instance.rebuild.error notification
Co-Authored-By: Gábor Antal <antal@inf.u-szeged.hu>
Change-Id: I8340817977ed7b15bb85d266de4fe9eedb0b0fa0
Implements: bp versioned-notification-transformation-pike
2017-03-12 11:45:19 -04:00
Alex Szarka 7e3b0ba179 Transform instance.rebuild notification
Handling rebuild.error:
https://review.openstack.org/#/c/396621/

Co-Authored-By: Béla Vancsics <vancsics@inf.u-szeged.hu>
Co-Authored-By: Gábor Antal <antal@inf.u-szeged.hu>
Change-Id: If624c2691830584851e9c97693cd7b7e73e73bb2
Implements: bp versioned-notification-transformation-pike
2017-03-12 11:40:27 -04:00
Balazs Gibizer 655942069a handle uninited fields in notification payload
Due to the not strict handling of uninitialized fields during
notification payload population it is possible that the emitted
notification missing some of the fields defined in the schema.

There are two problematic cases:
1) no load tirggered for lazy loaded fields. If the field was not
   loaded it is not added to the payload.
2) uninitialized, not lazy loadable fields are not added to the
   payload.

This patch makes sure that lazy load is triggered. If the field is
not lazy loadable and also not initialized then related payload
field will be set to None. If the payload field is not nullable
the code will fail to make sure that the inconsistency is detected.

The following changes cannot be split to different commits because
as soon as the generic schema population code is fixed every listed
notification starts behaving differently.

In some cases the availability_zone field of the Service object is left
unitialized by both the constructor and the obj_load_attr function this
caused that the availability_zone field of the service.update
notification was missing from the emitted notification payload.

The extra_specs field of the Flavor object is not lazy loadable and not
initialized in the Flavor destroy case. So the extra_specs field of the
FlavorPayload needed to be made nullable.

The projects field of the Flavor object is lazy loaded but when the
Flavor object is loaded as part of an Instance object Flavor is
orphaned and no lazy load is allowed on that Flavor object. In this
case the projects field of the FlavorPayload will be set to None to
signal that the information is not available. This also means that
the projects field of the FlavorPayload needed to be changed to
nullable.

The hosts and id fields of the Aggregate object is not initialized
during the create of the Aggregate before the aggregate.create.start
needs to be sent. Therefore these fields needs to be nullable.

Closes-Bug: #1653221
Change-Id: Ib122cd98ee0cc31938d5ff1d5c753053267a3bd4
2017-03-03 15:34:41 +01:00
Ildiko Vancsa 63805735c2 Remove check_attach
This patch finishes to remove the 'check_attach' call from Nova
completely. As Cinder already performs the required checks as part
of the 'reserve_volume' (os-reserve) call it is unnecessary to check the
statemachine in Nova also and it can lead to race conditions.

The missing 'reserve_volume' call is added to the BFV flow. In case of
build failure the volume will be locked in 'attaching' state until the
instance in ERROR state is cleaned up.

We also check AZ for each volume attach operation which we haven't
done for unshelve. A release note is added to enable 'cross_az_attach'
in case the user does not care about AZ.

The compute service version had to be bumped as the old computes still
perform 'check_attach', which will fail when the API reserves the
volume and the volume state moves to 'attaching'. If the computes
are not new enough the old check will be called as opposed to
'reserve_volume'.

Closes-Bug: #1581230
Change-Id: I3a3caa4c566ecc132aa2699f8c7e5987bbcc863a
2017-02-26 20:34:05 -05:00
Sylvain Bauza d486315e0c Block starting compute unless placement conf is provided
We need to signal that the compute is Ocata and since the placement is now
mandatory for Ocata, we want to hard-fail if the conf is not correct.

Depends-On: I573149b9415da2a8bb3951a4c4ce71c4c3e48c6f
Change-Id: I3919f652040f2be2641420dd469af01b268e65c9
2017-01-27 16:35:09 -08:00
Jenkins 5ba04f4335 Merge "Improve flavor sample in notification sample tests" 2017-01-23 15:03:31 +00:00
Jenkins 0308c00d0d Merge "Update notification for flavor" 2017-01-11 21:58:06 +00:00
Balazs Gibizer af17b95073 Improve flavor sample in notification sample tests
This patch adds an extra_specs key to the flavor used in the
instance action sample test to make the samples more realistic.

Change-Id: I5ec2b536469daaea16efb1ef1537a951dc52997a
Implements: bp flavor-notifications
2017-01-11 19:50:20 +01:00
Jenkins 799efc7631 Merge "Notifications for flavor operations" 2017-01-11 16:45:50 +00:00
Matt Riedemann e05f678e0a Update notification for flavor
This patch adds versioned notification for flavor update operation.

Implement blueprint: flavor-notifications

Change-Id: I770e3c0c1675bbb7844b13826f3fdc48ad5491a2
2017-01-11 11:16:49 -05:00
liyingjun 8d9b3d6b9d Notifications for flavor operations
This patch implements the versioned notifications for flavor
create and destroy.

Implement blueprint: flavor-notifications

Change-Id: Icc2169b87ffba4e7e2079076a82029156c584c6a
2017-01-09 20:39:58 +08:00