Support EC2 API wildcards for DescribeTags filters

The EC2 API supports glob-style wildcards in filters.

From http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html:

"You can use wildcards in a filter value. An asterisk (*) matches zero or more characters, and
a question mark (?) matches exactly one character. You can escape special characters using a
backslash (\) before the character. For example, a value of \*amazon\?\\ searches for the literal
string *amazon?\."

This patch converts the glob-style regex to a python regex and uses re.match to do the rest. The
approach to the conversion was taken from the python fnmatch library.

Fixes bug #1205099

Change-Id: Ie9cac182faabf50fc0d40480db39a46a7e97fbec
Add task_state filter for nova list

e.g. nova list --status REBOOT

Fixes: bug #1196999

Change-Id: I55f3367952c1de756a1a87c7313a0dbb2da3f613
Put fault message in the correct field

Currently when adding an instance fault, the message field looks
for kwargs['value'], which many exceptions do not have.  This
results in the message field being set to the name of the
exception class, which in some cases is not useful (see the bug
report for an example).

This change puts the exception message in the message field, and
removes it from the details field since there's no need to put it
in both places.  That leaves the details field for actual details,
like stack traces.

Fixes bug 1203880

Change-Id: Ic92a9bd9cb2e139ce7a9f3f1299b7a6ccae82dd1
Fix EC2 API Fault wrapper

Fault wrapper now returns actual EC2 error code instead of HTTP
status code which was ridiculously incorrect behavior.

Fault:__call__ wasn't covered by any unit tests, so I added one.

Implements: blueprint ec2-error-codes
Change-Id: I41f7f0aa09e2925882a0da941f9ea5d4e694e65c
xenapi: test functions for _stream_disk

Add test cases to cover nova.virt.xenapi.vm_utils:_stream_disk, so that
it could be refactored/extended without fear.

Change-Id: Ice43218680d2d5dffad51155cd8da2c2ad2e2cfa
xenapi: refactor - extract get_stream_funct_for

This change extracts the get_stream_funct_for function. As we would like
to support tar.gz compressed raw images, the stream function for them
should be different from the plain ones.

related to blueprint xenapi-supported-image-import-export

Change-Id: I27681da069ba2cd23670ef41f54ed9ac5af31ae6
Fix message for server name with whitespace

Change-Id: I9007ada4db6502da084fe44ab585e62e689e2f4f
Fixes: bug #1207625
Fix logic in add_host_to_aggregate()

Commit I788782a9f21ec2672551f75123753175bb268586 introduced some
changes into the add_host_to_aggregate() method to catch adding an
host to an availability zone when the host was already a member of
a different availability zone. However there were a couple of issues
with this change. There was no check that the availability_zone was
in the metadata grabbed from the database which would raise a
KeyError back to the api. Additionally, the check wouldn't always
work as expected because the database returned a set of availability
zones (including sometimes an empty set) so the check would fail in
some conditions when it was expected to pass.

This commit fixes the logic for checking if the host is already in an
availability zone. It also replaces the try/except block in the
aggregates extension to check up front if the action is valid instead
of waiting for a key error when it goes to use the action.

Fixes bug 1208627
Fixes bug 1208628

Change-Id: I81b79602e23e78c8b077d313e556796de1255bbf
quantum pxeboot-port support for baremetal

Baremetal provisioning currently requires a separate
DHCP server because PXE options are not being set in Neutron.
This feature does not support nova-network, only Neutron.
Implements blueprint pxeboot-ports

Change-Id: I2fefced6ce8ce466f0bc6dc5dd68053fb5827884
Fixes auto confirm invalid error

In the confirm_resize method at the compute API level, the 'metadata' attribute
is used to notify the instance usage and the 'system_metadata' attribute is
needed to get the old/new instance type values and the old vm_state, but the
auto confirm periodic task doesn't get the instance object with these two
attributes. This results in 'KeyError' exception being raised when the auto
confirm periodic task runs.
This commit sets expected_attrs to get 'metadata' and 'system_metadata' when
retrieving the instance object in the _poll_unconfirmed_resizes compute manager
method.

Reproduce steps in my devstack env with latest master branch nova:
1. set resize_confirm_window=10 in nova.conf
2. create an instance
3. resize it
4. wait for it is confirmed and watch the log

Fixes bug 1202975

Change-Id: I940f195d45fba4f2d25f9c517f11e99b74e97a8f
Fix IVS vif to correctly delete interfaces on unplug

The IVS unplug method was incorrectly calling the OVS
specific interface removal methods. This corrects it
to call the IVS removal methods.

Fixes: bug #1214532
Change-Id: Ie718e167d5bdcfae0d915ef85976aeeb3449ad18
correct the name style issue of ExtendedServerAttributes in v3 api

correct the camel style issue of the attribute ExtendedServerAttributes:
namespace in v3 api

fix Bug #1214317

Change-Id: If58d8cd8a82a88a94302c3b0aa3d23f5414328cb
Fix scheduler prep_resize deprecated comments

The scheduler prep_resize RPC method is still used by the compute
manager for scheduler retries on prep_resize failures.  It is not
deprecated yet despite the comments saying so.  This removes the
comments for now.

Change-Id: I858abff1bf08c7ecf50333b8776b18fc08730145
Add jsonschema to Nova requirements.txt

jsonschema is requested for validate the whitelist and alias
definition.

Change-Id: Iec3c14bb407cce88fd5af54a3930d83c53033293
Remove redundant _create_instance method from test_compute

The _create_instance method in test_compute.BaseTestCase simply calls
through to _create_fake_instance, so it's redundant. Furthermore, the
docstring was wrong, it said it returned a UUID when it really returned
the instance reference. This patch simply removes _create_instance and
replaces it's usage with _create_fake_instance.

Fixes bug 1206993

Change-Id: I3fc42c94691cd0d046f19cdf2110a95b9a125edd
Remove legacy network model in tests and compute manager

Update unit tests to use current network info model, remove
old legacy "network, mapping" model. This patch also removes
code for compatible with Folsom vif db info cache in compute
manager.

Partly implement blueprint nova-network-legacy

Change-Id: I3c18d786fb3eb7105be89ccac96c6fd3d078853d
Add unique constraint to AggregateMetadata

Added unique constraint
'uniq_aggregate_metadata0aggregate_id0key0deleted'
('aggregate_id', 'key', 'deleted') to
AggregateMetadata model and migrate
scripts.

Exception from UC violation used in method
aggregate_metadata_add() for race condition check.

blueprint db-enforce-unique-keys

Change-Id: I793706964ce76340c87e536af35a2dfa37408869
libvirt: fix {attach,detach}_interface()

* The get_config() method now takes 6 arguments, instead of 5
  previously. This change has been introduced by commit 08f8773b.

* LibvirtConnTestCase: add the test_attach_interface_get_config() and
  test_detach_interface_get_config() methods to prevent future
  failures.

This fixes bug #1212565.

Change-Id: I4e874f59595c3afe820103a27036519df1a126ff
Remove use of fake_rabbit in Nova

The fake_rabbit config option enables the memory transport for kombu.

We use the fake RPC backend for all of our unit testing. As best I can
tell, fake_rabbit harks back to a time when it was used for unit
testing.

The code in nova-dhcpbridge is the only place we explicitly do anything
different for this case - i.e. we directly call out to the network
manager to manage the IP address leases.

When we move to oslo.messaging, we can't rely on this config option
because it could be renamed in future. It's hard to imagine a more
generic "is the transport going to actually send a message to a remote
server" API in oslo.messaging.

I don't think anyone uses fake_rabbit anymore. I just don't see how it
can be useful to anyone. We should just remove it rather than putting in
a bunch of work to retain it with oslo.messaging.

blueprint: oslo-messaging
Change-Id: I3a8f8a9d3cb6cc6f431d48b4222bde31da767559
Remove unused fake run_instance() method

In a bunch of tests, we stub out rpc.call() and use it as a hook to
create instances and return their details.

The thing is, we never actually call() 'run_instance anymore .. we
always cast() it. So, these fake methods never actually get called and
can be safely removed.

A similar change was made in I63bbc98c285faebec53f8e62857c01548807db68
but missed some places.

blueprint: oslo-messaging
Change-Id: I6353b248f689d5eb16dbfd2067bbb61b1e14dbbf