HP BL680c XenServer Software Development Kit Guide 4.1.0 - Page 24

C#, 4.2.3. Python, C# binding dependencies

Page 24 highlights

Using the API Dependencies:• XML-RPC library (libxml2.so on GNU Linux) • Curl library (libcurl2.so) One simple example is included within the SDK called test_vm_ops. The example demonstrates how to query the capabilities of a host, create a VM, attach a fresh blank disk image to the VM and then perform various powercycle operations. 4.2.2. C# The C# bindings are contained within the directory /SDK/client-examples/csharp/XenSdk.net and include project files suitable for building under Microsoft Visual Studio. Every API object is associated with one C# file; for example the functions implementing the VM operations are contained within the file VM.cs. C# binding dependencies Platform supported: Windows with .NET version 2.0 Library: The language binding is generated as a Dynamic Link Library Xenapi.dll that is linked by C# programs Dependencies:CookComputing.XMLRpcV2.dll is needed for the xenapi.dll to be able to communicate with the xml-rpc server. Two simple examples are included with the C# bindings in the directory /SDK/client-examples/csharp/XenSdk.net: • VM-Lifecycle: logs into a XenServer Host, lists all the VM records, filters out the templates, clones a VM from one template, configures the name and description of the VM before finally power-cycling the VM; and • Monitor: logs into a XenServer Host, queries properties of a host, lists all Storage Repositories, lists all VMs and prints various attributes. 4.2.3. Python The python bindings are contained within a single file: /SDK/client-examples/python/XenAPI.py. Python binding dependencies Platform supported: Linux Library: XenAPI.py Dependencies:None The SDK includes 7 python examples: • fixpbds.py: reconfigures the settings used to access shared storage; • install.py: installs a Debian VM, connects it to a network, starts it up and waits for it to report its IP address; • license.py: uploads a fresh license to a XenServer Host; 18

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

Using the API
18
Dependencies:
XML-RPC library (libxml2.so on GNU Linux)
Curl library (libcurl2.so)
One simple example is included within the SDK called
test_vm_ops
. The example demonstrates how to
query the capabilities of a host, create a VM, attach a fresh blank disk image to the VM and then perform
various powercycle operations.
4.2.2. C#
The C# bindings are contained within the directory
/SDK/client-examples/csharp/XenSdk.net
and
include project files suitable for building under Microsoft Visual Studio. Every API object is associated with
one C# file; for example the functions implementing the VM operations are contained within the file
VM.cs
.
C# binding dependencies
Platform
supported:
Windows with .NET version 2.0
Library:
The language binding is generated as a Dynamic Link Library Xenapi.dll that is linked by
C# programs
Dependencies:
CookComputing.XMLRpcV2.dll is needed for the xenapi.dll to be able to communicate
with the xml-rpc server.
Two simple examples are included with the C# bindings in the directory
/SDK/client-exam-
ples/csharp/XenSdk.net
:
VM-Lifecycle
: logs into a XenServer Host, lists all the VM records, filters out the templates, clones a
VM from one template, configures the name and description of the VM before finally power-cycling the
VM; and
Monitor
: logs into a XenServer Host, queries properties of a host, lists all Storage Repositories, lists all
VMs and prints various attributes.
4.2.3. Python
The python bindings are contained within a single file:
/SDK/client-examples/python/XenAPI.py
.
Python binding dependencies
Platform
supported:
Linux
Library:
XenAPI.py
Dependencies:
None
The SDK includes 7 python examples:
fixpbds.py
: reconfigures the settings used to access shared storage;
install.py
: installs a Debian VM, connects it to a network, starts it up and waits for it to report its IP address;
license.py
: uploads a fresh license to a XenServer Host;