-
Notifications
You must be signed in to change notification settings - Fork 194
create dedicated host with gpu #1025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create dedicated host with gpu #1025
Conversation
disk_capacity = capacity['capacity'] | ||
|
||
for hardwareComponent in item['bundleItems']: | ||
if hardwareComponent['keyName'].find("GPU") != -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of creating 4 variables, it would makes sense to do something like this:
gpuComponent = {
'hardwareComponentModel': {
'hardwareGenericComponentModel': {
'id': hardwareGenericComponentModelId,
'hardwareComponentType': {
'keyName': hardwareComponentTypeKeyName
}
}
}
},
{
'hardwareComponentModel': {
'hardwareGenericComponentModel': {
'id': hardwareGenericComponentModelId,
'hardwareComponentType': {
'keyName': hardwareComponentTypeKeyName
}
}
}
}
Then just use gpuComponent
further down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
SoftLayer/managers/dedicated_host.py
Outdated
'datacenter': { | ||
'id': loc_id | ||
if item['keyName'].find("GPU") == -1: | ||
host = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set host
outside of the if
statement since it always need to be set, and is the same for GPU/NO-GPU
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
SoftLayer/managers/dedicated_host.py
Outdated
'id': loc_id | ||
} | ||
} | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if/else
should instead just be a single if gpuComponent is not None:
and then add the gpuComponent to the already existing host
dictionary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Create dedicated host with gpu #1022.