summaryrefslogtreecommitdiff
path: root/trove/extensions/common/models.py
diff options
context:
space:
mode:
authorMatt Van Dijk <mvandijk@tesora.com>2015-10-14 14:47:11 -0400
committerMatt Van Dijk <mvandijk@tesora.com>2016-10-12 11:51:57 -0400
commit1c819c3e37e6019464ed59d90bf3d8c83581202d (patch)
treed6bcd6fa89645c24f6dd6d0e35250e789ce7e5e4 /trove/extensions/common/models.py
parentd6fabc850493bd13d647fbf1084fd092836f74ee (diff)
downloadtrove-1c819c3e37e6019464ed59d90bf3d8c83581202d.tar.gz
Improve guestagent datastore models
All validation of requests is currently done against the MySQL datastore models. In order to switch to using datastore extensions for validation the models need to be refactored. The current approach to guestagent/db/models.py is getting unruly and is difficult to apply to other datastores. This change moves the models from the guestagent package to the common package, so that the extensions package can use it in the future. That is: guestagent/db/models.py -> common/db/models.py The generic models are separated from the datastore-specific models. For datastores with custom models the classes have been moved to their own sub-package. Example: common/db/mysql/models.py Using this new approach any datastores that want custom models just need to create packages similar to the common/db/mysql/ package. The code references to these models have all been updated. Non-MySQL based datastores using these references have been switched to using the generic models. The tests for these models have been improved. Change-Id: If321202a3ec4ab0f57ee8e516b885a8307d464b7 Partial-Bug: 1498573
Diffstat (limited to 'trove/extensions/common/models.py')
-rw-r--r--trove/extensions/common/models.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/trove/extensions/common/models.py b/trove/extensions/common/models.py
index 1b1a97e2..71b96f26 100644
--- a/trove/extensions/common/models.py
+++ b/trove/extensions/common/models.py
@@ -15,11 +15,11 @@
from oslo_log import log as logging
+from trove.common.db import models as guest_models
from trove.common import exception
from trove.common.remote import create_guest_client
from trove.common import utils
from trove.db import get_db_api
-from trove.guestagent.db import models as guest_models
from trove.instance import models as base_models
@@ -64,8 +64,9 @@ class Root(object):
else:
root = create_guest_client(context, instance_id).enable_root()
- root_user = guest_models.RootUser()
- root_user.deserialize(root)
+ root_user = guest_models.DatastoreUser.deserialize(root,
+ verify=False)
+ root_user.make_root()
# if cluster_instances_list none, then root create is called for
# single instance, adding an RootHistory entry for the instance_id