Fix boto capabilities check

In commit 4845fc27 a capability check for the boto library has been
accidentally broken. boto.connection existed in all versions and it
was HTTPResponse class that should cause the ImportError.
Exception will not happen on the import line anymore, so check the
capabilities using hasattr() instead.

Change-Id: Ic9bff71b91de685a958400f12836322c7ca996c4
Handle compute node not available for live migration

This patch handles exception.ComputeServiceUnavailable by restoring
instance's vm_state and instance's task_state after live migration
failure caused by unavailable source/dest compute node.

Raises detailed HTTPBadRequest explanation for this exception.

Fixes bug 973393 and bug 1051881

Change-Id: If825b61fad9c4e3030f2e6c5002907255eaf3661
Fix update quota with invalid value

If update quota with a value which is not integer, it will response
with http status code 500. Catch the exception and continue for
updating other quotas.

Fix LP# 1111327

Change-Id: I0ab3b10ff106a2e6c7677d1acdb55c2f35c492db
lxc: virDomainGetVcpus is not supported by driver

virDomainGetVcpus is not supported by the libvirt lxc
driver, so it results in a nasty traceback. Trap the
error and return the number of vcpus.

Fixes LP: #1106960

Change-Id: I4e81dedad74ce3c58fcdf3ee064dfa0b9aa9a755
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Fix check instance host for instance action

When instance has no host, actions such as get_console_output,
start_stop_instance cause HTTP 500 response. Here change to
HTTPConflict when action called before host set.

Fix LP# 1116012

Change-Id: I6153a03f449d9fad8d0d8fb7295bdea4d2b2c2b1
replace ssh-keygen -m with a python equivalent

When running on latest released versions of Debian and RHEL/CentOS
we get Encryption failure with "ssh-keygen: illegal option -- m"

Fixes LP# 1102501

Change-Id: Ia54bf8f3e8d51c8baa09ba67d2e18ad214316989
NOTE: new dependency on pyasn1 python module
Update .coveragerc

Set up proper source and omit options.

Change-Id: I28e95c5dde5d906dc2bf44b647017f8cff5981f6
Implements: blueprint update-coveragerc
Adds _(prerun|check)_134 functions to test_migrations

The _prerun_134 function populates the 'bw_usage_cache'
table with real data, different in some critical ways,
before migrating it. _check_134 function certifies that
things were properly migrated.

Partially implements bp migration-testing-with-data

Change-Id: I4100c8aa3e1c9d2ff4fdb095dba4cb084b5df279
maint: remove unused imports from bin/nova-*

Change-Id: I80b58ac41bbb0517221d5fd5ba9938f2b7836779
Clean up extended server output samples

The extended status extension was testing list instead of get and the
extended server attribute extension was misnaming its sample files.

This makes the names of the samples consistent.

Change-Id: I5b6f8d00c85d7817775c190b2a7645a47f8085db
DocImpact: The api sample site may need to be updated as well
Allow multiple dns servers when starting dnsmasq

Previously we only allowed one upstream dns server even though we
can store two in the network object. This changes the dns_server
flag to a MultiStrOpt so it can be specified multiple times.

It also adds a new config 'use_network_dns_servers' which specifies
to uses the dns servers from the network if they are set. This
defaults to false to ensure configs do not need to be changed.

DocImpact

Change-Id: I4c96259bce25036392afe6e027ec47b92679ecbc
support reloctable venv roots in testing framework

run_tests.sh, with_venv.sh, and the install_venv.py scripts now
support relocating the venv root to another location.

All 3 scripts now support new envinroment variables to configure
the location of the venv and the tools directory. To maintain
compatability the defaults are set to the current values.

venv_path = Location of the virtualenv directory
	Default: $(pwd)

venv_name = Name of the virtualenv directory
	Default: .venv

tools_path = Location of the tools directory
	Default: $(pwd)

Additionally the run_tests.sh script also takes these value as
arguments and will pass them along accordingly.

--virtual-env-path <path>   Location of the virtualenv directory
                             Default: $(pwd)
--virtual-env-name <name>   Name of the virtualenv directory
                             Default: .venv
--tools-path <dir>          Location of the tools directory
                             Default: $(pwd)

DocImpact

Change-Id: I1be036058227206ecca342f692cd3d6aadb24069
Fixes: bug #1116942
Implement ZooKeeper driver for ServiceGroup API.

The ZooKeeper driver uses ephemeral nodes in ZooKeeper to keep
track of node liveness in a service group. The Implementation is
based on the evzookeeper library to combine zookeeper
and eventlet.

Part of blueprint zk-service-heartbeat

DocImpact: new driver

Change-Id: Ia20519de2b4964007f8b91ea5d56d1875510d40f
Support for scheduler hints for VM groups

This is part of the blueprint vm-ensembles. The patch introduces the
group as a scheduler hint.

The patch set adds group support for multi-VM deployment. This is achieved
as follows:
1. A new hint is added: group. This will contain the name and type for the
   group. At the moment only anti-affinity is supported. In the future
   we will add network proximity. It will be extended to <name>:<type>
2. In order to ensure that group policy will be honored for future VM
   deployments, the group is stored as system_metadata.
3. The anti affinity is implemented by a new filter called
   GroupAntiAffinityFilter.

DocImpact

Change-Id: I6ea2af5770b5ac4ff082b2a021d323ee38282205
Ensure that LB VIF drivers creates the bridge if necessary

Fixes bug 1117770

In order for libvirt to use the bridge name the bridge must exist.

Change-Id: Ie24cfce8454e0c1bbfd9058787a1fd704790f03c
Fixes a race condition on updating security group rules

During creating the instance, compute manager makes an rpc call
to "allocate_for_instance" from the network manager, which will
in turn end up making a rpc cast to each compute_manager with
an instance in the group(s) than need to be refreshed calling
refresh_instance_security_rules.

When an instance is being created is in a group that has a
rule referring to itself, that chain will end up trying to
refresh the rules for the instance which is still being created.

That call will find its way down to do_refresh_instance_rules()
in libvirt/firewall - which will in turn try to get network_info
from the global "network_infos" in firewall.

But the entry in network_infos for this instance might not of
been added yet, as that only happens when the create of the
instance calls "prepare_instance_filter which comes later in
the sequence as part of driver.spawn

The fix here adds a synchronisation lock to the incomming
refresh call so that it is blocked until any in-progress
thread on the instance is finished.

Change-Id: I550e286aa4777b011633550109e18e03d63a4bbb
Return dest_check_data as expected by the Scheduler

the scheduler driver expects data in return when
calling compute_rcp.check_can_live_migrate_destination
in method 'schedule_live_migration'.

In turn check_can_live_migrate_destination calls
check_can_live_migrate_source that also expects data
returned from the driver.

Fixes bug #1118491

Change-Id: I3dbfa716d5d9bc849c1f67005e7bb1b8ba1ccd30
Changes GA code for tracking cross-domain.

Change-Id: I731d6b160588b59f01abe98699c144fdf4ae12ad
Properly write non-raw LVM images on creation

Fixes bug 1075333

When force_raw_images=False and libvirt_images_type=lvm were set
together, selecting anything other than a RAW image would result in
an unbootable instance. This is because the downloaded image was
being directly dd'd onto the new LVM root, which will obviously not
work for any format other than RAW.

Simple change to use qemu-img to read from the image (letting it
decide the format) and write to the LVM root as raw.

Change-Id: I36494e6d0671c07f7511c10ef886c8cf84c18df7
Libvirt: Implement snapshots for LVM-backed roots

Uses the built-in LVM snapshotting mechanism to create a new
snapshot, use qemu-img to extract the full root into an image file,
then delete the snapshot volume. Although we typically zero deleted
LVM volumes manually, this is not necessary for snapshots, as LVM
handles it for us (per the documentation).

Change-Id: I82f21488671ffa3be3d0feba73ff631fa2a51ec0
Fixes: Bug 1120809
Flags: DocImpact