Example #1
0
 def get_by_name(cls, context, name):
     """Form driver-side Deployable object list from DB for one device."""
     # get deployable_obj_list for one device_id
     dep_obj = Deployable.get_by_name(context, name)
     driver_ah_obj_list = DriverAttachHandle.list(context, dep_obj.id)
     # get driver_attr_obj_list fro this dep_obj
     driver_attr_obj_list = DriverAttribute.list(context, dep_obj.id)
     driver_dep_obj = cls(context=context, name=dep_obj.name,
                          num_accelerators=dep_obj.num_accelerators,
                          attribute_list=driver_attr_obj_list,
                          attach_handle_list=driver_ah_obj_list)
     return driver_dep_obj
Example #2
0
 def get_placement_needed_info_and_report(self, context, obj,
                                          parent_uuid=None):
     pr_name = obj.name
     attrs = obj.attribute_list
     resource_class = [i.value for i in attrs if i.key == 'rc'][0]
     traits = [i.value for i in attrs
               if six.ensure_str(i.key).startswith("trait")]
     total = obj.num_accelerators
     rp_uuid = self.provider_report(context, pr_name, resource_class,
                                    traits, total, parent_uuid)
     dep_obj = Deployable.get_by_name(context, pr_name)
     dep_obj["rp_uuid"] = rp_uuid
     dep_obj.save(context)