Policy check for forced_host should be before the instance is created

Move the policy enforcment for force_host and force_node into the
_handle_az() method so that any violation of policy is detected before
the DB entry for the instance is created.

Fixes bug: 1220220

Change-Id: Iaf6df4f8df6cca71fcb860244ccf758d7908b8f1
VMware: Fix volume detach failure

The VMwareVCDriver method "detach_volume" is missing the "encryption"
argument and thus does not conform to the driver API. Adding the missing
argument solves TypeError being thrown when detaching a volume.

Change-Id: Ib785c2b2cf4c25deed272f8e3f0f47abe6139d1c
Closes-Bug: #1226826
Force textmode consoles on baremetal

Physical hardware often has console interception hardware for OOB
monitoring/management. Prevent the kernel from switching into a
graphical console mode so the hardware can do its job.

Change-Id: I3a5b17ab194238ada34fee1c834de22fbdcd7430
Related-Bug: #1178112
Change service id to compute for compute/api.py

Now the default service id for nova api notification is aggregate,
this is not accurate, we should change it to compute.

Fix bug 1225579

Change-Id: Ife558024c57d9fd035cd1a618063c656e03c52a3
Update sample config generator script

This patch reverts 13d80020. The help message should be added
in oslo-incubator since generate_sample.sh is synced from there also.

Resolves bug #1204204

9f2b93b Sample config file generator clean up
33f9f78 Replaces relative path to absolute path in conf file generator
c97e17b Refactors if statement in config generator
8b11fda Provide useful defaults for config generator
4c02e0a Unset OS_xx variable before generate configuration

Change-Id: I96fcb39c0c620c147fea5c96416e506a758619ce
Add tests for pre_live_migration

Add tests to ensure retrying plug_vifs in pre_live_migration works.

Closes-bug: #1228749
Change-Id: I80d4cdc27836511c55b2555556edd7a1964c7158
VMware: enable VNC access without user having to enter password

When the vnc_password was not configured in the 'vmware' section
the user was unable to access the VNC console. The user would be
requested to enter a password but all attempts would fail.

The 'vnc_password' was added as a workaround to the problem above.

The fix ensures that the VMware driver behaves like all of the other
virt drivers when it comes to the VNC access, that is, the user will
not have to enter a password.

The password support will be deprecated and removed in the next
version.

Fixes bug: 1215352

Change-Id: I728861b8965ee3d3b8444a0440ddd0a8e5bb9021
Removes pre_live_migration need for Fixed IPs

This commit removes the validation that requires Fixed IP Addresses
for pre_live_migration.  The original comment regarding the
pre_live_migration requiring Fixed IP Addresses alluded to uncertainty
about it not being required.  Workloads should not require a Fixed IP
Address for migration, typically just the storage is required to be
similar.

The commit also updates the associated test case to ensure that no
exception is thrown in the pre_live_migration if a fixed IP Address
is not specified.

Change-Id: I2c4d4dae2cb0f00c67f0f731b5080196564b37da
Closes-Bug: #1226226
Require oslo.config 1.2.0 final

Now that 1.2.0 has been released, require it rather than one of the beta
release tarballs.

Closes-Bug: #1182861
Change-Id: I75ffc4a572d14488d19491a38742d6920951c171
Correct lock path for storage-registry-lock

This fixes the lock path for storage-registry-lock to prevent a
potential data loss due to a race-condition scenario.  Since the
storage-registry-lock is used to modify a json blob that is
authoritative as to which nodes are using the storage so that
we don't remove any "in-use" backing files on the shared storage
segment (if in use).

The potential data-loss could occur in limited cases of the race
that the lock should prevent.  This can only occur if the image
cache cleanup is triggerd when a node has been eliminated from
the register_storage_use JSON incorrectly by this race condition.

Most of the time the race simplyresults in a corrupted json blob.

Fixes-bug: 1194696
Change-Id: Ib1a5785646e75dc90bdd2a7e69a697adc4fbb298
Add V3 API samples for security-groups

Partially implements blueprint v3-api-unittests

Change-Id: I6df70127a88881320052613f4c107e2287f375c1
VMware: fix bug for incorrect cluster access

For a number of methods only the first cluster would be accessed
and not the correct cluster.

Fixes bug: 1226211

Change-Id: I4eb3c360fc81de172e46418d5a16dd2bd7077fea
Remove _get_compute_info from filter_scheduler.py

After patch I6de33ada6dc377e20f8df07da92244f2c150b9fe and
Ie6f104368140b69a60e124ea96ef6bf7715fe34e, in filter_scheduler.py,
_get_compute_info has no use and no one is calling it, so we
can remove it directly.

Fix bug 1228475

Change-Id: Ia85068e402b6f0b2a9ed2a809d1c1dc63e0f3041
Fix console db can't load attribute pool

Lists consoles failed when populate console_type from console
db's pool attribute. The reason was db api console_get_all_by_instance
didn't join with pool. So add param 'columns_to_join' for db api, and
join pool attribute when lists consoles.

Change-Id: I18b44860270a401c55cf02b4334b973fbf357b03
Closes-bug: #1223205
Ensure we don't end up with invalid exceptions again

We've recently had a few (three?) exceptions where the messages
didn't work because there was a typo in the exception variable
name. This change adds a very simple unit test which ensures that
we don't end up in that state again.

Change-Id: I00423b4ce82428959e7591d5c5c47c1f25ec3029
fix typo & grammer in comment 363-364

Change-Id: Ic2f403007ac55d806bd6206859b5a796dc126fea
Update rootwrap with code from oslo

These are all minor changes bringing nova up to commit c03f247

c03f247 Skip hidden files while traversion rootwrap filters
3f4d1d5 Fix os.getlogin() problem with no tty
fc04531 Send rootwrap exit error message to stderr
3663010 rootwrap: improve Python 3 compatibility
28395d9 Fixes files with wrong bitmode

Fixes bug #1231206

Change-Id: I9f5faefc769fb37d37b6f093fe3a11a6e9f650d4
Don't wrap Glance exceptions in NovaExceptions

Exception objects from glanceclient are not serializable
in Nova and shouldn't be directly wrapped inside NovaExceptions.
The glanceclient portions of Nova that translate from Glance
to Nova should be creating new corresponding exceptions
independent of the Glance counterparts.

Change-Id: Ifbe992796f8c5738ae350617d41a9c312fa8ab94
Windows instances require the timezone to be "localtime"

This was relatively simple to fix, assuming that the image used
to boot the windows instance has the os_type set to "windows".
The use of os_type in this manner is consistent with the
existing use in the Xen hypervisor driver.

DocImpact: if you're booting windows instances, then you need to
set the os_type image property in glance to "windows". Otherwise
your instances will have their clock timezone set to UTC, which
has unexpected side effects in windows.

Change-Id: Id6759a290ed25c9add97ac61bb7d165b3fb908b2
Closes-Bug: 1231254
Get image metadata in to_xml for generating xml

The to_xml method of libvirt driver will generate xml file of instance
during hard reboot/spawn/rescue/migrate and other operations, and the
image_meta is used for generating correct xml of instance.
But the accurate image_meta may not be passed into the get_guest_config,
so some configs related to the image_meta will be lost, we need to get the
image metadata if it is not passed to the to_xml method.

Fixes bug 1206809
Change-Id: I6942837905334a652cda64d7dd41d3b575846d93