Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] No option for xenstoredata #261

Closed
ravager-dk opened this issue Sep 25, 2023 · 10 comments
Closed

[FEATURE] No option for xenstoredata #261

ravager-dk opened this issue Sep 25, 2023 · 10 comments

Comments

@ravager-dk
Copy link
Contributor

Although the XAPI supports xenstoredata there is no such option in the provider for VMs. Request add option like:

resource "xenorchestra_vm" VM" {
affinity_host = data.xenorchestra_host.host.id
count = length(var.ip)
cpus = 2
disk {
attached = true
name_label = VM${count.index + 1}-Disk0"
size = 20000000000
sr_id = data.xenorchestra_sr.local_storage.id
}
template = data.xenorchestra_template.mytemplate.id
exp_nested_hvm = false
memory_max = 2147483648
name_description = "Virtual Appliance"
name_label = "VM${count.index + 1}"
network {
attached = true
# device = 0
network_id = data.xenorchestra_network.MyNet.id
}
cdrom {
id = resource.xenorchestra_vdi.iso[count.index].id
}
vga = "cirrus"
videoram = 4
xenstoredata = {
"vm-data/whatever" = "Testdata"
}

}

@ravager-dk
Copy link
Contributor Author

@ddelnano I have an attempt at this in my fork currently, but my knowledge of the API we are hitting on the xenorchestra server is limited, So I am not actually entirely sure where to look up the format in that source code. Perhaps you know?

@ddelnano
Copy link
Collaborator

ddelnano commented Sep 26, 2023

@ravager-dk the API is self describing with the xo-cli. If you run xo-cli --list-commands you will see most of the arguments exposed.

ddelnano@ddelnano-desktop:~$ xo-cli --list-commands | grep vm.create
vm.create [affinityHost=<string>] [bootAfterCreate=<boolean>] [cloudConfig=<string>] [networkConfig=<string>] [coreOs=<boolean>] [clone=<boolean>] [coresPerSocket=<string|number>] [resourceSet=<string>] [destroyCloudConfigVdiAfterBoot=<boolean>] [installation=<object>] [vgpuType=<string>] [gpuGroup=<string>] name_label=<string> [name_description=<string>] [pv_args=<string>] [share=<boolean>] template=<string> [VIFs=<array>] [VDIs=<array>] [existingDisks=<object>] [hvmBootFirmware=<string>] [copyHostBiosStrings=<boolean>] *=<unknown type>

Xenstoredata is not part of that today, so that would need to be a feature request for the vatesfr/xen-orchestra project. It looks like there was some discussion on vatesfr/xen-orchestra#2003 and the decision was that cloudinit was a more standard interface to provide boot configuration.

Could you explain more about how you intend to use xenstore? Have you evaluated cloudinit for your use case?

@ravager-dk
Copy link
Contributor Author

@ddelnano thanks for the info. I had not seen that xo-cli could be used to gather the API info. I was looking through the xen-orchestra source and found several references to xenstoredata in there, so I assumed it was OK.
The problem I have is that when deploying Netscaler VPX's the only supported way to auto provision the IP information is via xenstoredata - https://support.citrix.com/article/CTX128236/how-to-autoprovision-netscaler-vpx-on-xenserver

My only other option is to switch to the xenserver provider instead, which has this option communicating directly with the xenserver. I would however prefer some degree of feature parity between xenorchestra and xenserver. I don't need it in the UI of xenorchestra, just in the API.

@ravager-dk
Copy link
Contributor Author

ravager-dk commented Oct 18, 2023

This depends a bit on the strategy of #263. Xenstore data for Netscaler VMs does not take effect if the VM is running. There are several ways to implement it.
One strategy would be to not set start the VM on creation if xenstore data param is set, then do a VM.set and then VM.start.
What do you think @ddelnano ?

julien-f pushed a commit to vatesfr/xen-orchestra that referenced this issue Jan 17, 2024
The initial support added in #7055 to support terraform resource support doesn't provide read access to a VM's state.

Since Tterraform's model requires read and write access to the resource it's managing, this PR implements the missing piece for vatesfr/terraform-provider-xenorchestra#261.
borzel pushed a commit to borzel/xen-orchestra that referenced this issue Jan 17, 2024
The initial support added in vatesfr#7055 to support terraform resource support doesn't provide read access to a VM's state.

Since Tterraform's model requires read and write access to the resource it's managing, this PR implements the missing piece for vatesfr/terraform-provider-xenorchestra#261.
borzel pushed a commit to borzel/xen-orchestra that referenced this issue Jan 17, 2024
The initial support added in vatesfr#7055 to support terraform resource support doesn't provide read access to a VM's state.

Since Tterraform's model requires read and write access to the resource it's managing, this PR implements the missing piece for vatesfr/terraform-provider-xenorchestra#261.
@ddelnano
Copy link
Collaborator

@ravager-dk this functionality will be available in v0.28.0. I'll be making that release tomorrow once our main build's nightly job succeeds

@ravager-dk
Copy link
Contributor Author

@ravager-dk this functionality will be available in v0.28.0. I'll be making that release tomorrow once our main build's nightly job succeeds

Awesome. Looking forward to removing a remote_exec performing this manually through ssh.

@ddelnano
Copy link
Collaborator

One thing to note is that XO is managing some xenstore data behind the scenes. The terraform provider does not attempt to hide these hidden pieces of config. You will either need to track these key, value pairs in your code or ignore them. The new docs mention this, but just wanted to share that example.

@ddelnano
Copy link
Collaborator

v0.28.0 is now available.

@ravager-dk
Copy link
Contributor Author

Finally had a chance to verify it today. It works like a charm.
Good job @ddelnano

@ddelnano
Copy link
Collaborator

ddelnano commented Mar 1, 2024

Thanks for letting me know it suits your needs and is working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants