Correct exception handling when create aggregate

when create an aggregate, InvalidAggregateAction might be raised,
this patch translates the InvalidAggregateAction to HTTPBadRequest.
Also, 2 unnecessary logs was removed becuase log is not output in
most BadRequest.

Change-Id: I3dac808d8edab6118e347eb5d78b96f96b9d40ca
Fix direct use of block_device module objects

This replaces all uses of nova.objects.block_device.Block* with
nova.objects.Block*.

Partial-Blueprint: object-subclassing

Change-Id: I7b7641cc75bbc180abd36920deedcb097fc3ecbc
Add read_only field attribute

Some fields of an object are created by the database automatically
like 'id' in service object, thus should not be changed in general.

Add a read_only field attribute to specify such situation, which
can only be set once and can't be changed any more.

Change-Id: I25ba81ed7ec0d16782a59851944a14792d4c84ce
Simplify filter_scheduler.populate_retry()

This is the exactly what dict.setdefault() is useful for.

Change-Id: I356af8f87b84fb23383c06080b8fd373054b5949
libvirt: Remove dated docstring

The docstring is out of date, we can update it or remove it.
The libvirt_opts includes all the details, so remove it.

Change-Id: Ia903ff71509b4228faf0580893c4720b5d8b9c61
Move set_admin_password tests from test_compute.py to api/mgr modules

To prepare for converting the set_admin_password compute API flow to use
objects consistently, i.e. no direct database updates, use dot notation
to access instance object attributes, etc, the unit tests need to be
refactored and moved from test_compute.py into test_compute_api.py and
test_compute_mgr.py to properly unit test the compute api and manager
changes, respectively.

As part of the move, the tests are re-written with mock.

Part of blueprint compute-manager-objects-juno

Change-Id: I5815f7dec3105440f1b211d7bac98888fde7a576
Remove duplicate method

Duplicate method(_do_test_create_instance_above_quota)
are found in compute/test_servers.py. Remove it.

Change-Id: I0753992cadc40adce40999bb5ae8ecd503bd53bc
Revert "Remove quota-class logic from context and make unit tests pass"

This reverts commit e25316ecb9c879cd1fe2de0c8a4c4d5a424324ab.

The quota_classes API was used to set default quota values
so it shouldn't have been removed, so reverting a series
of changes that removed the API and it's internal code.

Related mailing list thread on the topic:

http://lists.openstack.org/pipermail/openstack-dev/2014-May/035383.html

Partial-Bug: #1299517

Change-Id: If903863d28fbab74cfe571709a01cd2cdd46d174
Revert "Remove broken quota-classes API"

This reverts commit 7d22153d05c67bb0bf4838efdb17b3360ec2e367.

The quota_classes API was used to set default quota values
so it shouldn't have been removed, so reverting a series
of changes that removed the API and it's internal code.

Related mailing list thread on the topic:

http://lists.openstack.org/pipermail/openstack-dev/2014-May/035383.html

Partial-Bug: #1299517

Conflicts:
	doc/api_samples/all_extensions/extensions-get-resp.json
	doc/api_samples/all_extensions/extensions-get-resp.xml
	nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl

The conflicts are due to Mark McLoughlin's timestamp-format series
of changes on master (Juno).

Also note that quota_classes.py was changed due to
commit c75a15a4 to rename the NotAuthorized exception
to Forbidden.

Change-Id: I7890e6b41d4ebf19944c1d4db65111fcc4c45463
Handle string types for InstanceActionEvent exc_tb serialization

Commit 59a6cf233b538d6666740de4796fce25ed8265aa added code to handle
serializing non-str exception traceback objects, but didn't account for
unicode.  This change uses six.string_types to handle str and unicode
objects for the exc_tb argument.

Adds a new unit test for the unicode case and firms up two existing
tests for how traceback.format_tb is mocked (or shouldn't be in the case
of exc_tb being a str).

Closes-Bug: #1327476

Change-Id: Icc10b62a3f65610c50e86c0b366c2b70b1a0932d
Merge "Fix direct use of block_device module objects"
Merge "Revert "Remove quota-class logic from context and make unit tests pass""
Merge "Revert "Remove broken quota-classes API""
Merge "Handle string types for InstanceActionEvent exc_tb serialization"
Merge "Add read_only field attribute"
Merge "Simplify filter_scheduler.populate_retry()"
Merge "Remove duplicate method"
Merge "Correct exception handling when create aggregate"
Merge "libvirt: Remove dated docstring"
Merge "Move set_admin_password tests from test_compute.py to api/mgr modules"