Repository navigation
Add support for Ironic baremetal API #1429
Description
Activity
One minor note: The chassis functionality in the OpenStack Baremetal API is essentially unused and could likely be disregarded.
Good job!! I love u guys. haha.
Thanks!Would be nice to throw the newly introduced Conductors and Allocations on the list. On the other hand, as Julia mentioned, Chassis are pretty useless.
Thanks @dtantsur, updated the list to include those. Is Chassis worth including at all for anyone or should I just remove it entirely from the list?
I would make it absolutely lowest priority. Literally the last thing to get done (and only for completeness).
@stbenjam One thing I just noticed is that Ports
created_atandupdated_atare set tostring. They should betime.Time:If you run into JSON decoding issues with the time, then you'll need to implement a custom
UnmarshalJSONmethod. This is quite common because the suite of OpenStack projects use so many different time formats. For example:AttachedAt time.Time `json:"-"` gophercloud/openstack/blockstorage/v3/volumes/results.go
Lines 23 to 38 in 19abc56
func (r *Attachment) UnmarshalJSON(b []byte) error { type tmp Attachment var s struct { tmp AttachedAt gophercloud.JSONRFC3339MilliNoZ `json:"attached_at"` } err := json.Unmarshal(b, &s) if err != nil { return err } *r = Attachment(s.tmp) r.AttachedAt = time.Time(s.AttachedAt) return err } AttachedAt gophercloud.JSONRFC3339MilliNoZ `json:"attached_at"` Lines 296 to 312 in cbd1d4b
type JSONRFC3339MilliNoZ time.Time func (jt *JSONRFC3339MilliNoZ) UnmarshalJSON(data []byte) error { var s string if err := json.Unmarshal(data, &s); err != nil { return err } if s == "" { return nil } t, err := time.Parse(RFC3339MilliNoZ, s) if err != nil { return err } *jt = JSONRFC3339MilliNoZ(t) return nil }
results.goalready has a wide array of time formats. It's doubtful you'll need to define a new one.Let me know if you need any help with this.
@iurygregory ^ FYI, if you have time to look
@stbenjam going to look
@jtopjian according to the Ironic API docs they we handle as string see https://developer.openstack.org/api-ref/baremetal/?expanded=#ports-ports (Create Port Response, List Detailed Ports Response, Show Port Details Response, Update a Port Response)
created_at | body | string | The UTC date and time when the resource was created, ISO 8601 format.
updated_at | body | string | The UTC date and time when the resource was updated, ISO 8601 format. May be “null”.So its still necessary to change?
I think so. You’ll still interact with the API using strings but it should be marshalled/unmarshalled as a native time type in go.
@stbenjam is correct. API references and JSON samples will always have dates as strings because JSON doesn't have a native "date" type. Converting them to a real date-type in Go will allow code to use date-specific methods/actions.
There are lots examples throughout Gophercloud on how to handle this (just search for
UnmarshalJSON), but please let me know if you need help - I don't mean for this to cause a large amount of time.@iurygregory would you be able to check the TODO items in the bug description and see what's actually left to do (and maybe prioritize it?).
Thanks
@EmilienM @iurygregory is on PTO this month, so I wouldn't expect a reply before sometime in January.
Reacted by Emilien Macchi(...) so I wouldn't expect a reply before sometime in January.
Thanks. This is not urgent at all! Trying to make sure we keep this issue updated and at some point we close it.
Maintenance API: #2384
Reacted by Stephen BenjaminHey Folks,
I recently(ish) contributed #3228, and am now looking to contribute more to baremetal. I will read everything up to now and make my own judgement on what to tackle next, but if anyone has features they are interested in being covered first, let me know.
There are also some updates to this list. If I can be given permissions to edit the above post I am happy to do all those updates.
#2722 (Conductors is completed)Portgroups seems like a good start from there?
Cheers :)
Reacted by Pierre Prinetti@Sharpz7 thanks! It's worth checking which features of the list above are actually implemented or not: I think it's outdated. Of all items marked as not done, I think the port groups and the VIF API are the most important, followed by vendor passthru (but I'm quite sure we already have at least some passthru support) and the rest of the allocation API.
Conductors API seems to have been implemented by #2722 (but please double-check it for completeness).
@dtantsur you responded too quickly! I was just editing my comment since spotting the conductors change. Thank you though, I agree with you and I think that priority list is good :)
FYI, I've updated the list with completed work. Let me know if I missed anything.
I don't think there is much left now. Maybe volumes?
@Sharpz7 do we have runbooks?
Okay... I think this issue is nearly entirely covered.
There is currently no support for Ironic baremetal API in gophercloud. I'm working on it, and will have a PR open shortly for Nodes to get some early feedback, and will then continue on to the rest of the resources.
Categorized by the groupings under https://developer.openstack.org/api-ref/baremetal/
API
API VersionsBaremetal API: Return versions supported by the API #1577Clients
KeystoneBaremetal v1 API: Nodes #1431NoauthBaremetal API: noauth support #1449HTTPBasic Support http_basic auth_strategy for Ironic Inspector #1986 (inspector) and Support http_basic auth_strategy for Ironic #1983 ironic)Nodes
Basic CRUD
Nodes: ListBaremetal v1 API: Nodes #1431Nodes: GetBaremetal v1 API: Nodes #1431Nodes: CreateBaremetal v1 API: Nodes #1431Nodes: UpdateBaremetal v1 API: Nodes #1431Nodes: DeleteBaremetal v1 API: Nodes #1431Node Management
Nodes: ValidationBaremetal V1 API: Node management #1450Nodes: Boot DevicesBaremetal V1 API: Node management #1450Nodes: Non-masking interruptsBaremetal V1 API: Node management #1450Nodes: Provision StateBaremetal API v1: Node provision state #1452Nodes: Maintenancebaremetal: add API to set maintenance and maintenance reason #2384Nodes: Power StateBaremetal API v1: Node Power State #1479Nodes: RAID ConfigBaremetal API V1: Support set RAID config #1559Node Vendor Passthru
Node Traits
Virtual Interfaces
VIF: List for a NodeAdded support for VIF's in Baremetal #3311VIF: Attach to a NodeAdded support for VIF's in Baremetal #3311VIF: Detach from a NodeAdded support for VIF's in Baremetal #3311Portgroups
Portgroups: ListAdded support for baremetal portgroups #3290Portgroups: GetAdded support for baremetal portgroups #3290Portgroups: CreateAdded support for baremetal portgroups #3290Portgroups: UpdateAdded support for baremetal portgroups #3290Portgroups: DeleteAdded support for baremetal portgroups #3290Ports
Ports: ListBaremetal V1 API Ports #1453Ports: GetBaremetal V1 API Ports #1453Ports: CreateBaremetal V1 API Ports #1453Ports: UpdateBaremetal V1 API Ports #1453Ports: DeleteBaremetal V1 API Ports #1453Volumes
Volume Connector
Volume Targets
Drivers
Drivers: List Baremetal V1 API Drivers #1461Drivers: Get Baremetal V1 API Drivers #1461Drivers: Show PropertiesBaremetal V1 API Drivers #1461Drivers: Show disk propertiesBaremetal V1 API Drivers #1461Drivers vendor passthru
Conductors
Conductors: ListAdd conductor API to Baremetal V1 #2722Conductor: GetAdd conductor API to Baremetal V1 #2722Allocation
Allocation: CreateBaremetal API V1: Allocations #1528Allocation: ListBaremetal API V1: Allocations #1528Allocation: GetBaremetal API V1: Allocations #1528Allocation: DeleteBaremetal API V1: Allocations #1528Allocation: Node
Chassis