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
Clearer default implmentation for dhcp_options...

'pass' is less clear than 'return None' for the base implementation.

Change-Id: Iff53d5eb7e88e18849696d858b3d910b6ea71e63
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
Don't touch info_cache after refreshing it in Instance.refresh()

We were touching info_cache to force it to be marked dirty in the
instance object after refreshing it. However, it isn't dirty, because
it has just been refreshed and the relationship to instance hasn't
been altered. Also, the dirty state on the instance object is
unconditionally reset immediately after this anyway.

Change-Id: Ibc8e9d95210d14c946f6f820492da2331c0d7fab
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
Remove unused oslo.config import

Change-Id: I7cc52bfcda72faf9fbdf67553d21b35823505dd6
Hard reboot doesn't re-create instance folder

When use share storage like ceph, instance's disk data is in ceph,
instance's disk doesn't rely on local instance folder anymore. So
when rebooting a instance, we should create the instance folder if
it is missed.

Closes-Bug: #1349978

Change-Id: I5948c7979a7dbe7764fba6cad1d9867893824024
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
Revert pause/unpause state when host restart

Give following scenario for instance task state
1) start to pause an active instance
2) the nova-compute died because of unexpected situation
3) when nova-compute start again , it's task state is pausing
it should be changed to None because host restarted

Also ,for the paused instance and its state is unpausing,
we need to unpase the instance.

Change-Id: If72a36dafd894ac47c0b255d701a3f9965ff2590
Closes-Bug: #1290639
libvirt: use qemu (qdisk) disk driver for Xen >= 4.2.0

According to the Xen ML [1] "qdisk is better supported and blktap is
unmaintained, we choose qdisk over blktap whenever possible" (change was
introduced in Xen's commit 0166217 [2]). The Xen documentation states
that the disk driver "should not be specified, in which case libxl will
automatically determine the most suitable backend" [3]. However, even if
libvirt does it OK [4] not setting the driver name so that libxl chooses
the best backend, it sets the file format to 'raw' so that a wrong
backend will be chosen by libxl.  Since 'qdisk' seems to be the
preferred option, it seems safe to set it as the backend.

[1] http://lists.xen.org/archives/html/xen-devel/2013-08/msg02633.html
[2] http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=0166217103e18368424fbd5ffff01c1ea50d0b17
[3] http://xenbits.xen.org/docs/unstable/misc/xl-disk-configuration.txt
[4] http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/libxl/libxl_conf.c;h=1210500858b00b1d10b0bc921ab8b5efc87e630f;hb=HEAD#l847

Closes-Bug: #1326238
Change-Id: Ia52d52a01916fac92dc8e648c462e237c0bfc915
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
libvirt: vif tests should use a flavor object

Some part of the tests code are still using a dictionary
to simulate flavor data structure.
However, it has been in fact changed to being a nova object.

Changing these part to be an object.

Change-Id: Idb0e1ca8fa09e1a36ba0f62175f01ee856e3f31b