Here is a few methods to auto-provision VMS on XenServer.. There are two methods, first is the add metadata to the VM, OVF or Template and the second is to directly read this information from XenTools commands.
Method 1:
You can add XenStore/.. metadata key value to a VM, Template or OVF. These settings are used by VPX appliance if the ns.conf does not exist. Here is a example to Auto-provision a VPX appliance
- Xe vm-param-set uuid=<vm uuid> xenstore-data:vm-data/ip-address=192.168.1.1 ## Needs to be done while the VM is powered
- Import NetScaler VPX Appliance (Do not boot)
- Convert this NetScaler Appliance to a XenServer Template
- Apply the IP details via the following commands to the Template UUID
- xe vm-param-add uuid=f453b65d-5d46-34b0-7efd-bef32a3484f4 param-name=xenstore-data vm-data/ip=10.0.0.10
- xe vm-param-add uuid=f453b65d-5d46-34b0-7efd-bef32a3484f4 param-name=xenstore-data vm-data/netmask=255.255.255.0
- xe vm-param-add uuid=f453b65d-5d46-34b0-7efd-bef32a3484f4 param-name=xenstore-data vm-data/gateway=10.0.0.11
- Quick Create VM via Template and boot up (Apply name label, networks and any other configs)
- xe vm-clone new-name-lablel=<name_for_clone> uuid= f453b65d-5d46-34b0-7efd-bef32a3484f4
- xe vm-start
- Shell into the NS IP and upload license files (How do you do that)? Once you obtain a license from Citrix, upload it to /nsconfig/licenses and reboot VPX. Once it’s up you should be able to enable licensed features: “enable feature NAME”
Method 2:
You can use commands provided by XenTools client on both windows and linux to read vaules in the XenStore metadata key:
Windows Command
- “C:\Program Files\Citrix\XenTools\xenstore_client.exe” read vm-data/ip-address 192.168.1.1
Linux Commands
- xenstore-chmod xenstore-exists xenstore-list xenstore-ls xenstore-read xenstore-rm xenstore-write
Reference:
How to auto-provision VPX Appliance – http://support.citrix.com/article/CTX128236 & http://support.citrix.com/article/CTX128250
XenServer API – http://support.citrix.com/article/CTX127586
Evaluating the XenStore Data Structure – http://support.citrix.com/article/CTX116211
More info on XenStore – http://wiki.xensource.com/xenwiki/XenIntro
Thank you!
“10. Shell into the NS IP and upload license files (How do you do that)?”
Once you obtain a license from Citrix, upload it to /nsconfig/licenses and reboot VPX. Once it’s up you should be able to enable licensed features:
“enable feature NAME”
Thanks,
Marat
Update: In XS6.1 we introduced an alternative to XenStore_Client.exe which going forward should be more robust and offers a far more flexible and richer interface via a standard Windows Management Instrumentation (WMI) interface. This offers the potential to develop feature rich scripts for tasks like VDI/XenDesktop deployment and includes the capacity to raise and watch events when values in xenstore change.
Please do take a look: http://support.citrix.com/article/CTX136422
Best wishes,
Rachel
(XenServer Partner Engineering)