Change unit test for availability_zones.reset_cache

Test_rest_availability_zone_reset_cache can not make sense
because the result of az._get_cache().get('cache') before
executing az.reset_cache() and after az.reset_cache() are
same.

This Patch will provide a reasonable test for it.

Change-Id: I7a27998bdf70f39077a5d79fc460974fc5806c3e
Closes-bug: #1258041
fix log message in APIRouter

In _setup_ext_routes(...) and _setup_extensions(...)[0], there are three
logs telling that I'm setuping extensions routes, and these are done,
those failed. At line3 in [0], every resource woulld be logged before
the line 6-7 skip (conintue in Python). So here should be that I'm
'extending' resource, not 'extended'. Similiar in line 38 and line 43,
these two should be what is done and what is failed.

So this patch fix the first log from 'Extended' to 'Entending', and in
third log, 'extending' to 'extended' instend which makes context log
more reasonable.

[0] http://paste.openstack.org/show/60246/

Change-Id: I2de66f1a8e09945e1915b61771a55af6b630369c
Remove unused code in test_attach_interfaces.py

"body = jsonutils.dumps({'port_id': FAKE_PORT_ID1})" is unused in
test_attach_interface_without_network_id(). We should remove it.

Change-Id: Id31b559752d57c9f55fd2bf0de909b8d8f9a0333
Closes-Bug: #1266617
Merge same db calls for some quota methods

db.quota_get_all_by_project is called twice in method limit_check()
and reserve(),
db.quota_get_all_by_project_and_user is called twice in method
get_settable_quotas() in nova/quota.py

Change-Id: Ie5e3a414d3d52964c16613f44fe60a7f68bc0c66
Closes-bug: 1277068
Fix multi availability zone issue part 2

In order to keep consistency with fixing in
code review:
I788782a9f21ec2672551f75123753175bb268586

adding aggregate az checking logic to guarantee
that aggregate updating and aggregate metadata
updating shouldn't be done when aggregate's hosts
belong to other az. So, when az conflict exist,
user should remove those hosts.

sync the changes into V3 aggregate APIs.

Fixes: bug #1200479
Change-Id: I18ad1ac22c6aee298ccc75c978b85241ae1ac616
VMware: Fix incorrect comment indentation

Change-Id: I60ae70701af2506753ded5ef3d25f17cc36a0b1b
VMware: improve exception logging in driver.py

Change-Id: Id46860d269462673bc935653b2ce1ea1036db002
Remove unused methods

The following methods are not used.
 o name() in nova/compute/power_state.py
    name() has been deleted in the following commit.

      commit 5270b0a565ec26d2f7de3a7d95be86433d8c6bd2
      Author: Dan Prince <dan.prince@rackspace.com>
      Date:   Wed Aug 17 11:46:28 2011 -0400

          Split set state into vm, task, and power state functions.

 o valid_states() in nova/compute/power_state.py
    valid_states() has been deleted in the following commit.

      commit 84e069b8d637c08f0434038ff2a2b272254e4a0e
      Author: Dan Prince <dprince@redhat.com>
      Date:   Mon Aug 6 12:09:23 2012 -0400

          Remove unused InstanceInfo class.

Change-Id: I85051d27834f166d5a3596e31ea4f78b82809fda
Make os-service API return correct error messages

webob.exc.HTTPBadRequest() can't return the error message
by passing 'detail' parameter.
This patch fixes this bug in nova service_update.

Change-Id: I889d7d1caddd1f0b0dc63292c3ceac7e493b6b79
Make nova-network use FixedIP for host and instance queries

This makes nova-network manager use the FixedIP object for the
get_by_network_and_host() and get_by_instance_uuid() queries.

Related to blueprint nova-network-objects

Change-Id: Ifa26ba1db6a9975e21a5a1c4b8742d82ca6d0772
Make it possible to disable polling for bandwidth usage

Bandwidth usage is only supported by some hypervisor drivers, but
the period task always runs and asks conductor for a list of
instances before it gets a NotImplementedError from the virt driver.

This change allows this to be disabled by setting bandwidth_poll_interval
to 0 which is consistent with other periodic task interval settings,
avoiding the wasted conductor call.

It also will automatically disable bandwidth polling if the driver raises
NotImplemented.

Change-Id: I2ac9c967c5ceafffc39a0a372146c762891a08b8
Fix auto instance unrescue after poll period

We were seeing massive amounts on instance faults from failed automatic
unrescue. It was coming from the instance not having system metadata
populated.

While the route cause is a combination of using non-object instances
that were not populated with system metadata. With an object, the system
metadata would lazyload as required, but clearly not with a pure dict.

This fix ensures the non-object instance has system_metadata, so the
extraction of the flavor from the instance, during notifications sent
during unrescue, now succeed.

Closes-Bug: #1277054
Change-Id: I63bdd6c49505557829241869fd3efd2b2754530b
Break out the meat of the object hydration  process

Since we call the NovaObject base class to hydrate an object, the
subclass implementation does not get a chance to run specific code
during or after hydration. Things like Instance that keep local data for
change tracking need a chance to update themselves after hydration
is complete. This breaks out the meat into a separate method which
can be easily overridden in a subclass.

This also makes Instance use this to ensure metadata tracking is
up-to-date after hydration.

Related to blueprint compute-manager-objects

Change-Id: Ie070c17495f7a4cc6210d256a3170ac9c06e198f
Make delete_instance_metadata() use objects

This adds an optimized Instance.delete_metadata_key() method
and makes compute_api use it instead of calling directly to the
database.

This changes a test that previously verified that the notification
was missing instance.metadata (because of the rpc calling convention)
since we can now include the updated metadata in the notification
easily.

Related to blueprint compute-manager-objects

Change-Id: I827cb98d004e7a612b839dd5a8bbe26cc91c692d
Fix instance metadata tracking during resets

The Instance object tracks its metadata and system_metadata dicts for
changes by maintaining a mirror. This patch fixes the obj_reset_changes()
method which previously would always reset both of those tracking
mirrors anytime any single field was reset.

Change-Id: I496184e3ddaa56b8709f4338fd8cdc2342198273
Drop unused dump_ SQL tables.

Drop the following tables which are no longer
used in Icehouse:
 -dump_compute_node_stats
 -dump_compute_nodes
 -dump_instance_actions
 -dump_instance_actions_events
 -dump_instance_faults
 -dump_migrations

Includes a new test to ensure the tables are dropped.

Change-Id: Ifa70b8dedebd074353560ac46d42a9cc5d133be2
Closes-bug: 1266538
Make consoleauth token verification pass an Instance object

The consoleauth manager looks up and passes a SQLite model to the
compute_rpcapi.validate_console_port() method, which is expecting
an Instance object now. This fixes that by replacing the direct call
with an object lookup.

Change-Id: I48a63805e4691899396559f48b29bef3030d5ef8
Hyper-V driver RDP console access support

Implements: blueprint hyper-v-rdp-console

Hyper-V uses RDP to provide graphical console access, unlike most other
hypervisors which use VNC for this purpose.

This patch implements get_rdp_console in the Hyper-V driver.

Change-Id: I92e6c4921ff42c1bac2c76dfa1570160a0d11338
Removes XML support from security_groups v3 API

The XML namespace was removed from the V3 API plugins,
this part of the code does not work again.

Partially implements blueprint remove-v3-xml-api

Change-Id: Ib30f5f690f8088ed63dd82782698f975024a5b6e
Removes os-simple-tenant-usage from the V3 API

The extension pre-dates ceilometer and equivalent
functionality is now much better managed using
ceilometer. So we're removing this before the V3 API
is officially released.

Partially implements blueprint v3-api-remove-extensions

Change-Id: Ia8fd475e6f0c4dbc67f3c47279cbaa2280b3af0b