Add CRUD methods for tags to the EC2 API.

This is an incomplete implementation of the EC2 tags API.  In EC2, most
resources are able to be tagged.  See
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html

In openstack, the only currently 'taggable' resource is an instance, as
it has an instance_metadata table associated.  So far, only instance
tagging has been implemented, but it is relatively simple to extend this
to other resource types by creating the associated model and api calls.

Additionally, in EC2 searches, shell-style globs are allowed, eg:
fo* will match fo, foo, foobar
fo? will match foo

This has been left to do at a later date.

DocImpact: Adds new API calls: CreateTags, DeleteTags, DescribeTags
See:
http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html
http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteTags.html
http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html

Fixes: bug #1096821
Implements: blueprint ec2-tags-api

Change-Id: Idf1108f6a3476cabdbdb32ff41c00aa4bc2d9ffe
Signed-off-by: Stephen Gran <stephen.gran@guardian.co.uk>
Guard against content being None

`content` can be passed in as None, so we need to set it to the empty
list if that occurs.

This also fixes the bad-practice of using a mutable data-type as a
default argument.

Fixes bug 1163598

Change-Id: Ie991c9452a21cfb036d3955a094ec345805d63d1
libvirt: Get driver type from base image type.

If we are using the raw backend (no cow), we should set the driver
type based on the type of the source image instead of always
using raw.

Calls to to_xml were moved after _create_image so that the image
type could be determined when creating the xml for libvirt.

Fixes bug 1163009

Change-Id: Ic8d5f0ab83d868a42f834d39c0afb64818d7e027
After migrate, catch and remove deleted instances

On the host init, starting with a deleted instance which has been
previously evacuated from the host results in an InstanceNotFound
exception. Catch and log this, and then call driver.destroy() so
that the hypervisor driver can clean up the deleted instance.

If we don't do this during host init, it will cause problems during
periodic tasks.

Fixes bug 1155152

Co-authored-by: Devananda van der Veen <devananda.vdv@gmail.com>

Change-Id: I979a698b8e739b9335f37b81e789285f91977a8e
Modify _verify_response to validate response codes.

The method will now take a response code as an additional
parameter and will validate it against the actual one.
Fixes bug 1156684

Change-Id: Idba3f54ed50b359d9230707fb45e7c5ea68e6b7d
Fix SecurityGroups XML sample tests

Fixes bug 1157521

Change-Id: I38ad52e0720feea37e8dbda8ad9c29162842c8f1
Fix legacy_net_info guard

The existing code assumes that `legacy_net_info` is always in legacy
mode, meaning a list of tuples which causes it to break when passed a
new-style NetworkInfo object.

Fixes bug 1164152

Change-Id: I2131d9b24045cd7531454b65d97776b11ec3ab02
Resolve conflicting mac address in resize

This patch fixes bug 1161226 and mac address conflicts when migrating or
resizing an instance using the PowerVM driver. This will ensure that if
a migration or resize is taking place on the same host, a temporary mac
address will be assigned to the original LPAR so there is no conflict on
the VIOS when a second LPAR is started with the same address.

Change-Id: I59db484defb789f3a7c0eddbd5ef9e92efc22419
Imported Translations from Transifex

Change-Id: I2abbf4025e7467a090efba9d1f7820a1fcac29d1
Fallback to conductor if types are not stashed.

If the instance types are not stashed, fallback to
the conductor API to retrieve them.

bug 1164110

Change-Id: I1f0ef48e072f8580980de5bd8d43cf2206cd7d27
Remove deprecated Grizzly code.

Now that Havana development has started remove code deprecated in Grizzly.

Change-Id: Ie3e7611347c334c359dea98d759345b97c66c9c1
Move console scripts to entrypoints.

As part of the move of plugins to entrypoints, take advantage of the
entrypoints based console scripts, which will make our command line scripts
available for unittesting.

Part of blueprint entrypoints-plugins

Co-authored-by: Michael Still <mikal@stillhq.com>

Change-Id: I5f17348b7b3cc896c92263dd518abb128757d81f
Merge "Guard against content being None"
Merge "Imported Translations from Transifex"
Merge "After migrate, catch and remove deleted instances"
Merge "Fix legacy_net_info guard"
baremetal: Integrate provisioning and non-provisioning interfaces

Originally, baremetal pxe/tilera driver managed two types of network
interfaces in two tables; provisioning interfaces in bm_nodes table
and non-provisioning (normal) interfaces in bm_interfaces table.
But, now actually both types are handled in the same way and there is
no difference between them except for which table they are in.

This patch moves the provisioning interfaces to bm_interfaces. However
it does not drop prov_mac_address in bm_nodes since VirtualPowerManager
still uses it to identify a target in a list of VMs returned by the
VM's host.

Change-Id: I5ce940e7127aa3b29ba7802612938dc5dbc3152f
Merge "Fallback to conductor if types are not stashed."
Merge "Remove deprecated Grizzly code."
Optimize resource tracker queries for instances

instance_get_all_by_host_and_node() had 4 different joins being done.
The resource tracker is the only consumer of this method and does not
need the joins.  This optimization will save many unnecessary rows from
being fetched during the update_available_resource() audit task.

Change-Id: I414c219e4563634e270007fe3d0fa980b273e795