libvirt: Fix _cleanup_resize

Undefine domain and unplug vifs in _cleanup_resize if the instance was
migrated to another host.

Fixes bug 1015731

Change-Id: If6eb1ada029d462777bbd6ea113c98c3b801cf5d
Zmq register opts fix in receiver

Following dprince's change to use
FLAGS, rather than cfg.CONF,
zmq_opts needs to be registered explicitly.

Change-Id: I66bc71563435088ee9224fdd603602e35f3e3bff
Updated code to update attach_time of a volume while detaching

While detaching volume from an instance, attach_time of the
volume is not updated. This task updates volume['attach_time']
to NONE at detach_volume.

Also modified the default value of XML attribute
volume['attach_time'] '-' to ''(a 0 length string) to
maintain consistency with existing code.

Fixes bug: 1056122

Change-Id: If56ceda6caab80fb803fcf194ed1dfb18808ec3a
Num instances scheduler filter

Allow for scheduler filtering based on number of instances already assigned to
that host.

FLAGS.max_instances_per_host controls the maximum number of instances allowed
per host.

Change-Id: Id3e8973311ea5ac8db2d9e4e594a5288a9e3f94d
Update tools hacking for pep8 1.2 and beyond

* https://github.com/jcrocholl/pep8/commit/b9f72b16011aac981ce9e3a47fd0ffb1d3d2e085
  broke tools/hacking.py
* Upgrade pep8 to 1.2 and disable the following new tests: E12,E711,E712,E721,E502

Change-Id: I32a8808c6c9cccfedcc4d2a26649333aca1cd713
Remove deprecated Folsom code: config convert

Removes config file converter: nova-manage config convert

Change-Id: I146bff9ac00a4885e7054f999ae52159da3f86ef
Remove unneeded lines from aggregates extension API sample tests.

In change I8f0f5b022795dc1d766e585cab8fe5f8445a3722 there was an unneeded
entry in the subs dictionary for 2 different tests.

Change-Id: I2dd5286acbde57499a1594d2c09e38d9ba6254f7
Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com>
ip_protocol for ec2 security groups

fix for bug 1057196.
-Enforce restrictions on IP protocol in AuthorizeSecurityGroupIngress call.
 This value may only be: 'tcp', 'udp', 'icmp', '6', '17' or '1'
-Ensure that ip protocol returned from DescribeSecurityGroups is in lower case,
 in case security group was set improperly in previous versions
-Update EC2APIError in nova/exception.py to remove the HTTP error code from the
 message. The HTTP error code is inserted in nova.api.ec2.faults.Fault. Inserting
 the code in the EC2APIError causes the HTTP code to appear twice in the message
-Update unit tests to expect new error message when invalid protocol is entered.
-Fixing pep8 issues

Change-Id: Iffe0f38abde327288e6a3960a72ad6a273f78aca
Add nova-cert service to integrated_helpers

This allows us to do integration tests that need to use nova-cert.
Note that creating a certs for every test seems a bit excessive,
so this adds a fake_crypto module to return fake values.

Change-Id: Ia92c1dde8b122aef096004e9aad0a14ee587bbf0
Add api samples to Certificates extension

Change-Id: Ifb61c9cd90f03225c27b5683e5f54f30c636994c
Return proper error messages while associating floating IP

Handled the FloatingIpNotFoundForAddress, NotAuthorized exceptions
raised while associating floating IPs which are not allocated
or allocated to another project.

Fixes bug 1057906

Change-Id: I2d6eba9159b4e855fe615ed4dfa23c388d28c6d0
powervm: exception handling improvements

PowerVMLPARInstanceNotFound should extend InstanceNotFound so nova
can handle it as an InstanceNotFound when LPARs are missing
Small bug fix so cleanup failing due to LPARs not existing does
not cause the delete to fail out, since we had nothing to cleanup

fixes bug #1061173

Change-Id: I3b26a477e55b4627f401dbb25c66d5e84ab1fa3f
Add ability to download images via BitTorrent.

This patch adds a new dom0 plugin which supports downloading images via
BitTorrent. Torrent metadata files are assumed to be served from a
webserver which is specified by the `torrent_base_url` config.

Under the hood, the dom0 plugins calls out to rasterbar's libtorrent via
Python bindings in order perform the initial download as well as the
seeding thereafter.

Implements BP xenserver-bittorrent-images

Change-Id: I824720a6e3a37317080a22cd7405d2a88172c3ef
powervm: remove broken instance filtering

Filtering isn't necessary (nor desired in some cases)
Irrelevant comment cleanup

fixes bug #1061291

Change-Id: I0798ff20aea7551b1d1100e8a439c39be99291e1
xenapi: Refactor snapshots during resize

Currently, we use VM.snapshot for resize, which fails if we have a
volume attached to the VM, which does not support snapshots. This change
uses VDI.snapshot instead, for all VDIs that are not attached by nova.

Also needed for xenapi: detaching and reattaching volumes during
migrations and reverting of migrations.

Fixes Bug #1028092

Change-Id: I3e2973747135a9c33de194e38537620c397bb87e
libvirt: ignore deleted domain while get block dev

The get_all_block_devices could raise libvirtError if domain was deleted
while listing instances. This will cause LibvirtISCSIVolumeDriver to fail
disconnect_volume. This patch ignores the domain that could not be found
to avoid this issue.

Fixes bug 1060836

Change-Id: I9dc994d8ca7fc084830adb4f6f9d3ca10e0fe577
Merge "ip_protocol for ec2 security groups"
Merge "Remove deprecated Folsom code: config convert"
Stop network.api import on network import

The nova.network.__init__.py was importing the network.api
automatically at import time. This was leading to some silly
workarounds (for example in nova/virt/firewall.py) involving
late importing nova.network to stop circular imports.

It is also causing issues with https://review.openstack.org/#/c/13007/
because quantum api needs to import a flag from network manager
which is causing a circular import.

This fixes the issue by moving to use the code from volume_api
which only imports the api class when the method is called. It cleans
up the tests that were stubbing out network.API and also removes
the unneeded workarounds.

Change-Id: I4c9b372d078ab4398e797335a8de5e9e1077e31f
Merge "Add ability to download images via BitTorrent."