Implements config_drive as extension

Adding config drive as an extension allows users to turn it off in case they
do not want to use it. Config drive was not intended to be a part of the core
functionality.

Fixes bug 833331

Change-Id: Icf4b5a21d8cc9df0f140a1a87908ff48c447004b
libvirt driver: set os_type to support xen hvm/pv

Generate libvirt config for xen hvm and pv guests based on instance
vm_mode. The vm_mode can be set via the vm_mode image property.

Use hvmloader for vm_mode.HVM guests. libvirt_type xen still defaults to
vm_mode.XEN (pv), to not change any behavior.

Change-Id: I5f92bedf6588ab2674d784772a5ecdb895fabe40
Revert "Add additional capabilities for computes"

This reverts commit bd30eb36bbf2c5164ac47256355c543f6b77e064.

From the original commit message:
" This is an interim solution to provide this functionality until
  it is replaced by more general HostAggregate functionality later
  in Folsom."

Now that general host aggregates is in, this is ready to be removed.

Partially implements blueprint general-host-aggregates

Change-Id: Ic5f418a5d15117888198c79c3a32cec8f19d1a88
Don't store system_metadata in xenstore

Fixes bug 1029774

system_metadata should not be exposed to users.

This reverts part of commit 82afe7ad5 / ChangeID I88a59f1b783

Change-Id: Id454dbcbafef861db3f88620a56d8dd2ccd30e1d
Sanitize xenstore keys for metadata injection

Xenstore only allows certain characters in key names.  Change disallowed
characters as well as '/' to '_'.

Fixes bug 1029773

Change-Id: I04055bfbe662f3f3e9d90336d03670aa5468e780
Merge "Revert "Add additional capabilities for computes""
Implements notifications for more instance changes

Now sends a notification of other changes in the instance besides state
changes. Adds access_ip in notifications as well.

fixes bug 1028559

Change-Id: I664e6b858eda17dd732927f2c9b259212084a8fa
Merge "Implements config_drive as extension"
Merge "Implements notifications for more instance changes"
Merge "Don't store system_metadata in xenstore"
Merge "Sanitize xenstore keys for metadata injection"
Convert to using dict style key lookups in XenAPI

Fixes bug 1030073

With instances being passed as dicts via the RPC API, uses of the instance
object should use dict style key lookups instead of attribute style
lookups.

Change-Id: Iefc0e403d440aada68b259ded457166ad10699fd
Remove ugly instance._rescue hack

The XenAPI driver would use _rescue to note when an instance was in
the process of being rescued. The existance of this attribute would
modify the 'name' property to append '-rescue' to the generated name.

Among the problems with it, it wasn't saved anywhere (with resulting
code to set it to False being unnecessary) and it led to "magic" code
(see instance.name) that was confusing without understanding the hack.

Change-Id: I1a91e4efdf69d4c1fba07658419f7bb30b733b5a
Fix HACKING violation in nova/api/openstack/volume/types.py

Change-Id: Ibd28e8de19eb6dc696ab67d2f58b4a14eb9f034f
xenapi: Use instance uuid when calling DB API

The preferred form of calling the DB API is to use the instance UUID
instead of the older instance id. Update that and use the dict form
to be more compatible with blueprint no-db-messaging.

Change-Id: Ib1a06b5385ec627f3daad5bafb3fa1be956a64e2
Add persistent volumes for tgtd.

Currently if you restart the server running nova-volume
or restart tgt, you will loose your iscsi targets that
have been created. This is not good.

In order for iscsi targets to be persistent across
reboots or restarts, one has to have the target's configuration
information in /etc/tgt/targets.conf or /etc/tgt/conf.d.
So when tgtd is restarted then the iscsi targets will be there
as expected.

This patch will add a configuration file to $state_path/volumes
when the volume is created. The configuration file is identified by
the volume uuid. It creates a logicalunit when the volume is created
as well. The iscsi target and configuration file
will be removed once the volume has been removed as well.

In order to use this, you have to include the following in
your /etc/tgt/targets.conf

include $state_path/volumes/*

For upgrades, it will just re-create the volumes
already in the volumes table.

Fixes LP: #1011159

Change-Id: I38fc096ab881ccb52cb688ae46d9d36b0a7b3a45
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Return location header on volume creation

Partially addresses LP 1026600

Normal RESTful idiom would dictate that the "Location" header is set
to reference the newly created resource.

We defer lining up the status code returned with generally accepted
RESTful convention (currently "200 OK", should be "201 Created" or
"202 Accepted") until the next API major version bump.

There is already substantial code duplication between the volumes API
and the os-volumes API extension - this will be addressed in a later
patch.

Change-Id: I166846a4cfea8adc8c156b8ae0e0d288681ac08c
Correct host count in instance_usage_audit_log extension.

This fixes bug 1030106. Basically we were not counting disabled hosts
in the total host count. Also I have refactored the get_audit_task_logs
method, it's really part of the extension (only the extension uses it),
so I've moved it out of nova.compute.utils into the extension itself.

(the tests that exercise it already lived in the extension's tests anyway.)

Change-Id: Iaf42d887b824ba0cbf6ab0ed143a4c01b37b0cb1
Merge "Fix HACKING violation in nova/api/openstack/volume/types.py"
Merge "xenapi: Use instance uuid when calling DB API"