Faster get_attrname in nova/objects/base.py

get_attrname function is called very very often,
and it's string concatenation method is not fast.

* Changing the string concatenation to a 2 times
  faster + operator instead of the % operator.

Change-Id: I326fd6dda8dd41a90757c69867afd62063231362
Remove unused network_api.get_instance_uuids_by_ip_filter()

Last usage was removed in ae781ee97947c33d6d43e4c21df4f338c875bf1c

Change-Id: I33dc14085ca0c887778c7379f0498714e8d30425
Error code for creating secgroup default rule

Trying to create secgroup group default rules
that already exists gives HttpBadRequest error,
but it should raise HttpConflict.

So updated the code to HttpConflict error.
Closes-Bug: #1374320

Change-Id: I93c6eb7fb96e7109404206367ed81495a4724296
Small cleanup in db.sqlalchemy.api.action_finish()

This function was pulling back a row, updating the returned object,
then returning a reference to it. This potentially races, as the
object may be updated in another transaction after fetching. In
practise it's probably fine, but the new code is more obviously
correct, and probably slightly nicer to sqlalchemy.

Change-Id: I879e973180278faa51e664d526d75e5f095a64ea
VMware: make use of oslo.vmware pbm_wsdl_loc_set

Make use of the oslo.vmware method for setting a defined wsdl.

Change-Id: I207f0e737139c06c5b1ea9019cfbf4659aa5ca1a
Add API schema for v2.1 block_device_mapping extension

By defining the API schema, it is possible to separate the validation
code from the API method. The API method can be more simple.
In addition, a response of API validation error can be consistent for
the whole Nova API.

Partially implements blueprint v2-on-v3-api

Change-Id: I6d53ef2e3dad5a4ac9b67a5838f6e07606a8372b
objects: allow creation of objects without dict item compat

The dict compat support in NovaObject is useful for incrementally
converting existing code over to use objects. Any brand new objects
though have no reason to support dictionary access, so there should
be a way to disable this compat mode.

This moves all the dict compat support methods out of NovaObject,
to a new class NovaObjectDictCompat. All existing objects are
updated to add this new class as a mix-in parent.

In future any completely new objects (ie ones which aren't being
used to converted existing code from dict instances) should avoid
inheriting from NovaObjectDictCompat. Existing objects should
also have this parent class removed once all callers are audited
and/or updated to ensure they do not require dict compat.

Change-Id: I03f93f0c40df6f5f7df9cefe28dff900c22294c9
objects: stop conductor manager using dict field access on objects

The conductor manager 'object_action' method was accessing object
fields using dict syntax instead of attribute syntax. This meant
that every single object would always have to support dict compat
mode.

Change-Id: I7431b5d8e889eebacfef9179c9dceab54ac286ca
objects: remove dict compat support from all XXXList() objects

The XXXList() classes only ever have a single 'objects' attribute
and this is never directly accessed as a dict key, instead all
callers use it in list context. Thus the dict compat support can
be removed from all these objects

Change-Id: I3f8d49d25b99dd0a498dfaad705c6332908cb72f
Fix spelling error in compute api

Change-Id: Ie6b2d998dea6c5b9c7d3eee9c1c01f9169679451
Use oslo db concurrency to generate nova.conf.sample

Make sure we include database and concurrency options in the
sample config file.

Change-Id: I66e68ec120cba2cee86e36aa26720199876c40a4
Closes-Bug: #1391782
Reject non existent mock assert calls

assert_called and assert_not_called are not asserting the state
of the mock object but considered as mocked calls so mock
will never raise exception but always executed successfully

This change patches the Mock class during unit test
to raise an exception if a function called on a mock object
that's name starts with 'assert' and does not one
of the supported Mock assert calls.

This change also fix the unit test to call only the supported
assert function on mock object.

This change also removes hacking rule N327 as the mock change
renders this hacking rule obsolete.

Change-Id: Id75def84bd4bdc1c1fb06221b4223322a99251eb
libvirt: move setting of clock out into helper method

Move clock settings will be added in the future, so it
makes sense to have a separate helper method for all
of them.

Related-bug: #1400315
Change-Id: I1662e2d1e2e729da873c14a0cc307e412c699320
libvirt: disk_bus setting is being lost when migration is reverted

finish_revert_migration() should use image_meta, if it exist,
when constructing the disk_info.

Closes-Bug: #1389850
Change-Id: Ia373771eaaad4154a2aa0695bf3878713a68dd9f
Adds support for versioned schema validation for microversions api

Adds the ability to specify minimum and maximum API microversion
versions on jsonschema validation decorators. Validation will
only occur through the decorator if the incoming request version
matches the version range specified. If no range is specified then
validation will always occur.

Partially implements blueprint api-microversions

Change-Id: Ia71963161966af3ca0e6e30e2245f12120f8f8d1
Imported Translations from Transifex

For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: Ie30bed8cad51c384e7539dbe9fc945d5aed3ada6
Fix set_vm_state_and_notify passing SQLA objects to send_update()

Similar to the fix in https://review.openstack.org/137194, with the
recent changes to notifications this must now pass an instance object.

Change-Id: I37431dd14165883d9a4f81c3892bd6c3a94da86d
Related-Bug: #1396324
Replace use of handle_schedule_error() with set_vm_state_and_notify()

Conductor task build_instances() currently uses error handling code in
scheduler driver to set instance error state and issue notifications.
There is a similar method in scheduler utils that does the exact same,
which a prior change converted to correctly send instance objects to
notifications send_update().

This in additon has the added benefit of decoupling conductor from
scheduler driver internals.

Change-Id: Iad9ecf99734fb4c200ba046da42128299a1162f2
Related-Bug: #1396324
hardware: add method to return requested memory page size

Introduces method to return requested memory pages size.
This commit also add a new exceptions MemoryPageSizeInvalid and
MemoryPageSizeForbidden

Work-Item: Enhance libvirt driver to configure guests based on
           the flavour parameter for page sizes

Partial-Implement: blueprint virt-driver-large-pages
Change-Id: I94e63159ee5539ed7b947614ff0ec87182f184a4
hardware: make get_constraints to return topology for hugepages

Whether a numa node is defined or not, if using hugepages we
should create an numa instance topology.

Work-Item: Enhance libvirt driver to report available
           large pages per NUMA node in the host state data

Partial-Implement: blueprint virt-driver-large-pages
Change-Id: I23e0ca58bd8c6a16bff5d36c5d108056e4135351