summaryrefslogtreecommitdiff
path: root/trove/conductor
diff options
context:
space:
mode:
authorZhao Chao <zhaochao1984@gmail.com>2018-02-07 15:37:30 +0800
committerZhao Chao <zhaochao1984@gmail.com>2018-02-07 17:05:54 +0800
commit3b726f3013b0ba2a9f86b5b65278fadb981335cf (patch)
treed473f5fef94c8e614ff951033eaac3173257783a /trove/conductor
parentcdc7b37cae31e8e0206ff67eea7a3e5f3e26ae7b (diff)
downloadtrove-3b726f3013b0ba2a9f86b5b65278fadb981335cf.tar.gz
report_root should always use context.user
The RootHistory intends to record by whom and when the root user of the underlying datastore backend was enabled. So the "user" column should always be set to the context user, not the actual root user in the database. But report_root(and report_root_enabled in taskmanager.models) use the database user instead, this is not correct, This patch will fix. Also remove the "user" argument from Root.create() and HistoryRoot.create() because the context is already passed in as an argument when these methods are called. Closes-Bug: #1546372 Change-Id: I3b4c8ee56c7e0876fb384f0c5841d2d391bd555d Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
Diffstat (limited to 'trove/conductor')
-rw-r--r--trove/conductor/api.py5
-rw-r--r--trove/conductor/manager.py9
2 files changed, 9 insertions, 5 deletions
diff --git a/trove/conductor/api.py b/trove/conductor/api.py
index 57d76d91..3249bbab 100644
--- a/trove/conductor/api.py
+++ b/trove/conductor/api.py
@@ -92,14 +92,13 @@ class API(object):
sent=sent,
**backup_fields)
- def report_root(self, instance_id, user):
+ def report_root(self, instance_id):
LOG.debug("Making async call to cast report_root for instance: %s",
instance_id)
version = self.API_BASE_VERSION
cctxt = self.client.prepare(version=version)
cctxt.cast(self.context, "report_root",
- instance_id=instance_id,
- user=user)
+ instance_id=instance_id)
def notify_end(self, **notification_args):
LOG.debug("Making async call to cast end notification")
diff --git a/trove/conductor/manager.py b/trove/conductor/manager.py
index 3674a0ad..a09d485f 100644
--- a/trove/conductor/manager.py
+++ b/trove/conductor/manager.py
@@ -135,8 +135,13 @@ class Manager(periodic_task.PeriodicTasks):
setattr(backup, k, v)
backup.save()
- def report_root(self, context, instance_id, user):
- mysql_models.RootHistory.create(context, instance_id, user)
+ # NOTE(zhaochao): the 'user' argument is left here to keep
+ # compatible with existing instances.
+ def report_root(self, context, instance_id, user=None):
+ if user is not None:
+ LOG.debug("calling report_root with a username: %s, "
+ "is deprecated now!" % user)
+ mysql_models.RootHistory.create(context, instance_id)
def notify_end(self, context, serialized_notification, notification_args):
notification = SerializableNotification.deserialize(