Fixes Hyper-V volume discovery exception message

On some editions of Windows / Hyper-V server the SAN policy is set
by default to "Online All", bringing online any disk, local or shared,
attached to the host.

Since only offline disks can be attached as passthrough disks to a Hyper-V
VM, this prevents Cinder volumes from being attached to instances,
resulting in an exception that can be particularly hard to troubleshoot
without a clear knowledge of the context.

This patch includes some details in the exception message for
troubleshooting purposes.

Change-Id: I6d0b49812f8ca965ca53be34ef009997c8e79728
Closes-Bug: #1361419
Fix scheduler_available_filters help

The help speaks about nova.scheduler.filters.standard_filters which does
not exist anymore. The default has been changed to all_filters with
commit 0d9ce831 but the help text was not updated so far.

Change-Id: I38dfadabe02489d8d40986e7f4d06c0c68097516
Remove flush_operations in the volume usage output

flush_operations is not used by upper layer code and also
according to
ftp://libvirt.org/libvirt/java/javadoc/org/libvirt/DomainBlockStats.html
http://libvirt.org/ruby/api/Libvirt/Domain/BlockStats.html

seems the last value should be errs instead of flush_operations
so remove it from libvirt driver layer.

Change-Id: I438b6fa40e9d97e3ffddda03919c5d577e91c155
VMware: fix regression for 'TaskInProgress'

Commit 73d4a7c1b4681accd993c1109a9eff837ff612f4 caused a regression
with the snapshot deletion. That is, the snapshot deletion will retry
if the resource is busy. The fact that the exception was not supported
in olso caused the problem.

Version 0.6.0 supports this exception.

Change-Id: I12fcc7d039a123e681c51978b9cf632af8f9644b
Closes-bug: #1369463
VMware: pass vm_ref to _get_and_set_vnc_config

In the spawn refactor we get the vm_ref when the instance is created.
Passing it to the method _get_and_set_vnc_config saves a function
call. We are able to do this as we already have the vm_ref for the
instance in question.

Change-Id: I7b8d056af7f49ebd31beff2876edb9e6115d0a2c
VMware: pass vm_ref to _set_machine_id

Save a method call to get the vm_ref. In spawn this value exists so
we can pass it to the method if necessary.

Change-Id: Ied43fb09fb2eec2d2c22fce17b4f98ae3f58860e
VMware: Fix problem transferring files with ipv6 host

Need to protect the host name with '[' and ']' before
we create a http/https connection

Change-Id: I9320c47f446d1e6b6b088802c3916a88b118d9cf
Closes-bug: #1390906
Fixed quotas double decreasing problem

When we delete vm with status "soft-delete" we shouldn't change
quota values because they were changed during soft-deleting.

Closes-bug: #1333145
Change-Id: I3ed7b3245b8908faa02903c74503918f061016bd
make get_by_host use slave in periodic task

In periodic task functions nova prefer to use slave db
instead of primary db. This patch makes function
_get_host_volume_bdms to use slave db

Change-Id: Ia297524fc1acf06ab708509c805d14e215b10b86
Only load necessary instance info for use in sync power state

During sync power state, instance is refreshed from the db. If the
instance gets deleted, this can result in InstanceInfoCacheNotFound
being thrown due to info_cache being loaded and therefore refreshed.

Sync power state does not make use of any extra instance attrs, so
this problem can be avoided by not loading any extra attrs in the
first place.

Two callers of _sync_instance_power_state() are updated to not load
extra attrs. 1) The periodic sync and 2) the lifecycle event handler.

Change-Id: I150bd95da65263981608dd9a033232bd142e737f
Closes-Bug: #1367845
Rename private functions in db.sqla.api

instance_get_all_by_filters() called 3 helper functions: exact_filter,
regex_filter and tag_filter. None of these functions had any other
callers.

This change prefixes them with _ to identify them as private.
Additionally, it removes the model arguments to the functions as these
always relate to an Instance and/or its InstanceMetadata.
Consequently, the functions are renamed to identify them as specific
to an Instance query. exact_filter is moved from the top of the module
to be next to the other 2.

Change-Id: I671315122438022b13d6b315b577ef2a5cf42545
Don't modify columns_to_join formal parameter in _manual_join_columns

The _manual_join_columns method was modifying the columns_to_join list
passed to it which, if not copied by the original caller, can introduce
bugs in the calling code if the original columns_to_join list is re-used
later, e.g. making nova objects with an expected_attrs list that has
been mutated by the DB API call.

This change makes a copy of the original list and passes back the new
list for the DB API methods to use, and adds some documentation to
hopefully clarify intent and usage.

A test is added to demonstrate the expected behavior of the utility
method.

Closes-Bug: #1393491

Change-Id: I49511f608291b66642ced00a3c13833e18fab3d7
Indicate whether service is down for mc driver

memcache driver for service didn't log any clue
whether the service is down or not. This patch add a
log to indicate it at DEBUG level.

Closes-Bug: #1382564

Change-Id: I05e12b56411f4475d1ef50e90e09abf75d7355b0
Only filter once for trusted filters

In spawn process the filters will be used only once if the
run_filter_once_per_request is set to True. This apply to the hosts
that will not be affected by previous instance resource consumption.
Trusted filter should be in this kind of filters.

Change-Id: Ia223797798679fecfcf90983ca81a9f395e67c3b
Network object: add missing translations

An exception was raised and not translated in commit
e134f81d85f42b87238f7786b0b50066129c968d.

Change-Id: I1c65041bd3a7152088f1660800d3a58f6fe12eea
Remove old Baremetal Host Manager

Baremetal was deprecated in Juno and its driver was removed in
46ed619b9ab1d61582f36155eea0d4a88f31fd50

This cleans out the parts that's still left in the scheduler.

Change-Id: I86f583f7d0747a164dae4530e25f8b01c2144673
Set vm state error when raising unexpected exception in live migrate

The instance stuck at migrating task_state when unexpected exception.
This is confuse for user, this patch set the vm_state to error.

Change-Id: Ib1b97452bc5e777c66c4d368f71156dbe1e116b7
Partial-Bug: 1397153
Scheduler: return a namedtuple from _get_group_details

Commit 459ca56de2366aea53efc9ad3295fdf4ddcd452c added the utility
method _get_group_details. This patch returns a namedtuple that
contains the hosts and policies for the instance group. This makes
the code easier to read and more robust.

TrivialFix

Change-Id: I76208092b06408022f48b1d965b982af86c78161
Add shelve and unshelve info into devref doc

The diagram on http://docs.openstack.org/developer/nova/devref/vmstates.html
does not currently show the "SHELVED_OFFLOADED" state and the
associated "shelve", "shelveOffload" and "unshelve" state transitions.

Change-Id: I50eb07a84336160b8120ca294598576eeb982d28
Closes-Bug: #1394215
Remove the volume api related useless policy rules

There are some old policy rules used by old nova volume, those are
useless anymore, this patch clean them up.

Change-Id: Ibcdba00652808158019600f8ad75e80c85f9423e
Closes-Bug: #1398686