Merge "Logging Consistency"
This commit is contained in:
commit
0e7d99ac3f
@ -185,7 +185,7 @@ def add_command_parsers(subparsers):
|
||||
parser.add_argument(
|
||||
'-b', '--batch_size', default='20',
|
||||
help=_('Number of stacks to delete at a time (per transaction). '
|
||||
'Note that a single stack may have many db rows '
|
||||
'Note that a single stack may have many DB rows '
|
||||
'(events, etc.) associated with it.'))
|
||||
|
||||
# update_params parser
|
||||
|
@ -46,7 +46,7 @@ class SymmetricCrypto(object):
|
||||
|
||||
Note: This is a reimplementation of the decryption algorithm from
|
||||
oslo-incubator, and is provided for backward compatibility. Once we have a
|
||||
db migration script available to re-encrypt using new encryption method as
|
||||
DB migration script available to re-encrypt using new encryption method as
|
||||
part of upgrade, this can be removed.
|
||||
|
||||
:param enctype: Encryption Cipher name (default: AES)
|
||||
|
@ -340,7 +340,7 @@ def resource_attr_id_set(context, resource_id, atomic_key, attr_id):
|
||||
else:
|
||||
# Someone else set the attr_id first and/or we have a stale
|
||||
# view of the resource based on atomic_key, so delete the
|
||||
# resource_properties_data (attr) db row.
|
||||
# resource_properties_data (attr) DB row.
|
||||
LOG.debug('Not updating res_id %(rid)s with attr_id %(aid)s',
|
||||
{'rid': resource_id, 'aid': attr_id})
|
||||
session.query(
|
||||
@ -974,7 +974,7 @@ def user_creds_get(context, user_creds_id):
|
||||
db_result = context.session.query(models.UserCreds).get(user_creds_id)
|
||||
if db_result is None:
|
||||
return None
|
||||
# Return a dict copy of db results, do not decrypt details into db_result
|
||||
# Return a dict copy of DB results, do not decrypt details into db_result
|
||||
# or it can be committed back to the DB in decrypted form
|
||||
result = dict(db_result)
|
||||
del result['decrypt_method']
|
||||
@ -1808,7 +1808,7 @@ def db_encrypt_parameters_and_properties(ctxt, encryption_key, batch_size=50,
|
||||
:param ctxt: RPC context
|
||||
:param encryption_key: key that will be used for parameter and property
|
||||
encryption
|
||||
:param batch_size: number of templates requested from db in each iteration.
|
||||
:param batch_size: number of templates requested from DB in each iteration.
|
||||
50 means that heat requests 50 templates, encrypt them
|
||||
and proceed with next 50 items.
|
||||
:param verbose: log an INFO message when processing of each raw_template or
|
||||
@ -1832,7 +1832,7 @@ def db_decrypt_parameters_and_properties(ctxt, encryption_key, batch_size=50,
|
||||
:param ctxt: RPC context
|
||||
:param encryption_key: key that will be used for parameter and property
|
||||
decryption
|
||||
:param batch_size: number of templates requested from db in each iteration.
|
||||
:param batch_size: number of templates requested from DB in each iteration.
|
||||
50 means that heat requests 50 templates, encrypt them
|
||||
and proceed with next 50 items.
|
||||
:param verbose: log an INFO message when processing of each raw_template or
|
||||
@ -1853,7 +1853,7 @@ def db_properties_data_migrate(ctxt, batch_size=50):
|
||||
"""Migrate properties data from legacy columns to new location in db.
|
||||
|
||||
:param ctxt: RPC context
|
||||
:param batch_size: number of templates requested from db in each iteration.
|
||||
:param batch_size: number of templates requested from DB in each iteration.
|
||||
50 means that heat requests 50 templates, encrypt them
|
||||
and proceed with next 50 items.
|
||||
"""
|
||||
|
@ -243,7 +243,7 @@ def format_stack(stack, preview=False, resolve_outputs=True):
|
||||
def format_stack_db_object(stack):
|
||||
"""Return a summary representation of the given stack.
|
||||
|
||||
Given a stack versioned db object, return a representation of the given
|
||||
Given a stack versioned DB object, return a representation of the given
|
||||
stack for a stack listing.
|
||||
"""
|
||||
updated_time = heat_timeutils.isotime(stack.updated_at)
|
||||
|
@ -2062,7 +2062,7 @@ class Resource(status.ResourceStatus):
|
||||
try:
|
||||
resource_objects.Resource.delete(self.context, self.id)
|
||||
except exception.NotFound:
|
||||
# Don't fail on delete if the db entry has
|
||||
# Don't fail on delete if the DB entry has
|
||||
# not been created yet.
|
||||
pass
|
||||
|
||||
@ -2077,7 +2077,7 @@ class Resource(status.ResourceStatus):
|
||||
self.id,
|
||||
{'physical_resource_id': self.resource_id})
|
||||
except Exception as ex:
|
||||
LOG.warning('db error %s', ex)
|
||||
LOG.warning('DB error %s', ex)
|
||||
|
||||
def store(self, set_metadata=False, lock=LOCK_NONE):
|
||||
"""Create the resource in the database.
|
||||
|
@ -365,7 +365,7 @@ class Instance(resource.Resource):
|
||||
nic_dict['v4-fixed-ip'] = ip
|
||||
nics.append(nic_dict)
|
||||
|
||||
# create db instance
|
||||
# create DB instance
|
||||
instance = self.client().instances.create(
|
||||
self._dbinstance_name(),
|
||||
self.flavor,
|
||||
|
@ -2277,9 +2277,9 @@ class Stack(collections.Mapping):
|
||||
requires = set(res_id_dep.requires(db_res.id))
|
||||
r = self.resources.get(db_res.name)
|
||||
if r is None:
|
||||
# delete db resources not in current_template_id
|
||||
# delete DB resources not in current_template_id
|
||||
LOG.warning("Resource %(res)s not found in template "
|
||||
"for stack %(st)s, deleting from db.",
|
||||
"for stack %(st)s, deleting from DB.",
|
||||
{'res': db_res.name, 'st': self.id})
|
||||
resource_objects.Resource.delete(self.context, db_res.id)
|
||||
else:
|
||||
|
@ -49,7 +49,7 @@ class TemplateFiles(collections.Mapping):
|
||||
'(value is %(val)s)') %
|
||||
{'cname': files.__class__,
|
||||
'val': str(files)})
|
||||
# the dict has not been persisted as a raw_template_files db obj
|
||||
# the dict has not been persisted as a raw_template_files DB obj
|
||||
# yet, so no self.files_id
|
||||
self.files = ReadOnlyDict(files)
|
||||
|
||||
@ -81,7 +81,7 @@ class TemplateFiles(collections.Mapping):
|
||||
return iter(self.files)
|
||||
|
||||
def _refresh_if_needed(self):
|
||||
# retrieve files from db if needed
|
||||
# retrieve files from DB if needed
|
||||
if self.files_id is None:
|
||||
return
|
||||
if self.files_id in _d:
|
||||
@ -111,13 +111,13 @@ class TemplateFiles(collections.Mapping):
|
||||
|
||||
def update(self, files):
|
||||
# Sets up the next call to store() to create a new
|
||||
# raw_template_files db obj. It seems like we *could* just
|
||||
# raw_template_files DB obj. It seems like we *could* just
|
||||
# update the existing raw_template_files obj, but the problem
|
||||
# with that is other heat-engine processes' _d dictionaries
|
||||
# would have stale data for a given raw_template_files.id with
|
||||
# no way of knowing whether that data should be refreshed or
|
||||
# not. So, just avoid the potential for weird race conditions
|
||||
# and create another db obj in the next store().
|
||||
# and create another DB obj in the next store().
|
||||
if len(files) == 0:
|
||||
return
|
||||
if not isinstance(files, dict):
|
||||
|
@ -51,7 +51,7 @@ class Event(
|
||||
event._resource_properties = None
|
||||
for field in event.fields:
|
||||
if field == 'resource_status_reason':
|
||||
# this works whether db_event is a dict or db ref
|
||||
# this works whether db_event is a dict or DB ref
|
||||
event[field] = db_event['_resource_status_reason']
|
||||
else:
|
||||
event[field] = db_event[field]
|
||||
|
@ -49,7 +49,7 @@ class UserCreds(
|
||||
return db_ucreds
|
||||
ucreds._context = context
|
||||
for field in ucreds.fields:
|
||||
# TODO(Shao HE Feng), now the db layer delete the decrypt_method
|
||||
# TODO(Shao HE Feng), now the DB layer delete the decrypt_method
|
||||
# field, just skip it here. and will add an encrypted_field later.
|
||||
if field == "decrypt_method":
|
||||
continue
|
||||
|
@ -1446,7 +1446,7 @@ def create_raw_template(context, **kwargs):
|
||||
'template': t,
|
||||
}
|
||||
if 'files' not in kwargs and 'files_id' not in kwargs:
|
||||
# modern raw_templates have associated raw_template_files db obj
|
||||
# modern raw_templates have associated raw_template_files DB obj
|
||||
tf = template_files.TemplateFiles({'foo': 'bar'})
|
||||
tf.store(context)
|
||||
kwargs['files_id'] = tf.files_id
|
||||
@ -3194,7 +3194,7 @@ class DBAPIResourceUpdateTest(common.HeatTestCase):
|
||||
self.assertEqual('engine-1', db_res.engine_id)
|
||||
self.assertEqual(1, db_res.atomic_key)
|
||||
# Set engine id as engine-2 and pass expected engine id as old engine
|
||||
# i.e engine-1 in db api steal the lock
|
||||
# i.e engine-1 in DB api steal the lock
|
||||
values = {'engine_id': 'engine-2',
|
||||
'action': 'DELETE',
|
||||
'status': 'IN_PROGRESS'}
|
||||
|
@ -282,7 +282,7 @@ class EventEncryptedTest(EventCommon):
|
||||
self.resource.name, self.resource.type())
|
||||
e.store()
|
||||
|
||||
# verify the resource_properties_data db data is encrypted
|
||||
# verify the resource_properties_data DB data is encrypted
|
||||
e_obj = event_object.Event.get_all_by_stack(self.resource.context,
|
||||
self.stack.id)[0]
|
||||
rpd_id = e_obj['rsrc_prop_data_id']
|
||||
|
@ -991,7 +991,7 @@ class ResourceTest(common.HeatTestCase):
|
||||
res.state_set(res.CREATE, res.IN_PROGRESS, 'test_store')
|
||||
|
||||
# Modernity, the data is where it belongs
|
||||
# The db object data is encrypted
|
||||
# The DB object data is encrypted
|
||||
rsrc_prop_data_db_obj = db_api.resource_prop_data_get(
|
||||
self.stack.context, res._rsrc_prop_data_id)
|
||||
self.assertNotEqual(rsrc_prop_data_db_obj['data'], {'Foo': 'lucky'})
|
||||
@ -1970,7 +1970,7 @@ class ResourceTest(common.HeatTestCase):
|
||||
'prop4': ['a', 'list'],
|
||||
'prop5': True}
|
||||
|
||||
# The db data should be encrypted when _store() is called
|
||||
# The DB data should be encrypted when _store() is called
|
||||
res = generic_rsrc.GenericResource('test_res_enc', tmpl, self.stack)
|
||||
res._stored_properties_data = stored_properties_data
|
||||
res._rsrc_prop_data = None
|
||||
@ -1979,7 +1979,7 @@ class ResourceTest(common.HeatTestCase):
|
||||
self.assertNotEqual('string',
|
||||
db_res.rsrc_prop_data.data['prop1'])
|
||||
|
||||
# The db data should be encrypted when state_set is called
|
||||
# The DB data should be encrypted when state_set is called
|
||||
res = generic_rsrc.GenericResource('test_res_enc', tmpl, self.stack)
|
||||
res._stored_properties_data = stored_properties_data
|
||||
res.state_set(res.CREATE, res.IN_PROGRESS, 'test_store')
|
||||
@ -2015,7 +2015,7 @@ class ResourceTest(common.HeatTestCase):
|
||||
'prop4': ['a', 'list'],
|
||||
'prop5': True}
|
||||
|
||||
# The db data should not be encrypted when state_set()
|
||||
# The DB data should not be encrypted when state_set()
|
||||
# is called
|
||||
res = generic_rsrc.GenericResource('test_res_enc', tmpl, self.stack)
|
||||
res._stored_properties_data = stored_properties_data
|
||||
@ -2024,7 +2024,7 @@ class ResourceTest(common.HeatTestCase):
|
||||
db_res = db_api.resource_get(res.context, res.id)
|
||||
self.assertEqual('string', db_res.rsrc_prop_data.data['prop1'])
|
||||
|
||||
# The db data should not be encrypted when _store() is called
|
||||
# The DB data should not be encrypted when _store() is called
|
||||
res = generic_rsrc.GenericResource('test_res_enc', tmpl, self.stack)
|
||||
res._stored_properties_data = stored_properties_data
|
||||
db_res = db_api.resource_get(res.context, res.id)
|
||||
|
@ -301,7 +301,7 @@ class StackTest(common.HeatTestCase):
|
||||
|
||||
all_resources = list(self.stack.iter_resources())
|
||||
|
||||
# Verify, the db query is called with expected filter
|
||||
# Verify, the DB query is called with expected filter
|
||||
mock_db_call.assert_called_once_with(self.ctx, self.stack.id)
|
||||
|
||||
# And returns the resources
|
||||
@ -367,7 +367,7 @@ class StackTest(common.HeatTestCase):
|
||||
filters=dict(name=['A'])
|
||||
))
|
||||
|
||||
# Verify, the db query is called with expected filter
|
||||
# Verify, the DB query is called with expected filter
|
||||
mock_db_call.assert_has_calls([
|
||||
mock.call(self.ctx, self.stack.id, dict(name=['A'])),
|
||||
mock.call(self.ctx, self.stack.id),
|
||||
@ -438,7 +438,7 @@ class StackTest(common.HeatTestCase):
|
||||
filters=dict(name=['A'])
|
||||
))
|
||||
|
||||
# Verify, the db query is called with expected filter
|
||||
# Verify, the DB query is called with expected filter
|
||||
mock_db_call.assert_has_calls([
|
||||
mock.call(self.ctx, self.stack.id, dict(name=['A'])),
|
||||
mock.call(self.ctx, self.stack.id),
|
||||
|
Loading…
Reference in New Issue
Block a user