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
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
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"