Open kmullican opened 7 years ago
This has been resolved by using the following combination of steps:
First, create a new profile from the template, which will be unassigned new_profile = oneview_client.server_profile_templates.get_new_profile(TEMPLATE_URI)
Now update the serverHardwareUri, name, and custom attributes before assigning the new profile to hardware new_profile['serverHardwareUri'] = SRVR_HWARE_URI new_profile['name'] = PROFILE_NAME new_profile['osDeploymentSettings']['osCustomAttributes'] = dict(name='key1',value=VALUE1),dict(name='key2',value=VALUE2),dict(name='key3',value=VALUE3) oneview_client.server_profiles.update(resource=new_profile, id_or_uri=new_profile['uri'])
Create the profile (assign it to hardware) created_profile = oneview_client.server_profiles.create(new_profile)
I'd like to make a suggestion that oneview_client.server_profile_templates.get_new_profile should perhaps be renamed to oneview_client.server_profile_templates.create_new_profile? The verbage "get" is not intuitive since this is actually used to "create" a new profile from a template.
Hello @kmullican , the "get_new_profile" doesn't actually create a new profile.
It is a binding to the GET endpoint /rest/server-profile-templates/{id}/new-profile
on the Server Profile Template.
What this does is actually just return a dictionary which is based on the server profile template
, but ready to be used as base for a server profile
.
In this case, when you run:
new_profile = oneview_client.server_profile_templates.get_new_profile(TEMPLATE_URI)
You have not yet created the Server Profile
in OneView, you've just created a local dictionary containing the info you require to create that profile, and assigned it to the variable new_profile
.
The profile is actually being created when you call:
created_profile = oneview_client.server_profiles.create(new_profile)
Which is using all of the info on the variable new_profile
, both what was retrieved and what you edited, to create a Server Profile on the OneView appliance.
Hope this helps clear things up a bit. :octocat:
@fgbulsoni yes, true, thx. It's a "get in preparation to create", lol. would it be best for me to close this issue since it has been resolved? just wanted to leave some breadcrumbs in the notes in case anyone else would like example of getting the profile defined and created from template.
I'll update the example and try to make this path more clear, as that should help as well.
These breadcrumbs are definitely important and will be searchable for anyone that gets in the repo, so that is great as well. :octocat:
I'd wait for that example file update to close this though.
Scenario/Intent
Provisioning a Synergy profile from template using Python SDK should result in a profile containing the OS Deployment Plan, connections, and local storage that was defined in the template.
Environment Details
Steps to Reproduce
Create a template in OneView containing an OS Deployment Plan, connections, and local storage Provision a profile in Python: oneview_client = OneViewClient.from_json_file('connection.json') new_profile_options = dict( name=PROFILE_NAME, serverProfileTemplateUri=TEMPLATE_URI, serverHardwareUri=SRVR_HWARE_URI ) new_profile = oneview_client.server_profiles.create(new_profile_options)
Expected Result
New profile contains same OS Deployment Plan, connections, and local storage as the template
Actual Result
New profile has OS Deployment Plan set to "None", no connections, and no local storage