Updated openstack/openstack
Project: openstack/nova  b32d01d44ca5711c96d192df51bf7acd34f52556
null
Stop, Rescue, and Delete should give guest a chance to shutdown

Currently in libvirt stop, shelve, rescue, and delete simply
destroy the underlying VM. Some GuestOS's do not react well to this
type of power failure, and so it would be better if these operations
followed the same approach as soft_reboot and give the guest as
chance to shutdown gracefully.  Even where VM is being deleted,
it may be booted from a volume which will be reused on another
server.

The change is implemented by adding a clean_shutdown parameter
to the relevant methods from the compute/api layer downwards
and into the virt drivers.  The implementation in the libvirt
driver is also provided.  Other drivers are modified just to
expect the additional parameter.

The timer configuration value previous used by soft_reboot in
libvirt is moved up to virt/driver so it can be used by other drivers.

The timer logic itself is changed from simple loop counting with one
second sleeps to a more precise approach, since testing showed that
other calls in the loop could introduce a difference of up to +50% on
the expected duration. This can extent the default two minute to
three minutes, which would not be acceptable in some environments
and breaks some of the tempest tests.

A separate config value defines what the default shutdown
behaviour for delete should be (default False to keep compatibility
with current behaviour).

This code is structured to enable a subsequent API change to add
clean/forced options to the stop and delete methods

Also as a minor tidy-up moved the repeated definition of
FakeLoopingCall in test_libvirt be common across tests

Partially-Implements: blueprint user-defined-shutdown
Closes-Bug: #1196924

DocImpact

Change-Id: Ie69aa2621cb52d6fefdc19f664247b069d6782ee