Use 201 instead of 200 for action create of flavor-manage v3

All of v3 create action should return 201. Fix this for flavor-manage v3

Closes-bug: 1252162
DocImpact

Change-Id: I4fc698abdf89c93cb6ea0990ae43960f8c651d95
Fix sample parameter of agent API

The parameter of agent update API has been changed from "para" to
"agent" since Nova v3 API, and this patch fixes the sample doc.

Partially implements blueprint v3-api-specification

Change-Id: Ic9c0f11a637e48daa9457ab9ae923fefc0fb350d
Removes os-personalities extension from the V3 API

As per the discussion on the mailing list here:

http://lists.openstack.org/pipermail/openstack-dev/2013-September/015490.html

and discussions at summit, this patch removes the os-personalities
from the V3 API.

DocImpact

Part of blueprint v3-api-remove-extensions

Change-Id: I1a57ca812a9d71c0b1bab5d16ffad8eb82cba539
Remove traces of V3 personality extension from api samples

Removes occurences of the personality extension from the V3 API
samples as the extension has been removed. Cleanup of consistency
of image and flavor ref examples for the api samples.

DocImpact

Partially implements blueprint v3-api-remove-extensions

Change-Id: I43a34097904d3d7e280039c3d5d76479a49e92d0
Check if reboot request type is None

If the reboot request type is None, raise HTTPBadRequest like if the
argument was missing.

Change-Id: I75b1791b7a6c9304c3a78e869fe63d72302fc9d8
Closes-Bug: #1247735
fakevirt: return hypervisor_version as an int instead of a string

The compute_nodes.hypervisor_version type in the database is an integer
not a string. This is only caught in postgres and not MySQL. Changing
the fakevirt driver to return the proper type allows for the
test_virt_drivers test to make check this for all drivers it currently
tests.

Change-Id: I25e4dba855b954a2451bced9a53172b51eb47238
Fix logic in LibvirtConnTestCase._check_xml_and_uri

The _check_xml_and_uri method has two loops making it
iterate over different hypervisor types. By default it
will iterate over qemu, kvm, xen and lxc, but it can be
made to only check xen by setting the 'xen_only' param
or the 'expect_xen_hvm' parameters.

Unfortunately the second loop is only filtered if the
'expect_xen_hvm' parameter is set, not if only the
'xen_only' parameter is set. This flaw hasn't showed
up before, due to a flaw elsewhere in the libvirt
driver code, cancelling it out.

Change-Id: If70faa05975b726067ab6edaa505ca8d0c230a38
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Remove duplicate setting of os_type in libvirt config builder

In the following change

  commit 158d821204d2f79cc06c1443562b3ce9bbe7cb9f
  Author: Christoph Thiel <cthiel@suse.com>
  Date:   Thu Jul 26 00:07:24 2012 +0200

    libvirt driver: set os_type to support xen hvm/pv

The libvirt driver get_guest_config() method was changed to
use the 'vm_mode' property from the instance to set the guest
os_type attribute. If this property was not set, then it used
defaults based on the virt type. Unfortunately it neglected to
remove most of the existing later code which also set os_type
based on virt type. So in many cases we end up setting the
os_type twice. Fortunately this did not have any ill effects,
since only Xen currently needs the ability to override os_type
using 'vm_mode'. This change cleans up the mess to avoid
future confusion & problems.

Change-Id: Ib11cb1196755f993b07e892e9f2adfc36e44a4e2
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Compact pre-Icehouse database migrations <= 150.

Compacts the pre-Icehouse database migrations <= 150 into a
single migration (150_havana.py).

Pre-Icehouse users will now need to upgrade to Havana before
running any Icehouse migrations.

Tested on MySQL and PostgreSQL schemas on Fedora 19 to ensure the
new compacted migration generates an identical schema to the
previous migrate scripts in Havana.

Specific changes include:

 1) Make migrations.instance_uuid a String 36.

 2) Add migrations_instance_uuid_and_status_idx index.

 3) rename instance info caches seq (postgresql only, dropped from
    baseline)

 4) Add source_node, dest_node columns to migrations. Indexes...

 5) Add new volume usage cache table.

 6) Drop aggregates.availability_zone column.

 7) Drop services.availability_zone column.

 8) Add instance actions tables.

 9) Convert PostgreSQL to INET.

 10) Add host to instance faults.

Implements: blueprint compact-havana-db-migrations

Change-Id: Ic0c318967b69af32536b5ab6999affc7755ec442
Compact pre-Icehouse database migrations <= 160.

Compacts the pre-Icehouse database migrations <= 160 into a
single migration (160_havana.py).

Pre-Icehouse users will now need to upgrade to Havana before
running any Icehouse migrations.

Tested on MySQL and PostgreSQL schemas on Fedora 19 to ensure the
new compacted migration generates an identical schema to the
previous migrate scripts in Havana.

Specific changes include:

 1) Make task_log period_begining, period_ending a DateTime.

 2) Change type of deleted column.

 3) Create shadow tables.

 4) Add task log unique constraint.

 5) Add security_group_default_rules table.

 6) Add networks unique constraint.

 7) Revert ip column length.

NOTE: This patch removes the 184_sqlite_upgrade.sql and
184_sqlite_downgrade.sql migrations since these were causing
new test failures and the standard DB migration seems to take
care of it.

Implements: blueprint compact-havana-db-migrations

Change-Id: If977e5f02fffbfb1bc257b3beddf2d7133e6c7b9
VMware: Fix unhandled session failure issues

VMware driver has a re-try mechanism to handle session expiration
failures. Due to a minor bug in the exception handling module, this
failure was unhandled.

The patch fixes this issue and has added tests.

Closes-Bug: #1252827
Change-Id: Ie91adb4b4b57b7cefeed855cdbe4710da86294f0
Document when config options were deprecated

When going through the code and looking for what code was deprecated and
when, its easier to know if there is an explicit comment. Otherwise one
has to trace through 'git log' and 'git blame' to be 100% sure that its
ok to remove the code.

Change-Id: I57b5861e57168c44729934757e732de962f3d91a
Clean up test cases for compute.manager._check_instance_build_time

This patch cleans up the unit tests related to the
_check_instance_build_time method so that they are actually verifying
the expected vm_state value when the instance is updated.

This patch also removes the test_instance_build_timeout test case
since it was completely redundant with the other one modified
here. I checked the git history and both test cases were added
in the same commit which confirms that they weren't added for
different reasons, i.e. separate bug fixes/use cases.

Change-Id: Ib384c84e2954bd303661386256053b3c1ad38239
Fix HTTP response code for network APIs and improve error message

This patch corrects the http response codes for network resources to be
consistant with other resources by returning a 400 instead of a 404
if the desired resource is not found.

This patch makes the following api changes:

v2-api: NetworkNotFound now returns 400 instead of 404 and improved error
        message which network was not found instead of
        'The resource could not be found'.

v3-api: PortNotFound and NetworkNotFound now returns a 400 instead of a 404.

Closes-bug: #1245696
DocImpact

Change-Id: I66eb0c0ab926e0a8d1e2c9cfe1f7fd579ea3da21
Don't log stacktrace for UnexpectedTaskStateError

An UnexpectedTaskStateError is actually an expected behavior and we
don't need to log a stacktrace every time it happens. This stacktrace
is one of the most common ones found in nova-compute during gating jobs.

Change-Id: I8b33f72dc0f4beaca969de084481d66987faa974
Configuration element for describing video drivers.

The configuration is needed to allow the users to select
a non default video driver.

Partially implements blueprint libvirt-video-driver-selection
Change-Id: Ic6b3e44cfb7e22e0a215f7b159963df35ee1ebac
Libvirt: Adding video device to instances

Adding a video device driver to an instance, when VNC or SPICE are enabled.
Selecting the qxl driver when SPICE is enabled, otherwise use the Libvirt default, cirrus.

Implements blueprint libvirt-video-driver-selection
Change-Id: Icc3c538f2b81cc242baf87dc3538c27daf96ec38
Added a new scheduler metrics weight plugin

The new metrics weigher can compute the weight based on the compute
node host's metrics data. The to-be weighed metrics and their
weighing ratio are specified in the configuration file as the
followings:

    metrics_weight_setting = name1=1.0,name2=-1.0

The final weight would be name1.value * 1.0 + name2.value * (-1.0).

This is part of the blueprint utilization-aware-scheduling.

DocImpact

Change-Id: Ib3e68505e6d4d8f6d67b54c5f00de3e1c172738c
libvirt: remove unused imports from fake libvirt utils

Remove code that is not used.

Change-Id: I3943ac2c68a149e27b47fb2604c05e3d2e5dc2e2
Closes-bug: #1258103
Add atomic flavor access creation

This adds the ability to update the list of projects for a flavor
in a single go during create. This avoids a brief period of public
visibility between the time the flavor is created and assigned a
project.

Change-Id: I5c15c78809bfcb78e110c0d45dde8460a0ec98d6