Bug 1041054

Summary: [RFE][nova]: Allow Users to specify Guest shutdown behavior for Stop, Rescue, and Delete
Product: Red Hat OpenStack Reporter: RHOS Integration <rhos-integ>
Component: openstack-novaAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: nlevinki <nlevinki>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: berrange, dmaley, jdexter, lyarwood, markmc, ndipanov, sgordon, slong, yeylon
Target Milestone: Upstream M3Keywords: FutureFeature, Triaged
Target Release: 6.0 (Juno)   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/nova/+spec/user-defined-shutdown
Whiteboard: upstream_milestone_juno-3 upstream_status_implemented upstream_definition_approved
Fixed In Version: openstack-nova-2014.2.1-4.el7ost Doc Type: Enhancement
Doc Text:
Compute now automatically attempts a controlled shutdown for stop, rescue, and delete instance actions. If the controlled shutdown fails, Compute falls back to a forced shutdown.
Story Points: ---
Clone Of:
: 1159038 (view as bug list) Environment:
Last Closed: 2015-02-09 14:57:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description RHOS Integration 2013-12-12 13:31:05 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/nova/+spec/user-defined-shutdown.

Description:

Currently in libvirt stop, rescue, and delete operations 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.

This change exposed a clean / forced option to the users for those operations, mirroring soft and hard reboot

Specification URL (additional information):

None

Comment 4 Daniel Berrangé 2014-10-30 17:59:47 UTC
We would need to backport at least 4 commits from Juno


commit b252d603f473430211e1d39cda6ffeb833282e31
Author: Phil Day <philip.day>
Date:   Fri Aug 8 17:34:07 2014 +0000

    Shelve should give guests a chance to shutdown

 nova/compute/manager.py           |  5 +++--
 nova/tests/compute/test_shelve.py | 14 +++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)



commit 09b0ec5cf38ef92fc018f5776420e72879d6aa37
Author: Phil Day <philip.day>
Date:   Tue Aug 5 16:26:38 2014 +0000

    Rescue should give guests a chance to shutdown

 nova/compute/manager.py                |  4 +++-
 nova/tests/compute/test_compute_mgr.py | 18 ++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)



commit 41f6e4afc91a2454940abff947bf07973f229ea8
Author: Phil Day <philip.day>
Date:   Fri Jul 25 19:13:51 2014 +0000

    Resize should give guests a chance to shutdown

 nova/compute/manager.py            |  8 ++++++--
 nova/tests/compute/test_compute.py | 19 +++++++++++++++----
 nova/virt/driver.py                |  6 +++++-
 nova/virt/fake.py                  |  3 ++-
 nova/virt/hyperv/driver.py         |  4 +++-
 nova/virt/libvirt/driver.py        |  7 ++++---
 nova/virt/vmwareapi/driver.py      |  4 +++-
 nova/virt/xenapi/driver.py         |  4 +++-
 8 files changed, 41 insertions(+), 14 deletions(-)



commit c07ed15415c0ec3c5862f437f440632eff1e94df
Author: Phil Day <philip.day>
Date:   Fri Jan 24 15:43:20 2014 +0000

    Power off commands should give guests a chance to shutdown

 nova/compute/manager.py                      | 32 ++++++++++++++++++++++++++++++--
 nova/compute/utils.py                        | 19 +++++++++++++++++++
 nova/tests/api/ec2/test_cloud.py             |  3 ++-
 nova/tests/compute/test_compute.py           |  3 ++-
 nova/tests/compute/test_compute_utils.py     | 22 ++++++++++++++++++++++
 nova/tests/virt/libvirt/test_driver.py       | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 nova/tests/virt/test_ironic_api_contracts.py |  2 +-
 nova/virt/baremetal/driver.py                |  3 ++-
 nova/virt/driver.py                          |  5 ++++-
 nova/virt/fake.py                            |  2 +-
 nova/virt/hyperv/driver.py                   |  3 ++-
 nova/virt/libvirt/driver.py                  | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 nova/virt/vmwareapi/driver.py                |  3 ++-
 nova/virt/xenapi/driver.py                   |  3 ++-
 14 files changed, 243 insertions(+), 12 deletions(-)



None of the changes look particularly troublesome - fairly well self-contained code changes. There's no API impact on this - it was done with image properties instead.

Comment 5 Daniel Berrangé 2014-11-14 11:00:34 UTC
There is one further patch that missed Juno and is still pending review upstream

https://review.openstack.org/#/c/130548/

Comment 8 Summer Long 2015-01-15 03:08:08 UTC
Hi Dan, so it looks like shelve, shelve offload, rescue, resize, and power off all have a clean or forced option? I can't see new client parameters, how does the user specify this option? thanks, Summer

Comment 9 Daniel Berrangé 2015-01-15 12:10:29 UTC
In this version of patches the tenant user is not given any direct control over the feature. Nova will automatically try a controlled shutdown and fallback to forced shutdown.  The ability for end user to control this would require API changes and these will not be included until the Kilo releae.

Comment 11 errata-xmlrpc 2015-02-09 14:57:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2015-0152.html