update compute_fill_first_cost_fn docstring

The default value for weight of the compute_fill_first_cost_fn is
actually -1.0, which means it does exactly the opposite of what
the function docstring says it does. Update the docstring to
warn people of this fact.

Issue reported via bug #1023827 which was closed as won't fix
but the docs should be clearer. Updated based on feedback.

Change-Id: I56acde254c932a8e66f941aaeb7304665500610f
libvirt driver: set driver name consistently

Add pick_disk_driver_name to utils, to be able to set driver_name
consistently across volume and imagebackend. This is mostly required for
xen.

Xen requires specifying both the driver name and type attributes when
defining disks.  E.g. the following disk XML snippet

  <disk type='file' device='disk'>
    <driver type='qcow2'/>
    <source file='/tmp/disk0.qcow2'/>
    <target dev='xvda'/>
  </disk>

produces incorrect configuration in the xen tools

  (uname file:/tmp/disk0.qcow2)

Including the driver name fixes this

  <disk type='file' device='disk'>
    <driver name='tap' type='qcow2'/>
    <source file='/tmp/disk0.qcow2'/>
    <target dev='xvda'/>
  </disk>

produces

  (uname tap:qcow2:/tmp/disk0.qcow2)

Change-Id: Id984e0c431b6fc743a39e6e6f3dc3eb289fbb43a
Trim volume type representation.

Fixes nova-volume aspect of LP 1027281.

Use view builder pattern to only include non-extraneous
volume type attributes in the representation.

Change-Id: I33f1b579fd6ed4ed98fa04e9148e91eca125213e
Convert fixed_ips to using instance_uuid.

This should be the second last blueprint finish-uuid-conversion change.

Change-Id: Idd47c5ed3c30af24d60eb23b8e3881d61b4c7976
Fix exception handling in libvirt attach_volume()

Currently, the real reason for a failure is dropped when attempting
to unroll the volume connection (with the exception of when it is
VIR_ERR_OPERATION_FAILED). This change uses save_and_reraise_exception()
to correct that so that the actual reason for failure gets logged.

Fixes bug 1029463

Change-Id: Id47db565c4fb5a88d1a263600b41706dd3419726
Reinstate instance locked error logging

Commit eebc64f removed some error logging, presumably by mistake.

If checks_instance_state fails, and the action blocked, users aren't
notified but the error is logged for admins. Changing this behavior
clearly wasn't the intent of the no-db-messaging commit.

Change-Id: I14581171c201770b03cecc77d4a2933c9687ef11
Remove return values from some compute RPC methods

The checks_instance_lock decorator currently discards any return value
from the functions it wraps. Luckily, none of the callers of these
functions check for a return value.

Since the return values are unused, just remove them. Fixing the
decorator to return them would effectively be a change to the RPC
API.

And since we know the return value is unused, we also know that nothing
checks for the False return from checks_instance_lock() and that too
can be removed.

Change-Id: I8b49107dba51caf52665341e4977de179b6404f6
Call correct implementation for quota_destroy_all_by_project

Fixes bug 888229

Change-Id: I38779cbc84c5eacd796ce1ae5559d1ebffd1037e
Merge "libvirt driver: set driver name consistently"
Merge "update compute_fill_first_cost_fn docstring"
Don't import libvirt_utils in disk api.

Updates the virt/disk/api so that we no longer import libvirt_utils.

This fixes issues when using Nova compute with compute drivers other
than libvirt. (xenapi, etc.)

Fixes LP Bug #1029501.

Change-Id: I46ece309480ce0a0941a96371a51d77712c41eb6
Refactor glance image service code

Fixes bug 1029397

This adds better retry support, making sure that if we need to retry
requests to glance, we cycle through all hosts before potentially
attemping the hosts that failed.  The old random selection could cause
immediate retrying of the same host that failed.

This also adds logging of the host:port that failed and fixes a bug in
the retry test, which didn't actually successfully test retrying.

Tests for new code added.

Change-Id: I400616081e1e547b9ca2e0be622889d3a399a5bf
Merge "Call correct implementation for quota_destroy_all_by_project"
Merge "Reinstate instance locked error logging"
Merge "Don't import libvirt_utils in disk api."
Fix resizing VDIs on XenServer >= 6

The check used 'is' when it should have been '=='.

Also, a couple of small cleanups to make the code easier to read.

Change-Id: If98892703bc557732093230b023085c4744b8455
Allow power_off when instance doesn't exist

Certain errors that can occur while booting an instance may leave no
VM on the Xen hypervisor.  This can make that instance undeletable,
since the first step in soft_delete() is to power_off the instance,
and nothing catches the NotFound error thrown if the instance doesn't
exist.  The libvirt support handles the case of a non-existant
instance by ignoring NotFound--after all, a non-existant instance is,
by definition, powered off, right?

Fixes bug 1029132.

Change-Id: I5bffe3b61fe92fc32fb70cab941fa5ecd250df77
Merge "Refactor glance image service code"
Merge "Allow power_off when instance doesn't exist"
Avoid using 'is' operator when comparing strings

The 'is' operator compares identity, not value. Python doesn't guarantee
that two strings that are the same will also be the same object.

Change-Id: I2d7e7947b14272fa2a82d5e8eefa95dcaba375f7