xenapi: remove propagate xenapi_use_agent key

The compute.api class will already propagate then xenapi_use_agent key
when required, so we can remove the xenapi specific code that tries to
propagate this value. The code did not correctly access the system
metadata, would have failed to propagate the key anyway.

Fixes bug 1204933
Change-Id: Ib291a265318d80705129e565155d4250fd704b75
xenapi: no image upload retry on certain errors

There are a few upload errors that glance plugin should
not retry upload on, as it will fail again. This patch changes
upload to not retry on the following conditions in addition
to the 401 error that it already handles:

- CONFLICT
- REQUEST_ENTITY_TOO_LARGE
- PRECONDITION_FAILED
- FORBIDDEN

Fixes bug 1203726

Change-Id: I538a4f9b133169b2e398e7dfcb3af58fef204f03
Fix instance_usage_audit_log v3 follow REST principles

Use query parameter 'before' instead of show.
BTW, add expected_errors decorator.

Partially implements bp v3-api-extension-versioning

DocImpact

Change-Id: If1168c01e6342675370acdf278e1c0317aff93d8
Raise 404 when instance not found in admin_actions API

The pause/unpause/suspend/resume/reset_network admin action APIs do not
handle the case where the instance in the request is not found and they
raise HTTPUnprocessableEntity (code 422) instead. There are several
other operations in the same API which handle the 404 case and translate
it correctly, this patch cleans up the rest.

Closes-Bug: #1204999

Change-Id: If54d6be99db55b4f99da11fe75c14bf21685e809
remove improper usage of 'assert'

The assert will not raise AssertionError when run Python with '-O' flag.
And at the same time, any program should have a same result with or
without '-O' flag. So we could use assert to check some rare condition,
but we couldn't use it in logic flow or except it must raise an
Assertionerror, for example:

this is not bad:

def func(fname):
    assert os.path.exist(fname)
    f = open(fname)
    ...

but this will have different results with or without '-O' flag

def func(num):
    try:
        assert num is 5
    except: Assertionerror:
        log.error("your number isn't 5!")

The second case is what I fixes in this patch.

fixes bug #1199354
Change-Id: I20e83ecfc181d213f357aa74e0af3a110526904c
Add expected_errors for extension Console v3

Partially implements bp v3-api-extension-versioning

Change-Id: Ie4c20eb494c68b0d75114872ae7b227da286d609
Fix Instance objects with empty security groups

This makes sure that a DB instance with an empty list of security
groups does not result in an object with an unset attribute, thus
triggering a lazy load on access (and ultimately an exception).

Related to blueprint compute-api-objects

Change-Id: Ib33b05853e9d067cbac5d3e87824a68e9935b822
xenapi: Adding BitTorrent download handler

Part of series of patches which extends uploadhandler driver-pattern to also
handle downloads.

DocImpact

Change-Id: Ic5445167bb425c9ba910039db182783a2f1defdd
Fix typo in compute.rpcapi comments

Change-Id: I76a60b29352e023e5c72d546e144eb330b218b64
Make fake_instance handle security groups

This makes the fake_db_instance() helper create model-like security
group objects in the returned instance if a list of names is
specified. This is required to test anything that uses security
groups on the instance.

Related to blueprint compute-api-objects

Change-Id: I4a7d91c939af8c0dc4e0b3e29c477a859d85fd3e
Pull out instance object handling for use by create also

The instance_create() function needs the same type handling
logic to tolerate object-initiated creates as does instance_update().
This pulls that logic out to a common function and makes both of
them use it.

Related to blueprint compute-api-objects

Change-Id: Ie8612ffb225b95bf7eab3c462441665095ed19bc
Add Instance.create()

This adds a create method to the Instance object and associated
tests.

Related to blueprint compute-api-objects

Change-Id: I0e530df042eaf6f646e8ac94bb956d3d427ae333
Enhance object inheritance

Objects could only inherit fields from the NovaObject base class.  This
patch fixes this so that any object subclassed from another object will
inherit all fields.

Related to blueprint unified-object-model

Change-Id: Iaf511be490a44d357b4f527d37a64f3794c60afe
Spelling correction in test_glance.py

Changed "deatils" to "details".

Change-Id: I7c0db12643227bd177fbe60c06748d38741d3f7a
Remove dead capabilities code

Although the scheduler.host_manager has logic to handle the
'allowed_vm_type' capabilities, no virt driver supports that capability.
So just remove the dead code.

Part of bp no-compute-fanout-to-scheduler

Change-Id: I223fc10a27291d88d0e12057504525233ab845ad
Merge "xenapi: Adding BitTorrent download handler"
Merge "Raise 404 when instance not found in admin_actions API"
Merge "remove improper usage of 'assert'"
Merge "Add expected_errors for extension Console v3"
Merge "Make fake_instance handle security groups"