Bug fix: Change object definition according to the newest DB.
Controlpath should associate with device, not the deployable. AttachHandle should associate with cpid_id, and should have "in_use" field. Change-Id: I0ce29bfb0a1e89971d680aba6bd2a63d339fe88d
This commit is contained in:
parent
e6028de00f
commit
a6590b2664
|
@ -175,7 +175,7 @@ class Connection(api.Connection):
|
|||
query_prefix = model_query(context, models.AttachHandle)
|
||||
filters = copy.deepcopy(filters)
|
||||
|
||||
exact_match_filter_names = ['uuid', 'id', 'deployable_id']
|
||||
exact_match_filter_names = ['uuid', 'id', 'deployable_id', 'cpid_id']
|
||||
|
||||
# Filter the query
|
||||
query_prefix = self._exact_filter(models.AttachHandle, query_prefix,
|
||||
|
@ -293,7 +293,7 @@ class Connection(api.Connection):
|
|||
query_prefix = model_query(context, models.AttachHandle)
|
||||
filters = copy.deepcopy(filters)
|
||||
|
||||
exact_match_filter_names = ['uuid', 'id', 'deployable_id']
|
||||
exact_match_filter_names = ['uuid', 'id', 'device_id']
|
||||
|
||||
# Filter the query
|
||||
query_prefix = self._exact_filter(models.ControlpathID, query_prefix,
|
||||
|
|
|
@ -36,14 +36,17 @@ class AttachHandle(base.CyborgObject, object_base.VersionedObjectDictCompat):
|
|||
'id': object_fields.IntegerField(nullable=False),
|
||||
'uuid': object_fields.UUIDField(nullable=False),
|
||||
'deployable_id': object_fields.IntegerField(nullable=False),
|
||||
'cpid_id': object_fields.IntegerField(nullable=False),
|
||||
'attach_type': object_fields.EnumField(valid_values=ATTACH_TYPE,
|
||||
nullable=False),
|
||||
# attach_info should be JSON here.
|
||||
'attach_info': object_fields.StringField(nullable=False)
|
||||
'attach_info': object_fields.StringField(nullable=False),
|
||||
'in_use': object_fields.BooleanField(nullable=False)
|
||||
}
|
||||
|
||||
def create(self, context):
|
||||
"""Create a AttachHandle record in the DB."""
|
||||
self.in_use = False
|
||||
values = self.obj_get_changes()
|
||||
db_ah = self.dbapi.attach_handle_create(context, values)
|
||||
self._from_db_object(self, db_ah)
|
||||
|
|
|
@ -35,7 +35,7 @@ class ControlpathID(base.CyborgObject, object_base.VersionedObjectDictCompat):
|
|||
fields = {
|
||||
'id': object_fields.IntegerField(nullable=False),
|
||||
'uuid': object_fields.UUIDField(nullable=False),
|
||||
'deployable_id': object_fields.IntegerField(nullable=False),
|
||||
'device_id': object_fields.IntegerField(nullable=False),
|
||||
'cpid_type': object_fields.EnumField(valid_values=CPID_TYPE,
|
||||
nullable=False),
|
||||
'cpid_info': object_fields.StringField(nullable=False)
|
||||
|
|
|
@ -87,6 +87,8 @@ def get_test_attach_handle(**kw):
|
|||
'uuid': kw.get('uuid', '10efe63d-dfea-4a37-ad94-4116fba5098'),
|
||||
'id': kw.get('id', 1),
|
||||
'deployable_id': kw.get('deployable_id', 1),
|
||||
'cpid_id': kw.get('cpid_id', 1),
|
||||
'in_use': kw.get('in_use', False),
|
||||
'attach_type': kw.get('attach_type', "PCI"),
|
||||
'attach_info': kw.get('attach_info', "attach_info"),
|
||||
'created_at': kw.get('create_at', None),
|
||||
|
@ -98,7 +100,7 @@ def get_test_control_path(**kw):
|
|||
return {
|
||||
'uuid': kw.get('uuid', '10efe63d-dfea-4a37-ad94-4116fba5098'),
|
||||
'id': kw.get('id', 1),
|
||||
'deployable_id': kw.get('deployable_id', 1),
|
||||
'device_id': kw.get('device_id', 1),
|
||||
'cpid_type': kw.get('cpid_type', "PCI"),
|
||||
'cpid_info': kw.get('cpid_info', "cpid_info"),
|
||||
'created_at': kw.get('create_at', None),
|
||||
|
|
Loading…
Reference in New Issue