Fix typo in call in cinder.API unreserve_volume

Fixes bug #1038599

def unreserve_volume(self, context, volume):
-    cinderclient(context).volumes.reserve(volume['id'])
+    cinderclient(context).volumes.unreserve(volume['id'])

Change-Id: Ida96b01d93f2e82fe842fa93c1a8edbc27434279
Implement network creation in compute API

Implements blueprint os-api-network-create

The ability to create new networks is currently only exposed by the
nova-manage CLI. Here we add support for network creation in the
os-networks API extension.

With the exception of num_networks and network_size, all the parameters
supported by 'nova-manage network create' are supported. Only a single
network may be created by each API call.

To avoid code duplication, the nova-manage code is refactored and moved
into NetworkManager so that it can be re-used by the API.

DocImpact
Change-Id: I682d498ab35ea43b553b64e13e677fe9eeb8e08b
XCP-XAPI version fix

Fixes bug 1033933.

On an Kronos installation (Ubuntu + XCP-XAPI), the reported
software_version dictionary did not contain both product_version and
product_brand. This caused a KeyError. With this fix, the session's
product_version and product_brand will default to None in such cases.
The resize operation's name in these cases will default to VDI.resize.

Change-Id: Ic0db4128a7b27c08c24461562423bcecd1373e58
Add nosehtmloutput as a test dependency.

Adding nosehtmloutput as a test dependency allows nose to output its
results to an html file. This will be used by Jenkins to save logs on
a different server.

Change-Id: I45191e872a41eed8e6a9e14757675ee7a28b3836
Add two prereq pkgs to nova devref env guide

fixes bug 1024903

As noted in the bug report, without libxml2-dev and libxslt-dev
installed on ubuntu 12.04, the virtualenv creation will fail.

This fix simply adds the packages to the first
"Install the prerequisite packages." line

Change-Id: I588ce14f63fa75d54405562f83d202d05c8a05c6
Check association when removing floating ip.

Fixes bug 1032558 and returns 404 when trying to delete a floating ip
from an instance to which it is not associated.

Change-Id: I30b4d8a318597d38c7afc01ee6d2e6842b999157
Return actual availability zones

Report on real availability zones, not a hard coded "nova" zone in
the output of ec2 DescribeAvailabilityZones when the output is
verbose. Resolves bug 1032890.

Change-Id: Ie85cfa1c3638fc490f52f48c8238b3162732647d
Don't include hostname and IP in generated sample conf

Avoid including the hostname and IP address of the machine generating
the sample config file.

Change-Id: Idf791efef8b0bf760c4c95f6f5f53d20bdf5ee7a
Ensure log formats are quoted in sample conf

Fixes bug #1040583

This ensures the sample conf has:

  # instance_format="[instance: %(uuid)s] "

rather than:

  # instance_format=[instance: %(uuid)s]

Fix suggested by Vish.

Change-Id: If20aa7276d6868a6885abc85f046733adc40331f
DocImpact: update nova.conf docs
Remove test_instance_update_with_instance_id test

test_instance_update_with_instance_id is identical to
test_instance_update_with_instance_uuid due to uuid conversion.
Remove it for simpilcity.

Change-Id: Ib348522900a62d6f7340357cac5f4a03c6163016
Make instance_update_and_get_original() atomic

Use the same session object within a transaction to retrieve
and update the instance object, including metadata and system
metadata.

In preparation to fix bug 1037372

Change-Id: I886da12bb85f60c2b23609a35b6d9a43040216ce
Fix deallocate_fixed_ip() call by unifying signature

deallocate_fixed_ip() is defined in 3 classes with incompatible
signatures:

RPCAllocateFixedIP:
deallocate_fixed_ip(self, context, address, host, **kwargs)
NetworkManager:
deallocate_fixed_ip(self, context, address, **kwargs)
FlatManager:
deallocate_fixed_ip(self, context, address, **kwargs)

There is a non-trivial multiple inheritance relationship among
them. The complication leads to incorrect function call signatures
(see bug 1024789). The kwargs magic is also never used, and discarded
during rpc calls anyway.

This patch makes the call signature exactly the same for all
deallocate_fixed_ip() definitions, drops kwargs and fixes bug
1024789.

Change-Id: I9c139810d4a5c93fa9f50b89a07bfe44e73e6c8a
Adds integration testing for api samples

We have no validation the the samples at api.openstack.org are
actually correct. This creates a framework to validate the request
and response samples through integration tests.

Adds a bit of stubbing in fake_network to return simple network_info
along with instance records and adds a call in image/fake to get
av valid image.

It will create non-templated versions of the samples when
the tests are running if GENERATE_SAMPLES is set in the environment
when running  nova/tests/integrated/test_api_samples.py

Change-Id: Id134af0b23f0d0932c8789697439ce94bbe2834b
Returns hypervisor_hostname in xml of extension

The extended_server_attributes extension returns hypervisor_hostname
in json output, but it was inadvertently omitted from xml. This makes
the output consistent between the two. Tests included.

Fixes bug 1039276

Change-Id: Ib8cd71cd5bfb65785a02085061fea5e515a0568c
Merge "Implement network creation in compute API"
Ensure hairpin_mode is set whenever vifs is added to bridge.

Fix the bug that when create a snapshot of an instance, the
instance cann't ping it's floating ip.
fix bug lp:1040537

Change-Id: I25aa1a323fa84e8c72f969cb56ada4dffa509150
Adding indexes to frequently joined database columns.

Fixes bug 1006624

Change-Id: I0f1f6903a29cb8d3573987b88f62cd895a11c100
Clean up network create exception handling

The NetworkManager code will not raise webob exceptions, so there's no
point in explicitly catching those.

Also, the contrib.networks module is unused in nova-manage.

Change-Id: I5f9fe7fa7f4365f44e7a70b3d9536da8f10b8fa7
Simplify network create logic

The logic to determine default values for num_networks and network_size
is currently overly convoluted. Simplify it in order to make the intent
more clear, without actually changing the behaviour.

Change-Id: Iadb83b1a45aaf52822ee34b972b3f004cef65ef3
Check volume status before detaching.

If the volume is already detached previously, check the volume
status before preforming the detach. Otherwise you get a nasty
traceback because the instance_uuid no longer exists.

Change-Id: I0df4240fb6500d5f99a20d63d82fd258fccdc9fc
Signed-off-by: Chuck Short <chuck.short@canonical.com>