Shrink devref.unit_tests, since info is in wiki.

Don't keep a copy of the run_tests.sh flag list here since it
inevitably will get out of sync with the real list.

No need to go into detail on how unit testing is set up, since we already have a wiki
on how to run tests that applies for all OpenStack projects. Keep
section with tox examples since that is the most commonly used command.

Change-Id: Ia8eb059be164d9df3edfd69aedcebfd028da45ff
Related-Bug: 1219040
minor corrections to devref rpc page

Correct wording to proper English and remove extra space between words while
in there.

DocImpact

Change-Id: If4b3d9d81d7193107e84867e4ab713c413a4976d
Correct exception info format of v3 flavor manage

The existing flavor manage may raise HTTPBadRequest exception,
But the msg info didn't use '_' prefix. This patch adds it.

Change-Id: I736bf4b0e78ecc0bb753d376ee162f19fafc09e1
VMware: remove unused parameters in imagecache

Trivial patch to remove some unused parameters in
timestamp_cleanup().

Change-Id: Id3c6e8c6c504591fdf09e8871cf3358d265a678c
Allow user to specify image to use during rescue - V3 API changes

This commit includes the V3 changes.
Making changes in V3 API to take an extra parameter rescue_image_ref
as part of the rescue action API.
If specified, this image_ref will be used to rescue the instance.
If the image is not specified, then the base image ref is used by
default.

Partially Implements: blueprint allow-image-to-be-specified-during-rescue

DocImpact

Change-Id: I7a9d88bf4dfe73879247f5b82a52928fdde76510
Check the length of aggregate metadata

PostgreSQL gives an error if you try to shove 256+ characters
into a 255-character field. So we need raise a HTTPBadRequest
explanation if the length of aggregate_metadata.keys or
aggregate_metadata.values is above 255.

Change-Id: I2c778f2237ba5bd2aa8335a0eae80f3aad3e9157
Closes-Bug: #1219693
Add unit tests for ipv4/ipv6 format validation

We found a bug that the other jsonschema format check('uri') did
not work for input validation. There was not any unit tests for
the format check, then we could not find it in long term.
The bug is fixed with Ibb2b7f27c374136e6865b28786d10ca1365e5709 .
And this patch adds unit tests for the format 'ipv4' and 'ipv6'.

Change-Id: I6f6636708e3f9a4eee14451f2baacb50002f1db8
Related-Bug: #1326599
Add testing for hooks

Partially implements: bp instance-network-info-hook

Change-Id: Ie7cfcf70ff39f1273d97b17788c2e4e0f9fc437f
Make get_console_output() use objects

This changes the get_console_output() method in compute manager to take
objects.

Related to blueprint compute-manager-objects-juno

Change-Id: Ia8cb2168313903d5255fa2c9616ee2a56aebdb68
Remove XML namespace from some v3 extensions

The XML support was removed from the V3 API plugins,
this XML namespace was not used again.

Change-Id: I427597dd3f6d454037a791f911756a97f343966d
Separate the PCI device object handling code

Currently the PCI device object includes several functions like
alloc/free/claim etc. However, the NovaObject should not be used
this way, and it makes the PCI device object really different
with other NovaObject implementations.

This patch duplicates the PCI device handling code as separated
functions. No logic changes but simply code copy. A later patch
will delete the code at PciDevice object.

Closes-Bug: #1273852

Change-Id: I2389d29218d8619998f8df973004af004e8b1b76
Use new pci device handling code in pci_manager

As we remove some pci device method from PCI device object,
update the pci manager accordingly.

Closes-Bug: #1273852

Change-Id: I0ec0e7b03625888a207918816b6e2d537b6d7d54
Remove the device handling from pci device object

Remove the device handling code at pci device object to make
it similar to other NovaObject.

Remove some usage in test cases.

Closes-Bug: #1273852

Change-Id: I4487ae0b36de18365d12593f480c05f0fe726769
libvirt: return the correct instance path while cleanup_resize

If we resized a pre-grizzly instance with grizzly or later nova
to another host, while the resize confirmation process,
_cleanup_resize will find the instance resize backup dir and
delete it, but a wrong xxx_resize dir like ${uuid}_resize,
instead of the correct ${name}_resize will be found.
This is because the instance is a resized one which original
instance dir exists on another host(the dest host),
get_instance_path method could not find the original instance
dir on the source host, so the path with uuid will be returned,
and the `target` existing check in _cleanup_resize is failed,
then the ${name}_resize dir will never be deleted.

Closes-bug: #1290294
Change-Id: I904b6751dec740e001f5ec29f637ef456528746f
Attach/detach interface to paused instance with affect live flag

Currently attach/detach interface to paused instance is only with
VIR_DOMAIN_AFFECT_CONFIG flags. After instance unpause, there isn't
any effect on the instance, unless restart the instance. So add
flag VIR_DOMAIN_AFFECT_LIVE when attach/detach interface.

Change-Id: Iedfc7f6fc06e72d8e3eecebede1274582c8043fd
Closes-Bug: #1299331
Network: ensure that ports are 'unset' when instance is deleted

Commit a141206e9dfd31955b9b31d9e5a7f73bbd8510ca ensured that user defined
ports were not deleted when an instance is deleted or rescheduled. The
problem with this commit is that it did not reset the 'device_id' and
'device_owner' of the port. This leads to port leakage and eventually a tenant
is unable to launch any instances as their port quota has exceeded the
allocated amount.

The solution is for the deallocation to reset the 'device_id' and the
'device_owner' of the port. This is allocated when the port is actually assigned
to an instance.

In the case of minesweeper (which runs on OpenStack), the tenant was leaking ports.
The root cause was that the user defined ports were assigned to a specific instance,
which was deleted, as a result of a failed reschedule (which is legitimate).

When an instance is deleted all artificats of that instance should be reset on the
port.

Change-Id: Ie1516c299ce6d79faf2d5103a14d6d8931d3ede2
Closes-bug: #1321381
libvirt: Close opened file explicitly

Every opened file should be closed properly.

Change-Id: I5405638ba033f75957461c0ad33be9f0c6a17e3b
libvirt: Remove use of db for flavor extra specs in tests

The watchdog tests were using the, now discouraged, approach of calling
db.flavor_extra_specs_update_or_create to set flavour extra specs for
the test case. Rewrite the test cases to mock the Flavor.get_by_id
method to return a fake flavor object.

Change-Id: I92b45762a8f079b0e7bef7f9daf4cf5ada78896f
Revert "Allow admin user to get all tenant's floating IPs"

This reverts commit 6478554f531f6ee2fa86226fbc79dd31e556bc06.

This API change merged as a bug fix and introduced bugs and our API
change policy is more or less to go through the blueprint/nova-specs
review process:

http://lists.openstack.org/pipermail/openstack-dev/2014-June/037536.html

So reverting this so it can go through the blueprint/nova-specs
review process.

There should be minimal impacts to removing this (broken) API since
it merged not too long ago and was added strictly for Ceilometer's
usage, not an external deployer that would be (more) broken by this
API removal.

Closes-Bug: #1328694

Change-Id: I22a711795ea616aabc155a71703c9c794e84a5dc
Make check_instance_shared_storage() use objects

This changes the check_instance_shared_storage () method in compute manager
to take an instance object.

The change is mostly cosmetic here to remove one more case of an instance dict
being passed by the rpcapi since the instance parameter isn't actually used on
the server end of this call anyway !

Related to blueprint compute-manager-objects-juno

Change-Id: Id22306916d5d32af978955e02ee95e991c733bab