Clearer default implmentation for dhcp_options...

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

Change-Id: Iff53d5eb7e88e18849696d858b3d910b6ea71e63
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
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
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
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
tests: update _get_instance_xml to accept custom flavor object

Currently LibvirtVifTestCase._get_instance_xml creates a default
flavor object and uses it for all tests. This makes it dificult
to test settings that are being activated by values in extra
spects.

Allowing the method to accept a flavor object and use the default
one, if not provided.

Change-Id: I3835aa5e6cf09268b132b9de377004c0e8df9cb0
Make aggregate filters use objects

Some scheduler filters that use aggregates have been converted
to use nova objects. This patch converts the remaining ones to
use objects. In both cases the calls to the database are
replaced by calls to a utility method that gets the required
data using Aggregate objects. In the future these utility
methods could be replaced with an implementation that works on
a cache - for now they do not change the behavior - its just
a refactor.

blueprint kilo-objects
Change-Id: I42d5697a67805b7e85f82cf3cf2cd6e17d923955
Use admin only common test case in admin action unit test cases

This patch use nova.tests.unit.api.openstack.compute.plugins.v3
.admin_only_action_common as the base class of AdminActionsTest
which can be shared by v2 and v21

Partially implements blueprint v2-on-v3-api
Change-Id: I16b59e8db59242b8e7b626cc77d0fff6bfc062e4
Share lock_server unit test between V2 & V2.1

This patch moves lock_server unit test from v3 directory to contrib
and makes it shared by V2 and V21.

PS. lock_server unit test cases was removed from admin actions unit
test case.

Partially implements blueprint v2-on-v3-api

Change-Id: I9cee1ae5075d6e7a7cd7aa05b105e487c239d24a
Share pause_server unit test between V2 & V2.1

This patch moves pause_server unit test from v3 directory to contrib
and makes it shared by V2 and V21.

PS. pause_server unit test cases was removed from admin actions unit
test case.

Partially implements blueprint v2-on-v3-api

Change-Id: Ideb30ec8501b4e98cb2ddaa4194bdf19002999ab
Share suspend_server unit test between V2 & V2.1

This patch moves suspend_server unit test from v3 directory to contrib
and makes it shared by V2 and V21.

PS. suspend_server unit test cases was removed from admin actions unit
test case.

Partially implements blueprint v2-on-v3-api
Change-Id: I44d9bf8d70f8a9c6916a18c354285e950c2fa550
Share CreateBackup unit test between V2 & V2.1

This patch moves CreateBackup unit test from v3 directory to contrib
and makes it shared by V2 and V21.

PS. create_backup unit test cases was removed from admin actions unit
test case.

Partially implements blueprint v2-on-v3-api
Change-Id: I607acc7406f8538a644749f9fb218d160e3e306d
Add API validation schema for volume_attachments

This patch adds API validation schema for volume_attachments.

Update volume required only Volume Id in request body but sample
files used to pass 'device' also.
This patch also correct those API sample files-
doc/v3/api_samples/os-volumes/update-volume-req.json
nova/tests/functional/v3/api_samples/os-volumes/update-volume-req.json.tpl

DocImpact

Partially implements blueprint v2-on-v3-api

Change-Id: I489272528fe4f4c43ab781d6a1a46742b1702c76
Correct InvalidAggregateAction translation&format.

InvalidAggregateAction .looks like:
 class InvalidAggregateAction(Invalid):
     msg_fmt = _("Cannot perform action '%(action)s' on aggregate "
     "%(aggregate_id)s. Reason: %(reason)s.")

The values for action are not well formed and reason are not translated.
This patch fixs those problems

Change-Id: I9ed20badde8a38eb71c5f121f30e4d54ad50022e
Closes-Bug: #1278736
Optimize 'floating_ip_bulk_create' function

The existing floating_ip_bulk_create() DB API method used a for loop and
a session flush operation for each IP created. This patch consolidates
those many operations into a single INSERT statement, which will
perform better than multiple round-trips to the SQL database. We further
optimize the function by making a return of the changed rows optional.

Change-Id: I5cf075f38696110d2890cfa1ea488ca459d791a3
Add debug log for url not found

I got following error from unit tests
apparently it's not helpful to know what's the root cause to make the failure
This patch adds a debug log

2014-11-21 16:47:52,943 DEBUG [nova.openstack.common.fileutils] Reloading cached file /tmp/tmpTBjKpX/tmpiC7e2k/policy.json
2014-11-21 16:47:52,950 DEBUG [nova.openstack.common.policy] Rules successfully reloaded
2014-11-21 16:47:52,951 WARNING [nova.openstack.common.policy] Can not find policy directories policy.d
2014-11-21 16:47:52,954 DEBUG [nova.network.minidns] minidns file is |/tmp/tmpTBjKpX/tmpdjtU4j/dnstest.txt|
2014-11-21 16:47:52,955 DEBUG [nova.network.minidns] minidns file is |/tmp/tmpTBjKpX/tmpCHMwMh/dnstest.txt|
2014-11-21 16:47:52,958 DEBUG [nova.network.minidns] minidns file is |/tmp/tmpTBjKpX/tmpggVMPv/dnstest.txt|
2014-11-21 16:47:52,959 DEBUG [nova.network.minidns] minidns file is |/tmp/tmpTBjKpX/tmpz2Ptbv/dnstest.txt|
}}}

Traceback (most recent call last):
  File "/home/jichen/git/nova/nova/tests/unit/api/openstack/compute/contrib/test_virtual_interfaces.py", line 84, in test_get_virtual_interfaces_list
    self.assertEqual(res.status_int, 200)
  File "/home/jichen/git/nova/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 348, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/home/jichen/git/nova/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
    raise mismatch_error
MismatchError: 404 != 200

Change-Id: I30a302cf624f023cb7e2228ced7774036a6d7fba
Correct columns covered in migrations_instance_uuid_and_status_idx

Migration 142 added a new index migrations_instance_uuid_and_status_idx
that covers columns deleted, instance_uuid and status, but the index
added to the model only covers instance_uuid and status.

Change-Id: I6ffdeabbab54223b2be844048917588adaceb9bb
Partially-implements: blueprint validate-migrations-and-model