Auto-provision of VPX / VMs on XenServer

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
  1. Import NetScaler VPX Appliance (Do not boot)
  2. Convert this NetScaler Appliance to a XenServer Template
  3. Apply the IP details via the following commands to the Template UUID
  4. xe vm-param-add uuid=f453b65d-5d46-34b0-7efd-bef32a3484f4 param-name=xenstore-data vm-data/ip=10.0.0.10
  5. xe vm-param-add uuid=f453b65d-5d46-34b0-7efd-bef32a3484f4 param-name=xenstore-data vm-data/netmask=255.255.255.0
  6. xe vm-param-add uuid=f453b65d-5d46-34b0-7efd-bef32a3484f4 param-name=xenstore-data vm-data/gateway=10.0.0.11
  7. Quick Create VM via Template and boot up (Apply name label, networks and any other configs)
  8. xe vm-clone new-name-lablel=<name_for_clone> uuid= f453b65d-5d46-34b0-7efd-bef32a3484f4
  9. xe vm-start
  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”

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


Advertisements

2 Comments

  1. 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

  2. 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)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s