Allow controlled shutdown of GuestOS for operations which power off the VM

Powering off a VM without giving the Guest Operating system a chance
to perform a controlled shutdown can lead to data corruption.

The proposed changes will make the default behavior for stop, rescue, resize,
and shelve to give the GuestOS a chance to perform a controlled shutdown
before the VM is powered off.

The change will encapsulate the complexity of signaling to and waiting for
the GuestOS in the hypervisor, and allow image owners the ability to tune
the associated timing via image metadata to take account of GuestOSs that
require an extended period to shutdown (such as Windows).

Users will be able to specify the shutdown behavior on a per operation basis
via a new shutdown_type parameter where, in keeping with the current reboot
operation, a "soft" shutdown will give the GuestOS a chance to perform a
clean shutdown, and a "hard" shutdown will cause an immediate power off.  The
default behavior will be a "soft" shutdown.

https://blueprints.launchpad.net/nova/+spec/user-defined-shutdown

Change-Id: Ie2c13c9173566c6d545fcaf6a3ab88df636a7d33
Merge "Allow controlled shutdown of GuestOS for operations which power off the VM"