Cleanup reboot_instance tests

Convert the reboot_instance compute manager tests into true unit tests.

Change-Id: Ife10bda2726a8f84a0a81df3268894bf3e8a0a12
Make sure reboot_instance uses updated instance

compute manager's reboot_instance() was doing a check on a stale version
of instance['power_state'] as well as passing stale instance data to the
driver and notification calls.

Fixes bug 1098727

Change-Id: I59f12f09d6e8a364e65f53912c09132a249c88c0
Fix incorrect comment, and move a variable close to use.

Change-Id: Ifd10df2d6ce3844fb676cfb5c294de170cf375bf
Move network call from compute API to the manager

reboot gets network info from the network manager in the API only to pass
it to the manager.  This causes an un-needed delay on the API call.  It
also causes issues with cells, as with cells you should query the network
service close to that cell.

Fixes bug 1098741

Change-Id: If6badc007ad812e5539a3738911011685cf9df35
instances_path is now defined here.

Remove comment which is now inaccurate.

Change-Id: Ie1aa2167ef2e53f0a1c90ec9727b3580bab8f851
Chown doesn't work on mounted vfat.

As reported by a user. Resolves bug 1092560.

Change-Id: I44c847d5e7f3242ca46a7436bcbc6e519baa88fc
Centralize instance directory logic.

This is the first step to being able to change the name of the instance
directories to something more unique than instance name.

Sneaks up on bug 1023865.

Change-Id: I1340a6b8644680325cba1e90a208e4be33ace6b4
Fix logic error in periodic task wait code.

I was calculating the time to wait for the next run of a periodic
task incorrectly.

Resolves bug 1098819.

Change-Id: Ida60b69014aa06229111e58024e35268262f18fb
Clean up compute API image_create

The _image_create() code in compute manager is the only place where
db.instance_test_and_set is used.. which was added before
'expected_task_state' support was added to instance_update.  By
switching to use self.update(), we can also take advantage of it doing
the state change notification for us.

The instance update and the compute RPC call have been moved out of
_create_image() and into snapshot() and backup() to support a future
cells patch.

Change-Id: Ib6603f732d28e49cb6f351447da5f6e41615dea5
Cells: Reduce the create_image call depth for cells

This patch reduces the create image call depth (for snapshot/backup) by
returning the basic image details to the user before we call down to
the child cell.  The image entry is created in glance immediately, and
the child cell will finish up the rest.

Implements blueprint nova-compute-cells

Change-Id: I048cc532614c602f3aa6b539fb51e951174e4598
Cells: Commit resize quota reservations immediately

There's not an immediate good solution for quotas on resize with cells
due to how it's implemented.  Will have to revisit this with a better
patch later.  This can lead to some out-of-sync issues when deleting
things in certain resize states... or if there are resize errors.

Store migration information on API cell to correctly handle quotas

Revert and confirm of migrations require access to migration information
so they can calculate the reservation correctly. For new resizes, store
a migration record locally so it can be used later on. For old resizes,
keep the previous behavior (for now).

Implements blueprint nova-compute-cells

Change-Id: I356600d1d0d9408b019a9422f795b4244c252052
Populate service list with availability zone

Fixes bug 1099399

Availability zone was removed from the service object and is now added
via a separate call to availabilty_zones.set_availability_zones

Change-Id: I89126bb72e482f3ce701a9e28035416805a639a0
Keep self and context out of error notification payload.

Back in the day, having self and context in the error notifications
was handy for debugging. Now, there is a lot of confidential stuff
stored in these objects (especially when self = ComputeManager) ...
like passwords, etc.

This patch strips it out.

Also removes dead wrap_exception calls (which did nothing since they
did not specify a notifier).

Change-Id: Ieab7bd79b64e01c7bca18dbce97455e50094871c
Extract validation and provision code to separate method

This enables the blueprint vm-ensembles to make use of the existing
Nova logic for the VM validations prior to scheduling.

Change-Id: I4966742b5f06087ad74ac75cbdf946f0bd9b6431
VMware Compute Driver Rename

blueprint vmware-compute-driver

Rename VMWare to VMware
Rename network_utils to network_util to conform to the util class naming convention
Remove the infinite loop in vim.__getattr__

Change-Id: I5bdad331a86c7aa4ca36e7a8345b53e455678c0f
Fix uses of service_get_all_compute_by_host

There should never be more than 1 service entry for the same topic and
host, however this method returns a list of services.  All callers of
this method except for 1 already account for there being only 1 service
entry for a particular 'compute' host and only use the first entry in the
return list.

This patch renames the DB API call to be 'service_get_by_compute_host'
and returns a single entry.  All uses of the old method are adjusted
accordingly.

Change-Id: I0e0ef62f5d2e71efe756940d9fdd98aa02fef216
Merge "Fix incorrect comment, and move a variable close to use."
Fix addition of CPU features when running against legacy libvirt

When running against an libvirt < 0.9.10 which lacks support for the
'host-model' CPU type, we must fake it by copying the host CPU
model and features. Unfortunately the code was forgetting to
append the new features to the CPU object feature list

Bug: 1099527
Change-Id: I39c6df6e85d77763ad279961fd6f0da70ac2415e
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Merge "instances_path is now defined here."
Merge "Extract validation and provision code to separate method"