Commit Graph

224 Commits

Author SHA1 Message Date
Dan Smith c935377531 Add Aggregate image caching progress notifications
This adds AggregateCacheNotification, related payload, and code in
conductor to emit this per-compute with progress information. This
also adds a "progress" phase to NotificationPhase, which allows for
start..progress..progress..end information for a single operation
(cache_images in this case).

Related to blueprint image-precache-support

Change-Id: I69ae26d4caf4b56ab2c4864455bfe9b5b736dbf3
2019-10-29 08:18:32 -07:00
Matt Riedemann d50efc337c Add notification sample test for aggregate.cache_images.start|end
This adds the functional notification sample test for the
aggregate.cache_images.start and aggregate.cache_images.end
versioned notifications.

I also added a comment to the docs builder code since it took
me a bit to figure out how to get the notification sample
linked into the docs, and for whatever reason figured that out
by looking through code rather than our nicely detailed docs
that already explain it.

Part of blueprint image-precache-support

Change-Id: I0869979a1b8a0966f0e7b49e5a5984f76d7d67cd
2019-10-25 10:38:19 -07:00
Stephen Finucane 59d00aac7c trivial: Change name of network provided by NeutronFixture
We do this because most of our sample tests are currently using a fake
network cache due to 'stub_compute_with_ips', and that fake cache uses
the name 'private' instead of 'private-network'. When we remove that in
a future change, there's going to be a lot of refactoring. Head some of
that off by just using the same name.

Change-Id: I6339005a0d49a6dfd376523d3f9e145a00cfc3bd
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-10-05 15:40:28 +01:00
Zuul ab36d1fd47 Merge "Enhance service restart in functional env" 2019-06-27 17:50:19 +00:00
Balazs Gibizer 2794748d9c Enhance service restart in functional env
Bugfix Icaf1bae8cb040b939f916a19ce026031ddb84af7 showed that restarting
a compute service in the functional env is unrealistic causing faults
to slip through. During that bug fix only the minimal change was done
in the functional env regarding compute service restart to reproduce
the reported fault. However the restart of the compute service could
be made even more realistic.

This patch simulates a compute service restart in the functional env
by stopping the original compute service and starting a totally new
compute service for the same host and node. This way we can make sure
that we get a brand new ComputeManager in the new service and no
state can leak between the old and the new service.

This change revealed another shortcoming of the functional env.
In the real world the nova-compute service could be restarted without
loosing any running servers on the compute host. But with the naive
implementation of this change the compute service is re-created. This
means that a new ComputeManager is instantiated that loads a new
FakeDriver instance as well. That new FakeDriver instance then reports
an empty hypervisor. This behavior is not totally unrealistic as it
simulates such a compute host restart that cleans the hypervisor state
as well (e.g. compute host redeployment). However this type of restart
shows another bug in the code path that destroys and deallocates
evacuated instance from the source host. Therefore this patch
implements the compute service restart in a way that simulates only a
service restart and not a full compute restart. A subsequent patch will
add a test that uses the clean hypervisor case to reproduces the
revealed bug.

Related-Bug: #1724172
Change-Id: I9d6cd6259659a35383c0c9c21db72a9434ba86b1
2019-06-25 16:11:02 +00:00
Sean Mooney 35a591d33d extend libvirt video model support
- This change extends the VideoModel field object to allow 3 new values
  (virtio, gop, none)
- This change makes the libvirt driver use ALL tuple from the
  nova.fields.VideoModel object instead of declaring a second
  tuple inline for validation.
- This change allows the virtio video model to now be used
  for all architectures when explicitly requested via the
  hw_video_model image metadata property
- This change introduces unit tests and a release note
  for the new capablities.

Change-Id: I2830ccfc81cfa9654cfeac7ad5effc294f523552
Implements: blueprint libvirt-video-device-models
2019-06-21 16:53:37 +01:00
Surya Seetharaman c541ace518 Microversion 2.73: Support adding the reason behind a server lock
This patch adds a new parameter ``locked_reason`` to
``POST /servers/{server_id}/action`` request where the
action is lock. It enables the user to specify a reason when locking
a server.

The locked_reason will be exposed through ``GET servers/{server_id}``,
``GET /servers/detail``, ``POST /servers/{server_id}/action``  where
the action is rebuild and ``PUT servers/{server_id}`` requests' responses.

The InstanceActionNotification will emit the locked_reason
along with the other instance details. This patch hence changes the
payload object to include the "locked_reason" field.

Note that "locked" will be allowed as a valid filtering/sorting parameter
for ``GET /servers/detail`` and ``GET /servers`` from this new microversion.

Implements blueprint add-locked-reason

Change-Id: I46edd595e7417c584106487123774a73c6dbe65e
2019-05-11 21:48:27 +00:00
Ifat Afek 0240c7b5b6 The field instance_name was added to InstanceCreatePayload
The field instance_name was missing from Nova instance notifications.
It was added to instance.create.* notifications, as discussed in:
http://lists.openstack.org/pipermail/openstack-discuss/2018-December/001141.html

Change-Id: I52f3186d1bcda0c23a471f9bfd2c55763262658f
2019-01-15 15:27:07 +00:00
Előd Illés 70c7ba7324 Transform scheduler.select_destinations notification
Transform the scheduler.select_destinations.start and
scheduler.select_destinations.end notifications to the
versioned notification framework.

Change-Id: I019e88fabd1d386c0d6395a7b1969315873485fd
Implements: bp versioned-notification-transformation-stein
2018-11-30 13:20:35 +01:00
Alex Szarka fe4e47d989 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
2018-11-21 16:23:28 +09:00
Takashi NATSUME 5859741f4d Transform volume.usage notification
The volume.usage notification has been transformed to
the versioned notification framework.

Change-Id: Ica45a95d26b602f9a149d42516baf4b84fc01cec
Implements: bp versioned-notification-transformation-stein
2018-10-09 06:28:11 +00:00
Zuul ba509fddd5 Merge "Follow up for Ib6f95c22ffd3ea235b60db4da32094d49c2efa2a" 2018-10-02 08:57:36 +00:00
Matt Riedemann 771b9eaa71 Null out instance.availability_zone on shelve offload
When a user shelve offloads a server, the compute manager
nulls out the instance host and node attributes. However
the availability_zone attribute is left set on the instance
so the API will show the instance as in an AZ when really
it's not, because an instance that is not on a host is not
in a host aggregate so it can't be in an AZ.

Keep in mind that there are two ways an instance can be in
an AZ:

1. The user specifically requests to create the server in
   the AZ.

2. The user does not request an AZ and one is assigned via
   the selected host during server create (or resize, etc).

For the first case, the server will always remain in the
user-requested AZ even after shelve/unshelve. But in the
second case, unshelving the server can result in the server
being spawned on a new host in a different AZ - the scheduler
does not restrict the AZ in that second case.

This change nulls out the instance.availability_zone just like
the host and node fields on shelve offload since it's
confusing to show a shelved offloaded server in an AZ that
doesn't have a host.

Final note: the _nil_out_instance_obj_host_and_node method
is also called during server create if the build fails and
is aborted or rescheduled to another host, and in the case
that unshelve fails. In the case of a server build reschedule,
conductor will set the instance.availability_zone appropriately
based on the alternate host for the reschedule. In the other
failure cases, leaving the instance AZ null is appropriate.

Change-Id: I25a4f36027390def83cfe25f4f3b4af9660da502
Closes-Bug: #1790221
2018-09-27 08:49:41 -04:00
Balazs Gibizer 669d6499ee Follow up for Ib6f95c22ffd3ea235b60db4da32094d49c2efa2a
This patch removes the host parameter of the
notify_about_instance_delete() call as it is always filled with
CONF.host value.

Change-Id: Iff3b605b9410d5a097b53f532870df65780bc1e4
Implements: bp versioned-notification-transformation-stein
2018-09-27 11:33:55 +02:00
Zuul 00dc4483b7 Merge "Transform missing delete notifications" 2018-09-26 20:51:26 +00:00
Gábor Antal c0e4e162ce Transform libvirt.error notification
The libvirt.error notification has been transformed to
the versioned notification framework.

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I7d2287ce06d77c0afdef0ea8bdfb70f6c52d3c50
Implements: bp versioned-notification-transformation-stein
2018-09-18 07:06:09 +00:00
Balazs Gibizer d3097e52b3 Transform missing delete notifications
The Iddbe50ce0ad3c14562df800bbc09ec5a7e840485 patch only considered
instance delete in the happy case when the instance is scheduled to a
compute successfully and the compute is available when the delete
action is executed. If the instance is never scheduled to a compute or
the compute is not available when the instance is deleted legacy delete
notifications are emitted from different places, compute.api instead of
compute.manager. The original patch missed these places.

There will be subsequent patch(es) handling the same edge cases
for soft_delete and force_delete.

Change-Id: If0693eab2ed31b5fbfe6cbafa5d67b69c2ed8442
Implements: bp versioned-notification-transformation-stein
2018-08-29 13:39:57 +02:00
Takashi NATSUME c2439bac7c Transform metrics.update notification
The metrics.update notification has been transformed to
the versioned notification framework.

Change-Id: I2f6aba0c032baf181b103d2a16b8e768815170c9
Implements: bp versioned-notification-transformation-rocky
2018-07-18 09:13:27 +09:00
Zuul 529621bbb1 Merge "Transform instance.live_migration_force_complete notification" 2018-07-16 16:33:35 +00:00
Zuul ae40af621f Merge "Microversion 2.64 - Use new format policy in server group" 2018-07-16 15:41:57 +00:00
Gábor Antal 23efc549a1 Transform instance.live_migration_force_complete notification
The instance.live_migration_force_complete.start and
instance.live_migration_force_complete.end notifications have been
transformed to the versioned notification framework.

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I2e9a474457a7597a9febc111b13a67ddcf45f29e
Implements: bp versioned-notification-transformation-rocky
2018-07-16 00:12:37 +09:00
Gábor Antal 6322cb6a18 Transform aggregate.update_prop notification
The aggregate.update_prop.start and aggregate.update_prop.end
notifications has been transformed to the versioned notification
framework.

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I37b19573b6d0e1131c446fcec361f01fa2560f82
Implements: bp versioned-notification-transformation-rocky
2018-07-15 23:36:31 +09:00
Zuul 202c147f3c Merge "Transform instance.live_migration_rollback_dest notification" 2018-07-15 13:25:45 +00:00
Zuul 13dbe1a58d Merge "Transform instance.live_migration_post notification" 2018-07-15 13:14:54 +00:00
Zuul 039f7e055e Merge "Transform instance.rebuild_scheduled notification" 2018-07-14 17:20:16 +00:00
Yikun Jiang 5cdb1ce26b Microversion 2.64 - Use new format policy in server group
Enable users to define the policy rules on server group policy
to meet more advanced policy requirement. This microversion
brings the following changes in server group APIs:

* Add  ``policy`` and ``rules`` fields in the request of POST
  ``/os-server-groups``.
* The ``policy`` and ``rules`` fields will be
  returned in response body of POST, GET ``/os-server-groups``
  API and GET ``/os-server-groups/{server_group_id}`` API.
* The ``policies`` and ``metadata`` fields have been removed
  from the response body of POST, GET ``/os-server-groups`` API
  and GET ``/os-server-groups/{server_group_id}`` API.

Part of blueprint: complex-anti-affinity-policies

Change-Id: I6911e97bd7f8df92511e90518dba21c127e106a5
2018-07-13 10:43:42 +08:00
Yikun Jiang c67ab38ea0 Add policy field to ServerGroup notification object
In this patch, the ServerGroupPayload is updated to include
the new ``policy`` field; the ``policies`` field is deprecated
for removal but still put into the notification payload for
backward compatibility.

Related to blueprint complex-anti-affinity-policies

Change-Id: Ie739ee8dec4685cd70e735ff83f7f30bc7e95a57
2018-07-12 10:00:05 +08:00
Gábor Antal ab2279eb09 Transform instance.rebuild_scheduled notification
The instance.rebuild_scheduled notification has been transformed
to the versioned notification framework.

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I640562b8dd049ff5b6fea9286dc3082b9d837ed3
Implements: bp versioned-notification-transformation-rocky
2018-07-09 09:55:40 +09:00
Béla Vancsics 379cf65d82 Transform instance.live_migration_post notification
The instance.live_migration_post.start and
instance.live_migration_post.end notifications have been transformed to
the versioned notification framework.

Co-Authored-By: Alex Szarka <szarka@inf.u-szeged.hu>
Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: If9993d5edab5a2f141387a8eb294a9645667ee6b
Implements: bp versioned-notification-transformation-rocky
2018-07-05 20:24:46 +09:00
Gábor Antal 8ddbe07e8f Transform instance.live_migration_rollback_dest notification
The instance.live_migration_rollback_dest.start and
instance.live_migration_rollback_dest.end notifications has been
transformed to the versioned notification framework.

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I8129cbd1785133d4cc1b70bbba6bd7fcc1d21f4a
Implements: bp versioned-notification-transformation-rocky
2018-07-05 13:19:32 +09:00
shuangyang.qian 2bca6431e6 Add action initiator attribute to the instance payload
The instance action notifications contain the user id and the
project id of the owner of the instance. However an instance
action might be initiated by another user. It could be another
user from the same project or can be an admin from the admin project.
To be able to distinguish between the user who initiated the instance
action from the user owning the instance we need to add two new
fields to the instance action notifications, action_initiator_user
and action_initiator_project

Change-Id: I649d8a27baa8840bc1bb567fef027c749c663432
Closes-bug: #1744658
Blueprint: add-action-initiator-to-instance-action-notifications
2018-07-03 18:45:44 +00:00
Takashi NATSUME 0083b58dc2 Remove unnecessary execute permissions of a file
TrivialFix
Change-Id: I7d014d62878e91b59bf9a52b0e1fe0f9c0c0cad0
2018-07-02 19:40:48 +09:00
Yikun Jiang 0b9b37fe9a Add instance.unlock notification
The instance.unlock versioned notification is introduced in this
patch.

The unlock operation just changes the instance.locked to False in
API, we send the notification after db operation.

Change-Id: Ic750c33b4f88ba9c62ea8cba86915c6010f2cd6f
blueprint: trigger-notifications-when-lock-unlock-instances
2018-06-25 19:25:39 +00:00
Yikun Jiang 102cdb9315 Add instance.lock notification
The instance.lock versioned notification is introduced in this
patch.

The lock operation just changes the instance.locked to True in
API, we send the notification after db operation.

Change-Id: I03a13afa91c29f4fee25336cb82ea5c887eae2f8
blueprint: trigger-notifications-when-lock-unlock-instances
2018-06-21 10:29:31 +08:00
Kevin_Zheng 2a0f2a0d27 Add full traceback to ExceptionPayload in versioned notifications
This patch adds full traceback to ExceptionPayload in versioned
notifications.

The instance fault field and instance-action REST API has already
provide the traceback to the admin users (controlable through policy)
and the notifications are also admin only things as they are emitted
to the message bus by default. So it is assumed that security is not
a bigger concern for the notification than for the REST API.

On the ML [1] post there was no objection to add new string field to the
ExceptionPayload that will hold the serialized traceback object.

[1] http://lists.openstack.org/pipermail/openstack-dev/2018-March/128105.html

Implements: blueprint add-full-traceback-to-error-notifications

Change-Id: Id587967ea4f9980c292492e2f659bf55fb037b28
2018-06-19 16:46:46 +08:00
Brianna Poulos e8ed9aacf8 Add notification support for trusted_certs
Add the 'trusted_image_certificates' field to InstanceCreatePayload
and InstanceActionRebuildPayload notifications.

Change-Id: Ib5b50a3889ab15d5aac992f92e9be372a915eeff
2018-06-14 16:16:00 +02:00
Zuul 9a09e9ec5e Merge "Transform instance.exists notification" 2018-06-12 14:49:32 +00:00
Alex Szarka e7bdd19f0e Transform instance.exists notification
This patch contains the instance.exists related notification
transformation. The functional test for instance_usage_audit
periodic task case is added in a subsequent patch.

Change-Id: I1a0afa0e8740c229db77c18b932e316196880de5
Implements: bp versioned-notification-transformation-rocky
2018-06-05 12:51:30 +00:00
Stephen Finucane a268905ea8 trivial: Fix file permissions
No reason for JSON samples to be executable.

Change-Id: I3ccfe4175b4c817a423ea4c79c28e33d6ad01f86
2018-05-03 10:48:39 +01:00
Kevin_Zheng 94de8d75ff Add request_id to instance action notifications
As it was agreed on the Rocky PTG [1] it is useful to have the
request_id of in the payload of every instance action versioned
notification. For example it could help the deployer connect
the state change described in the notification with the user
action, the request, on the REST API.

So this patch proposes to extend the InstanceActionPayload
versioned object with a new request_id field and populate
the request_id from the context object used for emitting
the instance action notifications.

[1] https://etherpad.openstack.org/p/nova-ptg-rocky L391

Implements: bp add-request-id-to-instance-action-notifications

Change-Id: I7243b60938d6e9c7c2bc2aacdba5c667cca8ec9b
2018-04-19 13:06:59 -04:00
Kevin_Zheng 586a18ab32 Deduplicate notification samples Rocky - 7
This patch refactors the sample files of:

* instance-update
* instance-update-tags

notifications to use a common InstanceUpdatePayload sample data.

Change-Id: I8720556ed8a9ce7f1db165a793fbb7070954cc5a
2018-04-19 20:33:17 +08:00
Zuul b86e5f6f82 Merge "Deduplicate notification samples Rocky - 6" 2018-04-18 01:45:16 +00:00
Zuul c4beb5c8b7 Merge "Deduplicate notification samples Rocky - 5" 2018-04-17 22:51:50 +00:00
Zuul f95c8c2ba5 Merge "Deduplicate notification samples Rocky - 4" 2018-04-17 22:51:42 +00:00
Zuul e1346ac8ca Merge "Deduplicate notification samples Rocky - 3" 2018-04-17 18:41:03 +00:00
Zuul b2e013a3a9 Merge "Deduplicate notification samples Rocky - 2" 2018-04-17 18:40:53 +00:00
Kevin_Zheng a687748cec Deduplicate notification samples Rocky - 6
This patch refactors the sample files of:

* instance-soft_delete-start
* instance-soft_delete-end
* instance-suspend-start
* instance-suspend-end
* instance-trigger_crash_dump-start
* instance-trigger_crash_dump-end

notifications to use a common InstanceActionPayload sample data.

Change-Id: I8c31f44a3a3460e044ff73e0779a08ae49133f64
2018-04-17 18:57:34 +02:00
Kevin_Zheng fd025e591b Deduplicate notification samples Rocky - 5
This patch refactors the sample files of:

* instance-live_migration_abort_start
* instance-live_migration_abort_end
* instance-shutdown-start
* instance-shutdown-end

notifications to use a common InstanceActionPayload sample data.

refactors the sample files:

* instance-snapshot-start
* instance-snapshot-end

notifications to use a common InstanceActionSnapshotPayload sample data.

Change-Id: I762b619c4410e3ff4a3660fc318832f81f523c05
2018-04-17 18:57:27 +02:00
Kevin_Zheng f9bb4dcb3a Deduplicate notification samples Rocky - 4
This patch refactors the sample files of:

* instance-volume_attach-start
* instance-volume_attach-end
* instance-volume_attach-error
* instance-volume_detach-start
* instance-volume_detach-end

notifications to use a common InstanceActionVolumePayload sample data.

and refactor:

* instance-volume_swap-start
* instance-volume_swap-end
* instance-volume_swap-error

notifications to use a common InstanceActionVolumeSwapPayload sample data

Change-Id: I51fd194ac3b95be96db2676b4abf3df5a14d0faa
2018-04-17 18:56:54 +02:00
Zuul 1599464c71 Merge "Deduplicate notification samples Rocky - 1" 2018-04-17 16:17:10 +00:00