HewlettPackard / oneview-sdk-ruby

This project is no longer being developed and has limited support. In the near future this repository will be fully deprecated. Please consider using other OneView projects, such as Golang and Python.
Apache License 2.0
12 stars 16 forks source link

400 BAD REQUEST by server_profile_template creation #375

Closed riconem closed 5 years ago

riconem commented 5 years ago

Scenario/Intent

I was trying to create a new server profile template with the following data: Local Storage->Integrated storage controller: Mode=RAID Add Logical Drive: Name=OS, RAID level=RAID1, Drive technology=SAS HDD, Boot=Checked

Environment Details

Steps to Reproduce

Create a new server profile template with these attributes: bootMode={manageMode: true, mode: "BIOS"} logicalDrives=[{bootable: true, name: "Operating System", numPhysicalDrives: 2, raidLevel: "RAID1"}] localStorage={controllers: [{deviceSlot: "Embedded", logicalDrives: logicalDrives, mode: "RAID"}]} server_profile_template_name = 'OneViewSDK Test ServerProfileTemplate'

item = OneviewSDK::Synergy::ServerProfileTemplate.new( @client, {name: server_profile_template_name, bootMode: bootMode, localStorage: localStorage})

Expected Result

Creates a server profile template

Actual Result

/opt/oneview/hewlettPackard/oneview-sdk-ruby/lib/oneview-sdk/exceptions.rb:28:in raise!': 400 BAD REQUEST {"errorCode":"UNEXPECTED_EXCEPTION","message":"An unexpected error occurred.","details":"An unexpected and unhandled runtime exception occurred.","recommendedActions":["Please contact your authorized support representative and provide them with a support dump."],"errorSource":null,"nestedErrors":[],"data":{}} (OneviewSDK::BadRequest) from /opt/oneview/hewlettPackard/oneview-sdk-ruby/lib/oneview-sdk/rest.rb:230:inresponse_handler' from /opt/oneview/hewlettPackard/oneview-sdk-ruby/lib/oneview-sdk/resource.rb:176:in create' from server_profile_template_2.rb:30:in

'

soodpr commented 5 years ago

@riconem - I can see the OneView API version used here is 1000. Please note we are not currently supporting API 1000.
But I am not sure why you are not hitting this exception instead you are getting 400 BadRequest which is weird. Can you try to run your code against API800/600.

riconem commented 5 years ago

@soodpr Sorry you are right API 1000 is not supported now. I have tested it on API 300/600 and 800.

soodpr commented 5 years ago

@riconem - Then clearly you are missing some attributes here. Can you please check if you are adding all required attributes as per OneView REST API 300/600 and 800 spec.

riconem commented 5 years ago

Thank you! I saw my mistake right now. I missed some value. Now its working fine!

logicalDrives=[{"name": "Operating System", raidLevel: "RAID1", "bootable": true, "numPhysicalDrives": 2, "driveTechnology": "SasHdd"}] localStorage={"controllers": [{"deviceSlot": "Embedded", "mode":"RAID", "initialize": true, "logicalDrives": logicalDrives}]}