XenServer Software Development Kit Guide 4.1.0

Overview of the XenServer API
13
Argument Description
uuid the uuid of the VM; required only if not using the reference
For example:
curl http://root:foo@xenserver/export&uuid=[VM UUID]&task_id= [task ID] -o export
To export just the metadata, use the URI http://server/export_metadata
The import protocol is similar, using HTTP(S) PUT. The [session_id] and [task_id] arguments are as for the
export. The [ref] and [uuid] are not used; a new reference and uuid will be generated for the VM. There are
some additional parameters:
Argument Description
restore if this parameter is true, the import is treated as replacing the original VM -
the implication of this currently is that the MAC addresses on the VIFs are
exactly as the export was, which will lead to conflicts if the original VM is
still being run.
force if this parameter is true, any checksum failures will be ignored (the default
is to destroy the VM if a checksum error is detected)
sr_id The reference of an SR into which the VM should be imported. The default
behaviour is to import into the Pool.default_SR.
To import just the metadata, use the URI http://server/import_metadata
3.5. Where to look next
In this chapter we have presented a brief high-level overview of the API and its object-model. The aim here
is not to present the detailed semantics of the API, but just to provide enough background for you to start
reading the code samples of the next chapter and to find your way around the more detailed XenEnterprise
Management API reference document.
There are a number of places you can find more information:
The Administrators Guide contains an overview of the xe CLI. Since a good deal of xe commands are a
thin veneer over the API, playing with xe is a good way to start finding your way around the API object
model described in this chapter.
The code samples in the next chapter provide some concrete instances of API coding in a variety of client
languages.
The XenEnterprise Management API reference document provides a more detailed description of the API
semantics as well as describing the the format of XML/RPC messages on the wire. and
There are a few scripts that use the API in the XenServer Host dom0 itself. For example, "/opt/xen-
source/libexec/shutdown" is a python program that cleanly shuts VMs down. This script is invoked when
the host itself is shutdown.