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
Clean up unused variables

This just removes a few variables that were unused and makes my linter
happy.

Change-Id: I0bc9fc1474e15801e4df84f78636c96ea1f916ff
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
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>
xenapi: stop hang during glance download

It seems there are cases when the server gets stuck in a building state
because the download from glance fails, but the nova-compute doesn't
find out.

After some code inspect, a likely cause seems to related to having no
socket timeout inside urllib2 when we download the image from glance. A
workaround for this issue is to configure the default socket timeout as
described here:
http://docs.python.org/3.1/howto/urllib2.html#sockets-and-layers

Fixes bug 1251650
Change-Id: I8b34d95d3524f3825b28e61cbbb59290653d3711
Fix UnboundLocalError in libvirt.driver._close_callback

If for whatever reason _wrapped_conn is None or not equal to the conn
parameter passed to the _close_callback method, the local _error
variable won't be set when calling set_host_enabled and result in an
UnboundLocalError.

Partial-Bug: #1257644

Change-Id: I40855f22d5449f3b3646c90fe2d9a71560eb86c4
Merge "Check if reboot request type is None"
Merge "Fix logic in LibvirtConnTestCase._check_xml_and_uri"
Merge "Remove duplicate setting of os_type in libvirt config builder"
Merge "Use 201 instead of 200 for action create of flavor-manage v3"
Merge "xenapi: stop hang during glance download"
Remove the largely obsolete basepath helper

Now that there is a static method for calculating the path to the
config drive, there was only one user left for basepath, and it was
a special case "no filename" user. So, remove it.

Change-Id: I8f4efe19da41d159e929853a5e757e0e168885d7
Merge "Fix UnboundLocalError in libvirt.driver._close_callback"
Merge "Clean up unused variables"
Merge "Remove the largely obsolete basepath helper"