Use the full string for localisation

Concatenating localized strings is bound to be confusing.
Give the full string so that translations can be tuned accordingly.

Change-Id: I84a5fa2939c02add5468c4ab4b6f2c4ea1a5f8f0
Abstract add_timestamp out of ComputeDriverCPUMonitor class

Move add_timestamp decorator into ResourceMonitorBase class,
then other monitor metrics can reuse it.

Change-Id: I060353b9e194b1882549fec07fc2a486aeb1fce0
replace type() to isinstance() in nova

In nova/utils.py, a func use the "type" method to
determine the type. It's bertter to use the "isinstance"
method instead.this bug is fixed in glance:
https://review.openstack.org/#/c/65611/4

Change-Id: I10d25d2308436239c50cf3932c212e22c45f92a8
Closes-Bug: #1267300
XenAPI: Use direct IO for writing config drive

If you don't use direct IO when writing to the device, the unplug
immediately following this may not succeed as the device may still
be in use.

Also add a sync to ensure the device is not being used at the point
of unplug.

Closes-bug: 1259163

Change-Id: I68f09835648b36772a7839af9718123a4c60734f
Fix potential fd leak

Always close the test socket.

Change-Id: Ic87b713a7791cf39ed5146754e1345fc662c894e
Capture exception for JSON load in virt.storage_users

If CONF.instances_path/compute_nodes is empty when the storage_users
tries to register the storage use (virt.storage_users.register_storage_use)
the exception is uncaught and raised. As a consequence, the image cache
manager won't run.

Closes-Bug: #1252659

Change-Id: If9ed5e75b0bc0b8f3a7c5fd7ec88f6399e4e59c6
Error message is malformed when removing a sec group from an instance

In the current code the Error message string for a security group which is not
associated with an instance does not get expanded correctly, resulting in users
getting a message:

ERROR: [u'Security group %(security_group_name)s not assocaited with the
instance %(instance)s', {u'instance': u'71069945-5bea-4d53-b6ab-9026bfeebba4',
u'security_group_name': u'phil'}]

In addition fix a minor typo in this message, and clean up a few cases where
error messages are not being passed through _() for i18n.

Change-Id: I85856a135a62bc3415a355e0900ea12ea55f73ae
Closes-Bug: #1273266
Sync latest gettextutils from oslo-incubator

The translation message improvements are the main addition of
interested because they are required to support lazy message
evaluation.

Commits included:

  afdbc0ac5 Fix E501 in individual openstack projects
  6b2d15fe6 Merge "Add support for locales missing from babel"
  9d529dd32 Make Message keep string interpolation args
  ec6d90019 Add support for locales missing from babel
  221c37d44 Allow the Message class to have non-English default locales
  0e1af5bed Implementation of translation log handler
  f5686b19d Merge "Translation Message improvements"
  8b2b0b743 Use hacking import_exceptions for gettextutils._
  2cfc1a78d Translation Message improvements
  45658e2f3 Fix violations of H302:import only modules

Note that the following touched other files, but the changes were
independent and did not require inclusion of additional files:

  8b2b0b743 Use hacking import_exceptions for gettextutils._
  45658e2f3 Fix violations of H302:import only modules

Partially implements blueprint i18n-messages

Change-Id: I3ac748d0cf73d841330675e8eb02a5bb1bbc9f1e
Disable file injection in baremetal by default

DocImpact: This disables file injection by default for baremetal. File
injection has never been very useful for baremetal given the much
wider set of device configurations vs virtual, so it's unlikely anyone
was using this (it cannot be used in a heterogeneous OS image
environment, for instance). We should still document the change
though.

UpgradeImpact

blueprint disable-file-injection-by-default

Change-Id: I60a108ef1f0e46ad4da94d2a730426e255011476
Co-Authored-By: Steve Kowalik <steven@wedontsleep.org>
Fix migrations changing the type of deleted column

SQLite doesn't provide a native implementation of BOOLEAN data type.
SQLAlchemy emulates BOOLEAN data type for SQLite using INT column +
CHECK constraint.
We have a few migrations changing the type of column 'deleted' from
BOOLEAN to INT. Due to limitations of ALTER in SQLite, in order to do
that, we omit the original 'deleted' column as well as the corresponding
CHECK constraint when recreating the table. Omitting of the constraint
is more tricky. It's implemented by analyzing the SQL text used for its
rendering. SQLAlchemy versions 0.8.3+ slightly changed the way
constraints are rendered, so we have to update our migrations changing
the type of 'deleted' column to work with SQLAlchemy 0.8.3+ on SQLite
backend (we aren't using SQLite in production, but we still need it for
running of unit tests).

Closes-Bug: #1252693
Change-Id: I52f2b5f90a2f9191767fadc7b1eacae236c30e98
Merge "Fix migrations changing the type of deleted column"
Merge "XenAPI: Use direct IO for writing config drive"
Merge "Abstract add_timestamp out of ComputeDriverCPUMonitor class"
Merge "Use the full string for localisation"
Merge "Error message is malformed when removing a sec group from an instance"
Merge "replace type() to isinstance() in nova"
Merge "Capture exception for JSON load in virt.storage_users"
Merge "Disable file injection in baremetal by default"
Merge "Fix potential fd leak"
Merge "Sync latest gettextutils from oslo-incubator"