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
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
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
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
Update to simplified common oslo version code.

Based on https://review.openstack.org/#/c/19957/

Change-Id: Ieefee2af8812d0217e95eeffb3cf53d8e55c8fe6
Disallow setting /0 for network other than 0.0.0.0

If something like 15.0.0.0/0 is set as an IP address range it ends up
being identical to 0.0.0.0/0 (i.e all access) which I don't think is
the intent of the user when they make the API call.

Change-Id: I3fc05371f461112feae4f1097777fede5fc6b948
Don't call 'vif.plug' twice during VM startup

When starting a VM, the 'get_guest_config' method would end
up calling both the 'plug' and 'get_config' methods on the
VIF driver impl.  The 'plug' method was, however, already
being called by the 'create_domain_and_network' method in
libvirt/driver.py. The result was that when starting a VM,
Nova would be invoking 'plug' twice. Fortunately this does
not currently cause any serious problems, but it could well
do in the future.

Change-Id: I4b044a6d44801a27362e3bf8531962ba85e79466
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Adds API Sample tests for FloatingIPDNS extension.

Partially implements blueprint nova-api-samples
Fixes bug 1070164

Change-Id: I4c3e5d406ce43c27bb49a651facaa831de646a66
Ensure 'subunit2pyunit' is run in venv from run_tests.sh

The run_tests.sh script invokes

  bash -c "${wrapper} $TESTRTESTS | subunit2pyunit"

where '${wrapper}' expands to 'tools/with_venv.sh'. Due to shell
precedence rules, this only applies to '$TESTRTESTS' not the
'subunit2pyunit' part of the command. The 'subunit2pyunit' binary
though may only be available from the .venv

Change-Id: I5972c8f77b3f50a3713881e6ca1acbaeabbd47d4
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Merge "support reloctable venv roots in testing framework"
Fix unconsumed column name warning in test_migrations.

The warning is "SAWarning: Unconsumed column names: aggregate_name"

There is no column aggregate_name in the aggregates table.

Change-Id: I3b92b3429ac3e020b9ab3f7ce10c73a4e4b93187
Fixes a bug in attaching volumes on Hyper-V

Fixes bug: #1122264

The CIM v2 WMI context needs to be instantiated by the BaseVolumeUtils
class and not passed by the caller of get_iscsi_initiator().

Change-Id: I811b5bd0117b0035c18e5c90169b25a095bc54e9
Use ServiceGroup API to show node liveness

Previously it's direct db access. Now we use the servicegroup
API to show node liveness. Note that db access is still needed
to get other service attributes such as `disabled'.

Change-Id: I65ef3a136fd90036a8d009ed97a5f48ae461d8d9
Add generic UC dropper

There is a lot of tables where we should add unique constraints
on upgrade and drop on downgrade, to avoid race conditions.
But there is a problem with SQLite. SQLite does not allow to drop unique constraints.
There is only one way to drop UC in SQLite:
1) create new table, with same columns and UC (but without UC that we want to drop)
2) copy data from old table
3) drop old table
4) create indexes in new table from old
5) rename new table to old table name

For other DB backends is used 'alter table'.

This patch add generic method for dropping UC.

blueprint db-unique-keys

Change-Id: I3e60578d3902559996943868abeb17b41153769b