Kaminario / krest

The Kaminario REST (krest) is a client library that provides ORM like interface for working with Kaminario K2 REST API
Other
5 stars 5 forks source link

problem mapping volume to host #14

Closed tstrulw closed 7 years ago

tstrulw commented 7 years ago

when trying: mapping = ep.new("mappings", volume="vol_name",host="host_name").save() (according to the manual)

Im getting an error: requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://X.X.X.X/api/v2/mappings Invalid value for attribute host.

haizaar commented 7 years ago

Values of "volume" and "host" parameters should be respective volume and host objects that were previously fetched from krest, not just names. Which manual are you referring to?

On 16 January 2017 at 16:45, tstrulw notifications@github.com wrote:

when trying: mapping = ep.new("mappings", volume="vol_name",host="host_name").save() (according to the manual)

Im getting an error: requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://X.X.X.X/api/v2/mappings Invalid value for attribute host.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kaminario/krest/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/AADjWdb6AiLVRIV1-9F719ozSn3xnBP3ks5rS4KLgaJpZM4LkoVc .

-- Zaar

tstrulw commented 7 years ago

I meant README.md :)

Im getting the vol name after doing search operation: volinfo = ep.search("volumes", name=vol) for data in volinfo.hits vol = data.name

I dont really understand, should I use the whole ResultSet?

haizaar commented 7 years ago

Not the whole resultset - only the particular object. Find your volume using search by name, then take the relevant (first?) object from result set and pass it to mapping creation call as volume parameter (similarly for host). Hope this helps.

On 16 January 2017 at 17:10, tstrulw notifications@github.com wrote:

I meant README.md :)

Im getting the vol name after doing search operation: volinfo = ep.search("volumes", name=vol) for data in volinfo.hits vol = data.name

I dont really understand, should I use the whole ResultSet?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Kaminario/krest/issues/14#issuecomment-272887084, or mute the thread https://github.com/notifications/unsubscribe-auth/AADjWblxtynEJs8JvIrDmZ-lcAE_W20kks5rS4hkgaJpZM4LkoVc .

-- Zaar

tstrulw commented 7 years ago

Got it. work great. Thank you! (Toda :) )

haizaar commented 7 years ago

You are welcome.