Fixed a problem in iSCSI multipath

Multipathing for attach volume and detach volume operations
doesn't work properly if there are different targets
associated with different portals for a mulitpath device.

Change-Id: Iab316526cf64de60325d90043f73fa3e83fafb4e
Closes-Bug: #1266051
Fixes Hyper-V VHDX snapshot bigger than instance

In Hyper-V, the deployed images will be extended having their
metadata size added to their base image size. This may lead to
snapshots bigger than the flavor size.

This patch adds support to the V2 utils module, so that the
maximum internal size of a requested image may be calculated
in a similar way it is done in the V1 module.

VHDX format specs:
http://www.microsoft.com/en-us/download/details.aspx?id=34750

Closes-bug:  #1231911

Change-Id: I0d6aacb275f8af24554d3e8b6f04fe8a454b913f
Adds host_ip to hypervisor show API

After no-compute-fanout-to-scheduler, host_ip was stored in the table
of compute_nodes. Host ip address should be considered as the hypervisor
attribute similar to the hypervisor_type, hypervisor_version etc, and
now those attributes such as hypervisor_type, hypervisor_version etc
are all listed as the hypervisor attribute when calling "nova
hypervisor-show host", so we can also set "host_ip" as a new attribute
output for this command.

DocImpact
1) Only administrators can view hypervisor detail in nova.
2) It can help improve debug capabilities for nova. For example, if
admin using SimpleCIDRAffinityFilter, then after VM is deployed, admin
can check if the VM was deployed successfully to the desired host by
checking ip address of the host via "nova hypervisor-show host".
3) Add host_ip to the output for "nova hypervisor-show"

Implement bp hypervisor-show-ip
Change-Id: I006a504d030be1f47beb68a844647026a6daf0ce
Removes XML namespace from V3 API test_servers

This patch removes XML namespace from v3 test_servers.py

Partially implements blueprint remove-v3-xml-api

Change-Id: I3fae9c6a08df4a711250bd52e7a3f97b623f76f3
Prevent caller from specifying id during ComputeNode.create()

The patch is to remove id when it was set before creating a compute
node in objects, so it can be generated automatically.

And check if the node exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: Ib808643bff24b683ef330b5a1be5bc68ece30184
Prevent caller from specifying id during Service.create()

The patch is to remove id when it was set before creating a service
in objects, and check if the service exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: I688bfc98234f4bc27fb15474e05c7f25753efaf7
Prevent caller from specifying id during KeyPair.create()

The patch is to remove id when it was set before creating a key pair
in objects, and check if the key pair exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: I07609500e1135f54929265e06193c48e1bb083db
Prevent caller from specifying id during Migration.create()

The patch is to remove id when it was set before creating a migration
in objects, and check if the migration exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: I37ff279f5f74d17ce9c173458ff35826fb10f143
Fix bad log formatting

Oslo blueprint logging-handleerror-raise-exception, will allow us to raise
exceptions raised during logging, using that code these are two outstanding logs
that have incorrect formatting.

Change-Id: Iea26bb9905cd7501094eaef8d932e78627cdbd5d
Fixed check in image cache unit test

Before the fix assert checked nothing bacause .sort() sorts
provided list and has no return. Comparison of two None objects
is always true.

Change-Id: I3d453a29b5913cd24ce8d9e4a2324c7ad8d138b7
Rewrite InstanceAction object test cases using mock

This change rewrites the InstanceAction object test cases as a
groundwork for other InstanceAction changes to come.

This is a part of: blueprint make-instance-action-use-objects

Change-Id: I73eafa778bc0b558fe3c3497ec6892f52e8088db
libvirt-volume: improve unit test time

A number of tests would invoke code that would sleep. This
patch adds a mocked function for the sleep.

Change-Id: I804a86e3b8b750919cf7a9547ef514f833a5fd49
Related-bug: #1279820
Fix the indents of v3 API sample docs

There are some indent typos in v3 API sample docs.
Most API samples' indents are 4 spaces, but some samples' indents
are 2 spaces. This patch fixes them.

These typos have been found during the work for auto-generating API
API sample docs from API validation schemas. The auto-generator'll
output API sample docs with json.dumps() method and that would make
the difference between current docs which are fixed with this patch
because the generator would make API samples consistent.
This patch's purpose is also for preparing the generator.

Change-Id: Ieb6e587fcf4c01c128199950db93e1087bc43f41
Fix copyright messages after admin actions split for V3 API

Adds copyright messages that were accidentally not duplicated
in the new files during the code separation.

Partially implements blueprint v3-api-admin-actions-split

Change-Id: Icc3be739f86be740ae06aecba9e5166cc49ef1e2
Fix assertEqual parameter order post V3 API admin-actions-split

Post admin-actions-split cleanup to fix the order of parameters
in assertEqual tests for the testcases split out during the
bp v3-api-admin-actions-split.

Was originally part of https://review.openstack.org/#/c/73724 but
was split out into a separate patch at the request of a reviewer.

Partially implements blueprint v3-api-admin-actions-split

Change-Id: I28332d595c073e518e1bcd4a3f945492904df5d3
VMware: optimize instance reference access

Fix bug causing nova-compute CPU to spike to 100%.

When there are hundreds of VMs running each time a VM is referenced
all of the VMs in the system will be read by nova-compute and then
filtered according to the UUID.

This is addressed by using an API (FindAllByUuid) which reads only
the specific VM. When a VM is created the config spec will be updated
with the UUID of the VM - that is, the field 'instanceUuid' will be
set. The search is later done on this field.

If the search fails then the old code will be invoked - this ensures
backward compatibility with running VM's. Thus all VM's created
without the 'instanceUuid' set will not be affected.

In addition to optimizing the search we also cache the VM reference.
This ensures that additional calls for the specific VM do not need
to query the backend for the reference.

Change-Id: I00d6c29f46b06d082cf3af0369a69147a3376341
Closes-bug: #1258179
Fixed spelling errors in nova

Change-Id: I2d9fc7278c96bcd9f7d50a1af6db6df56df28111
Remove __del__ usage in vmwareapi driver

The vmwareapi driver uses __del__ in an inappropriate way, which
causes spurious errors to be displayed at inconvenient times. The
python docs clearly detail the caveats of using __del__ (and even
provide a big red warning). This removes the offending code, which
can't work reliably anyway.

Closes-bug: 1262288
Change-Id: I50acb4f1e85650f4c6dffe1a1d25842601be96bf
Make floating_ips module use FloatingIP for associations

This makes the network.floating_ips module use the FloatingIP
object for association operations instead of direct database
access.

Related to blueprint nova-network-objects

Change-Id: I71db51e2ad3a79665140ef21b5960c1ff9ff3a05
Sync log.py from oslo

This change syncs log.py from oslo-incubator with commit
79e8a9a08daf563aa8a8d9280c9a6a27dcafc8f2

To honor RFC5424 add use_syslog_rfc_format config option
(default False, would be deprecated in J after existing
syslog format deprecation) which adds APP-NAME to syslog message
before MSG part to reflect application or service name.
Usable only with use_syslog, otherwise ignored.

During J, the default logging format for syslog should be changed
to always provide APP-NAME, thus use_syslog_rfc_format could be
deprecated in J as well.

Since the rootwrap code was graduating to a separate library,
so the rootwrap related change should just go into oslo.rootwrap
and when oslo.rootwrap is released, nova will pull in the library.

Change-Id: I6018c7322314a4b57052be1ec0fc5fa437069f44
Closes-bug: 904307