Skip to content

Commit

Permalink
Merge pull request #1025 from FernandoOjeda/fo_create_dedicated_host_…
Browse files Browse the repository at this point in the history
…with_gpu

create dedicated host with gpu
  • Loading branch information
allmightyspiff committed Aug 29, 2018
2 parents 1765af9 + ac9e28e commit d28da2d
Show file tree
Hide file tree
Showing 4 changed files with 308 additions and 84 deletions.
107 changes: 106 additions & 1 deletion SoftLayer/fixtures/SoftLayer_Product_Package.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@
]
}


SAAS_REST_PACKAGE = {
'categories': [
{'categoryCode': 'storage_as_a_service'}
Expand Down Expand Up @@ -1133,12 +1132,14 @@
"bundleItems": [
{
"capacity": "1200",
"keyName": "1_4_TB_LOCAL_STORAGE_DEDICATED_HOST_CAPACITY",
"categories": [{
"categoryCode": "dedicated_host_disk"
}]
},
{
"capacity": "242",
"keyName": "242_GB_RAM",
"categories": [{
"categoryCode": "dedicated_host_ram"
}]
Expand Down Expand Up @@ -1218,6 +1219,110 @@
"description": "Dedicated Host"
}]

getAllObjectsDHGpu = [{
"subDescription": "Dedicated Host",
"name": "Dedicated Host",
"items": [{
"capacity": "56",
"description": "56 Cores x 360 RAM x 1.2 TB x 2 GPU P100 [encryption enabled]",
"bundleItems": [
{
"capacity": "1200",
"keyName": "1.2 TB Local Storage (Dedicated Host Capacity)",
"categories": [{
"categoryCode": "dedicated_host_disk"
}]
},
{
"capacity": "242",
"keyName": "2_GPU_P100_DEDICATED",
"hardwareGenericComponentModel": {
"capacity": "16",
"id": 849,
"hardwareComponentType": {
"id": 20,
"keyName": "GPU"
}
},
"categories": [{
"categoryCode": "dedicated_host_ram"
}]
}
],
"prices": [
{
"itemId": 10195,
"setupFee": "0",
"recurringFee": "2099",
"tierMinimumThreshold": "",
"hourlyRecurringFee": "3.164",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 200269,
"sort": 0,
"onSaleFlag": "",
"laborFee": "0",
"locationGroupId": "",
"quantity": ""
},
{
"itemId": 10195,
"setupFee": "0",
"recurringFee": "2161.97",
"tierMinimumThreshold": "",
"hourlyRecurringFee": "3.258",
"oneTimeFee": "0",
"currentPriceFlag": "",
"id": 200271,
"sort": 0,
"onSaleFlag": "",
"laborFee": "0",
"locationGroupId": 503,
"quantity": ""
}
],
"keyName": "56_CORES_X_484_RAM_X_1_5_TB_X_2_GPU_P100",
"id": 10195,
"itemCategory": {
"categoryCode": "dedicated_virtual_hosts"
}
}],
"keyName": "DEDICATED_HOST",
"unitSize": "",
"regions": [{
"location": {
"locationPackageDetails": [{
"isAvailable": 1,
"locationId": 138124,
"packageId": 813
}],
"location": {
"statusId": 2,
"priceGroups": [{
"locationGroupTypeId": 82,
"description": "CDN - North America - Akamai",
"locationGroupType": {
"name": "PRICING"
},
"securityLevelId": "",
"id": 1463,
"name": "NORTH-AMERICA-AKAMAI"
}],
"id": 138124,
"name": "dal05",
"longName": "Dallas 5"
}
},
"keyname": "DALLAS05",
"description": "DAL05 - Dallas",
"sortOrder": 12
}],
"firstOrderStepId": "",
"id": 813,
"isActive": 1,
"description": "Dedicated Host"
}]

getRegions = [{
"description": "WDC07 - Washington, DC",
"keyname": "WASHINGTON07",
Expand Down
43 changes: 36 additions & 7 deletions SoftLayer/managers/dedicated_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ def _get_package(self):
capacity,
keyName,
itemCategory[categoryCode],
bundleItems[capacity, categories[categoryCode]]
bundleItems[capacity,keyName,categories[categoryCode],hardwareGenericComponentModel[id,
hardwareComponentType[keyName]]]
],
regions[location[location[priceGroups]]]
'''
Expand Down Expand Up @@ -317,18 +318,46 @@ def _get_backend_router(self, locations, item):
if category['categoryCode'] == 'dedicated_host_disk':
disk_capacity = capacity['capacity']

for hardwareComponent in item['bundleItems']:
if hardwareComponent['keyName'].find("GPU") != -1:
hardwareComponentType = hardwareComponent['hardwareGenericComponentModel']['hardwareComponentType']
gpuComponents = [
{
'hardwareComponentModel': {
'hardwareGenericComponentModel': {
'id': hardwareComponent['hardwareGenericComponentModel']['id'],
'hardwareComponentType': {
'keyName': hardwareComponentType['keyName']
}
}
}
},
{
'hardwareComponentModel': {
'hardwareGenericComponentModel': {
'id': hardwareComponent['hardwareGenericComponentModel']['id'],
'hardwareComponentType': {
'keyName': hardwareComponentType['keyName']
}
}
}
}
]

if locations is not None:
for location in locations:
if location['locationId'] is not None:
loc_id = location['locationId']
host = {
'cpuCount': cpu_count,
'memoryCapacity': mem_capacity,
'diskCapacity': disk_capacity,
'datacenter': {
'id': loc_id
'cpuCount': cpu_count,
'memoryCapacity': mem_capacity,
'diskCapacity': disk_capacity,
'datacenter': {
'id': loc_id
}
}
}
if item['keyName'].find("GPU") != -1:
host['pciDevices'] = gpuComponents
routers = self.host.getAvailableRouters(host, mask=mask)
return routers

Expand Down

0 comments on commit d28da2d

Please sign in to comment.