
4
Table of Contents
1. Introduction .................................................................................................................. 1
2. Getting Started ............................................................................................................ 2
2.1. System Requirements and Preparation ............................................................... 2
2.2. Downloading ..................................................................................................... 2
2.3. Installation ........................................................................................................ 2
2.4. What's new ....................................................................................................... 2
2.5. Content Map ..................................................................................................... 2
2.6. Building Samples for the Linux Platform ............................................................. 3
2.7. Building Samples for the Windows Platform ........................................................ 3
2.8. Running the CLI ............................................................................................... 3
2.8.1. Tab Completion ...................................................................................... 3
2.9. Accessing SDK reference .................................................................................. 3
3. Overview of the XenServer API .................................................................................... 5
3.1. Getting Started with the API .............................................................................. 5
3.1.1. Authentication: acquiring a session reference ........................................... 5
3.1.2. Acquiring a list of templates to base a new VM installation on .................... 5
3.1.3. Installing the VM based on a template ..................................................... 6
3.1.4. Taking the VM through a start/suspend/resume/stop cycle ......................... 6
3.1.5. Logging out ............................................................................................ 6
3.1.6. "Install and start example": summary ....................................................... 7
3.2. Object Model Overview ..................................................................................... 7
3.3. Working with VIFs and VBDs ............................................................................. 9
3.3.1. Creating disks and attaching them to VMs ............................................... 9
3.3.2. Creating and attaching Network Devices to VMs ..................................... 11
3.3.3. Host configuration for networking and storage ........................................ 11
3.4. Exporting and Importing VMs ........................................................................... 12
3.5. Where to look next .......................................................................................... 13
4. Using the API ............................................................................................................ 14
4.1. Anatomy of a typical application ....................................................................... 14
4.1.1. Choosing a low-level transport .............................................................. 14
4.1.2. Authentication and session handling ...................................................... 14
4.1.3. Finding references to useful objects ....................................................... 15
4.1.4. Invoking synchronous operations on objects ........................................... 15
4.1.5. Using Tasks to manage asynchronous operations ................................... 16
4.1.6. Subscribing to and listening for events ................................................... 16
4.2. Language bindings .......................................................................................... 17
4.2.1. C ......................................................................................................... 17
4.2.2. C# ....................................................................................................... 18
4.2.3. Python ................................................................................................. 18
4.2.4. Command Line Interface (CLI) .............................................................. 19
4.3. Complete application examples ........................................................................ 19
4.3.1. Simultaneously migrating VMs using XenMotion ..................................... 19
4.3.2. Cloning a VM via the XE CLI ................................................................ 22
5. XenServer API extensions .......................................................................................... 24
5.1. VM console forwarding .................................................................................... 24
5.1.1. Retrieving VNC consoles via the API ..................................................... 24
5.1.2. Disabling VNC forwarding for Linux VM ................................................. 25
5.2. Paravirtual Linux installation ............................................................................. 26
5.2.1. Red Hat Enterprise Linux 4.1/4.4 ........................................................... 26
5.2.2. Red Hat Enterprise Linux 4.5/5.0 ........................................................... 26
5.2.3. SUSE Enterprise Linux 10 SP1 ............................................................. 27