vatesfr / xen-orchestra

The global orchestration solution to manage and backup XCP-ng and XenServer.
https://xen-orchestra.com
Other
756 stars 262 forks source link

Provide xenstoredata interface in the API #7055

Closed ravager-dk closed 9 months ago

ravager-dk commented 10 months ago

Is your feature request related to a problem? Please describe. I am trying to provision a Netscaler VPX with IP information via the terraform provider for xenorchestra. However there is no option to define xenstoredata, which is the only way to set this up. https://support.citrix.com/article/CTX128236/how-to-autoprovision-netscaler-vpx-on-xenserver According to @ddelnano in https://github.com/terra-farm/terraform-provider-xenorchestra/issues/261 we need this option exposed in the xenorchestra API for it to work. I doubt Cloud Software Group will change Netscaler to use cloudinit anytime soon.

Describe the solution you'd like Add xenstoredata map to the API creating and updating VMs

Describe alternatives you've considered Use xenserver terraform provider instead.

Additional context I have looked through the xen-orchestra source, but sadly I don't quite understand the structure enough yet to come up with a PR for it myself. If I knew the parts handling the websocket requests from terraform provider and forwarding them to the xenserver, I could likely do this.

ravager-dk commented 10 months ago

Be aware, that the latest releases of Netscaler 13.1 and 14.1 has a bug preventing those builds from reading the xenstoredata. This should however not prevent us from adding it to xenorchestras API.

olivierlambert commented 10 months ago

We have 0 Netscaler (nor any virtual desktop) knowledge here, so we won't be able to test it. However, I don't see any issue to allow writing in the xenstore fields (which are just some XAPI key/values after all). Now it's a matter on how we expose this in XO API.

We'll discuss this after our monthly release (this Friday). Stay tuned!

ravager-dk commented 10 months ago

We have 0 Netscaler (nor any virtual desktop) knowledge here, so we won't be able to test it. However, I don't see any issue to allow writing in the xenstore fields (which are just some XAPI key/values after all). Now it's a matter on how we expose this in XO API.

We'll discuss this after our monthly release (this Friday). Stay tuned!

Thanks @olivierlambert, that sounds great. Let me know if I can contribute in any way with Netscaler insight.

julien-f commented 9 months ago

You can now do

# Set vm-data/foo to bar
xo-cli vm.set id=<id> xenStoreData=json:'{ "foo": "bar" }'

# Delete vm-data/foo
xo-cli vm.set id=<id> xenStoreData=json:'{ "foo": null }'

Let me know if you need something else :slightly_smiling_face:

ddelnano commented 9 months ago

@julien-f thanks for the update. What is the next xo-server release that will include this change? I'll be giving this a try with the terraform provider once it's in a release.

julien-f commented 9 months ago

@ddelnano Already available in master. For XOAs, it will be available for the next release October 31st.

ravager-dk commented 9 months ago

Thank you @julien-f It seems to work great.

olivierlambert commented 9 months ago

Great! We'll be happy to see more integration between CSG products and XO/XCP-ng, let us know if there's anything we can do to go in that direction :+1:

ddelnano commented 6 months ago

@julien-f terraform terraform will need read access to the data. It needs to be able to inspect a current VM's state and determine what parts are out of sync with the terraform code.

I've raised https://github.com/vatesfr/xen-orchestra/pull/7316 to implement the remaining functionality needed before I can complete the terraform side.