arqs.py (openstack-cyborg-8.0.0) | : | arqs.py (openstack-cyborg-9.0.0) | ||
---|---|---|---|---|
skipping to change at line 135 | skipping to change at line 135 | |||
resource='Device Profile', | resource='Device Profile', | |||
msg='with name=%s' % dp_name) | msg='with name=%s' % dp_name) | |||
except Exception as e: | except Exception as e: | |||
raise e | raise e | |||
else: | else: | |||
raise exception.DeviceProfileNameNeeded() | raise exception.DeviceProfileNameNeeded() | |||
LOG.info('[arqs] post. device profile name=%s', dp_name) | LOG.info('[arqs] post. device profile name=%s', dp_name) | |||
extarq_list = [] | extarq_list = [] | |||
for group_id, group in enumerate(devprof.groups): | for group_id, group in enumerate(devprof.groups): | |||
accel_resources = [ | accel_resources = [] | |||
int(val) for key, val in group.items() | # If the device profile requires the Xilinx fpga, the number of | |||
if key.startswith('resources')] | # resources should multiply by 2 cause that end user can program | |||
# the device only when both MGMT and USER PF are bound to | ||||
# instance. | ||||
if group.get("trait:CUSTOM_FPGA_XILINX") == "required": | ||||
accel_resources = [int(group.get("resources:FPGA"))] * 2 | ||||
else: | ||||
accel_resources = [ | ||||
int(val) for key, val in group.items() | ||||
if key.startswith('resources')] | ||||
# If/when we introduce non-accelerator resources, like | # If/when we introduce non-accelerator resources, like | |||
# device-local memory, the key search above needs to be | # device-local memory, the key search above needs to be | |||
# made specific to accelerator resources only. | # made specific to accelerator resources only. | |||
num_accels = sum(accel_resources) | num_accels = sum(accel_resources) | |||
arq_fields = { | arq_fields = { | |||
'device_profile_name': devprof.name, | 'device_profile_name': devprof.name, | |||
'device_profile_group_id': group_id, | 'device_profile_group_id': group_id, | |||
} | } | |||
for i in range(num_accels): | for i in range(num_accels): | |||
obj_arq = objects.ARQ(context, **arq_fields) | obj_arq = objects.ARQ(context, **arq_fields) | |||
End of changes. 1 change blocks. | ||||
3 lines changed or deleted | 12 lines changed or added |