Merge "Fill "driver_name" field in Deployable object"
This commit is contained in:
commit
a80d07d850
@ -55,6 +55,8 @@ RESOURCES = {
|
|||||||
"fpga": RC_FPGA
|
"fpga": RC_FPGA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DRIVER_NAME = "intel"
|
||||||
|
|
||||||
|
|
||||||
def read_line(filename):
|
def read_line(filename):
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
@ -268,6 +270,7 @@ def _generate_dep_list(fpga, pf_has_vf):
|
|||||||
driver_dep.attach_handle_list = \
|
driver_dep.attach_handle_list = \
|
||||||
[_generate_attach_handle(fpga)]
|
[_generate_attach_handle(fpga)]
|
||||||
driver_dep.name = fpga["name"]
|
driver_dep.name = fpga["name"]
|
||||||
|
driver_dep.driver_name = DRIVER_NAME
|
||||||
# pf with sriov enabled, may have several regions and several vfs.
|
# pf with sriov enabled, may have several regions and several vfs.
|
||||||
# For now, there is only region, this maybe improve in next release.
|
# For now, there is only region, this maybe improve in next release.
|
||||||
else:
|
else:
|
||||||
@ -277,6 +280,7 @@ def _generate_dep_list(fpga, pf_has_vf):
|
|||||||
driver_dep.attach_handle_list.append(
|
driver_dep.attach_handle_list.append(
|
||||||
_generate_attach_handle(vf))
|
_generate_attach_handle(vf))
|
||||||
driver_dep.name = vf["name"]
|
driver_dep.name = vf["name"]
|
||||||
|
driver_dep.driver_name = DRIVER_NAME
|
||||||
return [driver_dep]
|
return [driver_dep]
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +44,10 @@ class Deployable(base.CyborgObject, object_base.VersionedObjectDictCompat):
|
|||||||
# name of the deployable
|
# name of the deployable
|
||||||
'num_accelerators': object_fields.IntegerField(nullable=False),
|
'num_accelerators': object_fields.IntegerField(nullable=False),
|
||||||
# number of accelerators spawned by this deployable
|
# number of accelerators spawned by this deployable
|
||||||
'device_id': object_fields.IntegerField(nullable=False)
|
'device_id': object_fields.IntegerField(nullable=False),
|
||||||
# Foreign key constrain to reference device table
|
# Foreign key constrain to reference device table
|
||||||
|
'driver_name': object_fields.StringField(nullable=True)
|
||||||
|
# Will change it to non-nullable after other driver report it.
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_parent_root_id(self, context):
|
def _get_parent_root_id(self, context):
|
||||||
|
@ -37,7 +37,8 @@ class DriverDeployable(base.DriverObjectBase,
|
|||||||
# TODO: add field related to local_memory or just store in the
|
# TODO: add field related to local_memory or just store in the
|
||||||
# attribute list?
|
# attribute list?
|
||||||
'attach_handle_list': object_fields.ListOfObjectsField(
|
'attach_handle_list': object_fields.ListOfObjectsField(
|
||||||
'DriverAttachHandle', default=[], nullable=True)
|
'DriverAttachHandle', default=[], nullable=True),
|
||||||
|
'driver_name': object_fields.StringField(nullable=True)
|
||||||
}
|
}
|
||||||
|
|
||||||
def create(self, context, device_id, cpid_id):
|
def create(self, context, device_id, cpid_id):
|
||||||
@ -49,7 +50,8 @@ class DriverDeployable(base.DriverObjectBase,
|
|||||||
deployable_obj = Deployable(context=context,
|
deployable_obj = Deployable(context=context,
|
||||||
name=self.name,
|
name=self.name,
|
||||||
num_accelerators=self.num_accelerators,
|
num_accelerators=self.num_accelerators,
|
||||||
device_id=device_id
|
device_id=device_id,
|
||||||
|
driver_name=self.driver_name
|
||||||
)
|
)
|
||||||
deployable_obj.create(context)
|
deployable_obj.create(context)
|
||||||
# create attribute_list for this deployable
|
# create attribute_list for this deployable
|
||||||
|
@ -30,7 +30,8 @@ def fake_db_deployable(**updates):
|
|||||||
'parent_id': None,
|
'parent_id': None,
|
||||||
'root_id': 1,
|
'root_id': 1,
|
||||||
'num_accelerators': 4,
|
'num_accelerators': 4,
|
||||||
'device_id': 0
|
'device_id': 0,
|
||||||
|
'driver_name': "fake-driver-name"
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, field in objects.Deployable.fields.items():
|
for name, field in objects.Deployable.fields.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user