The Storage Manager (SM) is responsible for all storage operations on an XCP host. It organises Virtual Disk Images (VDIs) into homogenous collections known as Storage Repositories (SRs) where each collection is stored in a specific format (e.g. .vhd files on NFS, raw LUN on a iSCSI/FC storage array). The Storage Manager API (SMAPI) provides a simple abstract interface which allows the toolstack to create, destroy, snapshot, clone, resize etc VDIs within SRs
Debug context from the caller
Primary key for a Virtual Disk Image (e.g. path on a storage system)
Primary key for a Storage Repository (e.g. a UUID)
Identifies the contents (i.e. bytes with) a VDI. Two VDIs with the same content_id must have the same content.
All per-VDI properties
Members:
Type | Description | |
vdi
|
vdi
|
The unique id of this VDI |
content_id
|
content_id
|
The unique id of the VDI contents. If two VDIs have the same content_id then they must have the same data inside |
name_label
|
string
|
Human-readable name of the VDI |
name_description
|
string
|
Human-readable description of the VDI |
ty
|
string
|
Used by a toolstack to remember why a VDI was created |
metadata_of_pool
|
string
|
In the special case of a pool metadata containing VDI, this is the pool reference |
is_a_snapshot
|
bool
|
True if the VDI is a snapshot of another VDI |
snapshot_time
|
string
|
If is_a_snapshot is true then this is the time the snapshot was created |
snapshot_of
|
string
|
If is_a_snapshot is true then this is the VDI which was snapshotted |
read_only
|
bool
|
If true then this VDI is stored on read-only media |
virtual_size
|
int64
|
Size of the VDI from the perspective of a VM (in bytes) |
physical_utilisation
|
int64
|
Amount of space currently being consumed on the physical storage media |
persistent
|
bool
|
If true then disk modifications are preserved over VM reboot and shutdown |
sm_config
|
(string * string) list
|
Backend-specific parameters |
Configuration for blkback
Members:
Type | Description | |
params
|
string
|
The xenstore backend params key |
xenstore_data
|
(string * string) list
|
Additional xenstore backend device keys |
properties of this implementation
Members:
Type | Description | |
driver
|
string
|
driver, used in the XenAPI as SR.type |
name
|
string
|
short name |
description
|
string
|
description |
vendor
|
string
|
entity which produced this implementation |
copyright
|
string
|
copyright |
version
|
string
|
version |
required_api_version
|
string
|
minimum required API version |
features
|
string list
|
features supported by this plugin |
configuration
|
(string * string) list
|
key/description pairs describing required device_config parameters |
Discover properties of this implementation
Query the implementation and return its properties
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
query_result
|
out |
query_result
|
The properies of this implementation |
<method name="query"> <tp:docstring> Query the implementation and return its properties </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="(sssssssasa{ss})" name="query_result" direction="out"> <tp:docstring> The properies of this implementation </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = Query_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.query ~dbg:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module Query_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include Query_skeleton(M) (* ... *) let query x = let open Query.Query in return (Result.Ok (Out.({ driver = "string"; name = "string"; description = "string"; vendor = "string"; copyright = "string"; version = "string"; required_api_version = "string"; features = [ "string"; "string" ]; configuration = [ ("string", "string") ] }))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.Query.query({ dbg: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class Query_myimplementation(Query_skeleton): # by default each method will return a Not_implemented error # ... def query(self, dbg): """Discover properties of this implementation""" result = {} result["query_result"] = { "driver": "string", "name": "string", "description": "string", "vendor": "string", "copyright": "string", "version": "string", "required_api_version": "string", "features": [ "string", "string" ], "configuration": { "string": "string" } } return result # ...
[diagnostics ()]: returns a printable set of backend diagnostic information.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
diagnostics
|
out |
string
|
A string containing loggable human-readable diagnostics information |
<method name="diagnostics"> <tp:docstring> [diagnostics ()]: returns a printable set of backend diagnostic information. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="diagnostics" direction="out"> <tp:docstring> A string containing loggable human-readable diagnostics information </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = Query_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.diagnostics ~dbg:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module Query_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include Query_skeleton(M) (* ... *) let diagnostics x = let open Query.Diagnostics in return (Result.Ok (Out.("string"))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.Query.diagnostics({ dbg: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class Query_myimplementation(Query_skeleton): # by default each method will return a Not_implemented error # ... def diagnostics(self, dbg): """Discover properties of this implementation""" result = {} result["diagnostics"] = "string" return result # ...
Operations which operate on Virtual Disk Images
[create task sr vdi_info params] creates a new VDI in [sr] using [vdi_info]. Some fields in the [vdi_info] may be modified (e.g. rounded up), so the function returns the vdi_info which was used.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi_info
|
in |
vdi_info
|
The Virtual Disk Image properties |
new_vdi
|
out |
vdi_info
|
The created Virtual Disk Image |
<method name="create"> <tp:docstring> [create task sr vdi_info params] creates a new VDI in [sr] using [vdi_info]. Some fields in the [vdi_info] may be modified (e.g. rounded up), so the function returns the vdi_info which was used. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="vdi_info" direction="in"> <tp:docstring> The Virtual Disk Image properties </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="new_vdi" direction="out"> <tp:docstring> The created Virtual Disk Image </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.create ~dbg:"string" ~sr:"string" ~vdi_info:{ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] };;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let create x = let open VDI.Create in return (Result.Ok (Out.({ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] }))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.create({ dbg: "string", sr: "string", vdi_info: { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def create(self, dbg, sr, vdi_info): """Operations which operate on Virtual Disk Images""" result = {} result["new_vdi"] = { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } return result # ...
[snapshot task sr vdi_info] creates a new VDI which is a snapshot of [vdi_info.vdi] in [sr]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi_info
|
in |
vdi_info
|
The Virtual Disk Image properties |
new_vdi
|
out |
vdi_info
|
[snapshot task sr vdi_info params] creates a new VDI which is a snapshot of [vdi_info.vdi] in [sr] |
<method name="snapshot"> <tp:docstring> [snapshot task sr vdi_info] creates a new VDI which is a snapshot of [vdi_info.vdi] in [sr] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="vdi_info" direction="in"> <tp:docstring> The Virtual Disk Image properties </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="new_vdi" direction="out"> <tp:docstring> [snapshot task sr vdi_info params] creates a new VDI which is a snapshot of [vdi_info.vdi] in [sr] </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.snapshot ~dbg:"string" ~sr:"string" ~vdi_info:{ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] };;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let snapshot x = let open VDI.Snapshot in return (Result.Ok (Out.({ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] }))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.snapshot({ dbg: "string", sr: "string", vdi_info: { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def snapshot(self, dbg, sr, vdi_info): """Operations which operate on Virtual Disk Images""" result = {} result["new_vdi"] = { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } return result # ...
[clone task sr vdi_info] creates a new VDI which is a clone of [vdi_info.vdi] in [sr]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi_info
|
in |
vdi_info
|
The Virtual Disk Image properties |
new_vdi
|
out |
vdi_info
|
[clone task sr vdi_info params] creates a new VDI which is a clone of [vdi_info.vdi] in [sr] |
<method name="clone"> <tp:docstring> [clone task sr vdi_info] creates a new VDI which is a clone of [vdi_info.vdi] in [sr] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="vdi_info" direction="in"> <tp:docstring> The Virtual Disk Image properties </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="new_vdi" direction="out"> <tp:docstring> [clone task sr vdi_info params] creates a new VDI which is a clone of [vdi_info.vdi] in [sr] </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.clone ~dbg:"string" ~sr:"string" ~vdi_info:{ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] };;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let clone x = let open VDI.Clone in return (Result.Ok (Out.({ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] }))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.clone({ dbg: "string", sr: "string", vdi_info: { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def clone(self, dbg, sr, vdi_info): """Operations which operate on Virtual Disk Images""" result = {} result["new_vdi"] = { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } return result # ...
[destroy task sr vdi] removes [vdi] from [sr]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
<method name="destroy"> <tp:docstring> [destroy task sr vdi] removes [vdi] from [sr] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.destroy ~dbg:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let destroy x = let open VDI.Destroy in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.destroy({ dbg: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def destroy(self, dbg, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[stat task sr vdi] returns metadata associated with VDI [vdi] in SR [sr].
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
vdi_info
|
out |
vdi_info
|
VDI metadata |
<method name="stat"> <tp:docstring> [stat task sr vdi] returns metadata associated with VDI [vdi] in SR [sr]. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="vdi_info" direction="out"> <tp:docstring> VDI metadata </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.stat ~dbg:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let stat x = let open VDI.Stat in return (Result.Ok (Out.({ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] }))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.stat({ dbg: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def stat(self, dbg, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} result["vdi_info"] = { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } return result # ...
[set_persistent task sr vdi persistent] configures whether a VDI's contents should be persisted across epochs
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
persistent
|
in |
bool
|
New value of the VDI persistent field |
<method name="set_persistent"> <tp:docstring> [set_persistent task sr vdi persistent] configures whether a VDI's contents should be persisted across epochs </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="b" name="persistent" direction="in"> <tp:docstring> New value of the VDI persistent field </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.set_persistent ~dbg:"string" ~sr:"string" ~vdi:"string" ~persistent:true;;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let set_persistent x = let open VDI.Set_persistent in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.set_persistent({ dbg: "string", sr: "string", vdi: "string", persistent: True }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def set_persistent(self, dbg, sr, vdi, persistent): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[epoch_begin task sr vdi] signals that VDI is about to be connected to a fresh (started, rebooted) VM.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
<method name="epoch_begin"> <tp:docstring> [epoch_begin task sr vdi] signals that VDI is about to be connected to a fresh (started, rebooted) VM. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.epoch_begin ~dbg:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let epoch_begin x = let open VDI.Epoch_begin in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.epoch_begin({ dbg: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def epoch_begin(self, dbg, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[epoch_end task sr vdi] signals that VDI is about to be disconnected from a shutting-down/rebooting VM.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
<method name="epoch_end"> <tp:docstring> [epoch_end task sr vdi] signals that VDI is about to be disconnected from a shutting-down/rebooting VM. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.epoch_end ~dbg:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let epoch_end x = let open VDI.Epoch_end in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.epoch_end({ dbg: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def epoch_end(self, dbg, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[attach task dp sr vdi read_write] returns the [params] for a given [vdi] in [sr] which can be written to if (but not necessarily only if) [read_write] is true
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
dp
|
in |
string
|
DataPath to attach this VDI for |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
read_write
|
in |
bool
|
If true then the DataPath will be used read/write, false otherwise |
device
|
out |
attach_info
|
backend device configuration |
<method name="attach"> <tp:docstring> [attach task dp sr vdi read_write] returns the [params] for a given [vdi] in [sr] which can be written to if (but not necessarily only if) [read_write] is true </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="dp" direction="in"> <tp:docstring> DataPath to attach this VDI for </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="b" name="read_write" direction="in"> <tp:docstring> If true then the DataPath will be used read/write, false otherwise </tp:docstring> </arg> <arg type="(sa{ss})" name="device" direction="out"> <tp:docstring> backend device configuration </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.attach ~dbg:"string" ~dp:"string" ~sr:"string" ~vdi:"string" ~read_write:true;;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let attach x = let open VDI.Attach in return (Result.Ok (Out.({ params = "string"; xenstore_data = [ ("string", "string") ] }))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.attach({ dbg: "string", dp: "string", sr: "string", vdi: "string", read_write: True }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def attach(self, dbg, dp, sr, vdi, read_write): """Operations which operate on Virtual Disk Images""" result = {} result["device"] = { "params": "string", "xenstore_data": { "string": "string" } } return result # ...
[activate task dp sr vdi] signals the desire to immediately use [vdi]. This client must have called [attach] on the [vdi] first.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
dp
|
in |
string
|
DataPath to attach this VDI for |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
<method name="activate"> <tp:docstring> [activate task dp sr vdi] signals the desire to immediately use [vdi]. This client must have called [attach] on the [vdi] first. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="dp" direction="in"> <tp:docstring> DataPath to attach this VDI for </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.activate ~dbg:"string" ~dp:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let activate x = let open VDI.Activate in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.activate({ dbg: "string", dp: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def activate(self, dbg, dp, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[deactivate task dp sr vdi] signals that this client has stopped reading (and writing) [vdi].
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
dp
|
in |
string
|
DataPath to deactivate |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
<method name="deactivate"> <tp:docstring> [deactivate task dp sr vdi] signals that this client has stopped reading (and writing) [vdi]. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="dp" direction="in"> <tp:docstring> DataPath to deactivate </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.deactivate ~dbg:"string" ~dp:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let deactivate x = let open VDI.Deactivate in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.deactivate({ dbg: "string", dp: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def deactivate(self, dbg, dp, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[detach task dp sr vdi] signals that this client no-longer needs the [params] to be valid.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
dp
|
in |
string
|
DataPath to detach |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
<method name="detach"> <tp:docstring> [detach task dp sr vdi] signals that this client no-longer needs the [params] to be valid. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="dp" direction="in"> <tp:docstring> DataPath to detach </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.detach ~dbg:"string" ~dp:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let detach x = let open VDI.Detach in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.detach({ dbg: "string", dp: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def detach(self, dbg, dp, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[copy task sr vdi url sr2] copies the data from [vdi] into a remote system [url]'s [sr2]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
url
|
in |
string
|
URL which identifies a remote system |
dest
|
in |
string
|
The Storage Repository to operate within |
new_vdi
|
out |
string
|
The Virtual Disk Image to operate on |
<method name="copy"> <tp:docstring> [copy task sr vdi url sr2] copies the data from [vdi] into a remote system [url]'s [sr2] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="s" name="url" direction="in"> <tp:docstring> URL which identifies a remote system </tp:docstring> </arg> <arg type="s" name="dest" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="new_vdi" direction="out"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.copy ~dbg:"string" ~sr:"string" ~vdi:"string" ~url:"string" ~dest:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let copy x = let open VDI.Copy in return (Result.Ok (Out.("string"))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.copy({ dbg: "string", sr: "string", vdi: "string", url: "string", dest: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def copy(self, dbg, sr, vdi, url, dest): """Operations which operate on Virtual Disk Images""" result = {} result["new_vdi"] = "string" return result # ...
[get_url task sr vdi] returns a URL suitable for accessing disk data directly.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
url
|
out |
string
|
URL which represents this VDI |
<method name="get_url"> <tp:docstring> [get_url task sr vdi] returns a URL suitable for accessing disk data directly. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="s" name="url" direction="out"> <tp:docstring> URL which represents this VDI </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.get_url ~dbg:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let get_url x = let open VDI.Get_url in return (Result.Ok (Out.("string"))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.get_url({ dbg: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def get_url(self, dbg, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} result["url"] = "string" return result # ...
[get_by_name task sr name] returns the vdi within [sr] with [name]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
name
|
in |
string
|
Name of the VDI to return |
vdi_info
|
out |
vdi_info
|
The Virtual Disk Image properties |
<method name="get_by_name"> <tp:docstring> [get_by_name task sr name] returns the vdi within [sr] with [name] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="name" direction="in"> <tp:docstring> Name of the VDI to return </tp:docstring> </arg> <arg type="(ssssssbssbxxba{ss})" name="vdi_info" direction="out"> <tp:docstring> The Virtual Disk Image properties </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.get_by_name ~dbg:"string" ~sr:"string" ~name:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let get_by_name x = let open VDI.Get_by_name in return (Result.Ok (Out.({ vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] }))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.get_by_name({ dbg: "string", sr: "string", name: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def get_by_name(self, dbg, sr, name): """Operations which operate on Virtual Disk Images""" result = {} result["vdi_info"] = { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } return result # ...
[set_content_id task sr vdi content_id] tells the storage backend that a VDI has an updated [content_id]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
content_id
|
in |
string
|
New value of the VDI content_id field |
<method name="set_content_id"> <tp:docstring> [set_content_id task sr vdi content_id] tells the storage backend that a VDI has an updated [content_id] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="s" name="content_id" direction="in"> <tp:docstring> New value of the VDI content_id field </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.set_content_id ~dbg:"string" ~sr:"string" ~vdi:"string" ~content_id:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let set_content_id x = let open VDI.Set_content_id in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.set_content_id({ dbg: "string", sr: "string", vdi: "string", content_id: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def set_content_id(self, dbg, sr, vdi, content_id): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[compose task sr vdi1 vdi2] layers the updates from [vdi2] onto [vdi1], modifying [vdi2]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi1
|
in |
string
|
The Virtual Disk Image to operate on |
vdi2
|
in |
string
|
The Virtual Disk Image to operate on |
<method name="compose"> <tp:docstring> [compose task sr vdi1 vdi2] layers the updates from [vdi2] onto [vdi1], modifying [vdi2] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi1" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="s" name="vdi2" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.compose ~dbg:"string" ~sr:"string" ~vdi1:"string" ~vdi2:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let compose x = let open VDI.Compose in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.compose({ dbg: "string", sr: "string", vdi1: "string", vdi2: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def compose(self, dbg, sr, vdi1, vdi2): """Operations which operate on Virtual Disk Images""" result = {} return result # ...
[similar_content sr vdi] returns a list, most similar first, of disks with recognizably similar content
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdi
|
in |
string
|
The Virtual Disk Image to operate on |
vdi_infos
|
out |
vdi_info
list
|
VDIs with recognizably similar content, most similar first |
<method name="similar_content"> <tp:docstring> [similar_content sr vdi] returns a list, most similar first, of disks with recognizably similar content </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="s" name="vdi" direction="in"> <tp:docstring> The Virtual Disk Image to operate on </tp:docstring> </arg> <arg type="a(ssssssbssbxxba{ss})" name="vdi_infos" direction="out"> <tp:docstring> VDIs with recognizably similar content, most similar first </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = VDI_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.similar_content ~dbg:"string" ~sr:"string" ~vdi:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module VDI_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include VDI_skeleton(M) (* ... *) let similar_content x = let open VDI.Similar_content in return (Result.Ok (Out.([ { vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] }; { vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] } ]))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.VDI.similar_content({ dbg: "string", sr: "string", vdi: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class VDI_myimplementation(VDI_skeleton): # by default each method will return a Not_implemented error # ... def similar_content(self, dbg, sr, vdi): """Operations which operate on Virtual Disk Images""" result = {} result["vdi_infos"] = [ { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } }, { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } ] return result # ...
Operations which act on Storage Repositories
[ls dbg]: returns a list of attached SRs
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
srs
|
out |
string
list
|
The attached SRs |
<method name="ls"> <tp:docstring> [ls dbg]: returns a list of attached SRs </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="as" name="srs" direction="out"> <tp:docstring> The attached SRs </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = SR_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.ls ~dbg:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module SR_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include SR_skeleton(M) (* ... *) let ls x = let open SR.Ls in return (Result.Ok (Out.([ "string"; "string" ]))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.SR.ls({ dbg: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class SR_myimplementation(SR_skeleton): # by default each method will return a Not_implemented error # ... def ls(self, dbg): """Operations which act on Storage Repositories""" result = {} result["srs"] = [ "string", "string" ] return result # ...
[create task sr device_config physical_size]: creates a fresh SR
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
device_config
|
in |
(string *
string
) list
|
Host-local SR configuration (e.g. address information) |
physical_size
|
in |
int64
|
Requested maximum size of the SR (bytes) |
<method name="create"> <tp:docstring> [create task sr device_config physical_size]: creates a fresh SR </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="a{ss}" name="device_config" direction="in"> <tp:docstring> Host-local SR configuration (e.g. address information) </tp:docstring> </arg> <arg type="x" name="physical_size" direction="in"> <tp:docstring> Requested maximum size of the SR (bytes) </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = SR_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.create ~dbg:"string" ~sr:"string" ~device_config:[ ("string", "string") ] ~physical_size:0L;;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module SR_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include SR_skeleton(M) (* ... *) let create x = let open SR.Create in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.SR.create({ dbg: "string", sr: "string", device_config: { "string": "string" }, physical_size: 0L }) print (repr(results))
import xmlrpclib import xcp from storage import * class SR_myimplementation(SR_skeleton): # by default each method will return a Not_implemented error # ... def create(self, dbg, sr, device_config, physical_size): """Operations which act on Storage Repositories""" result = {} return result # ...
[attach task sr]: attaches the SR
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
device_config
|
in |
(string *
string
) list
|
Host-local SR configuration (e.g. address information) |
<method name="attach"> <tp:docstring> [attach task sr]: attaches the SR </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="a{ss}" name="device_config" direction="in"> <tp:docstring> Host-local SR configuration (e.g. address information) </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = SR_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.attach ~dbg:"string" ~sr:"string" ~device_config:[ ("string", "string") ];;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module SR_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include SR_skeleton(M) (* ... *) let attach x = let open SR.Attach in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.SR.attach({ dbg: "string", sr: "string", device_config: { "string": "string" } }) print (repr(results))
import xmlrpclib import xcp from storage import * class SR_myimplementation(SR_skeleton): # by default each method will return a Not_implemented error # ... def attach(self, dbg, sr, device_config): """Operations which act on Storage Repositories""" result = {} return result # ...
[detach task sr]: detaches the SR, first detaching and/or deactivating any active VDIs. This may fail with Sr_not_attached, or any error from VDI.detach or VDI.deactivate.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
<method name="detach"> <tp:docstring> [detach task sr]: detaches the SR, first detaching and/or deactivating any active VDIs. This may fail with Sr_not_attached, or any error from VDI.detach or VDI.deactivate. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = SR_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.detach ~dbg:"string" ~sr:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module SR_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include SR_skeleton(M) (* ... *) let detach x = let open SR.Detach in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.SR.detach({ dbg: "string", sr: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class SR_myimplementation(SR_skeleton): # by default each method will return a Not_implemented error # ... def detach(self, dbg, sr): """Operations which act on Storage Repositories""" result = {} return result # ...
[destroy sr]: destroys (i.e. makes unattachable and unprobeable) the [sr], first detaching and/or deactivating any active VDIs. This may fail with Sr_not_attached, or any error from VDI.detach or VDI.deactivate.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
<method name="destroy"> <tp:docstring> [destroy sr]: destroys (i.e. makes unattachable and unprobeable) the [sr], first detaching and/or deactivating any active VDIs. This may fail with Sr_not_attached, or any error from VDI.detach or VDI.deactivate. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = SR_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.destroy ~dbg:"string" ~sr:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module SR_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include SR_skeleton(M) (* ... *) let destroy x = let open SR.Destroy in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.SR.destroy({ dbg: "string", sr: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class SR_myimplementation(SR_skeleton): # by default each method will return a Not_implemented error # ... def destroy(self, dbg, sr): """Operations which act on Storage Repositories""" result = {} return result # ...
[reset task sr]: declares that the SR has been completely reset, e.g. by rebooting the VM hosting the SR backend.
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
<method name="reset"> <tp:docstring> [reset task sr]: declares that the SR has been completely reset, e.g. by rebooting the VM hosting the SR backend. </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = SR_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.reset ~dbg:"string" ~sr:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module SR_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include SR_skeleton(M) (* ... *) let reset x = let open SR.Reset in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.SR.reset({ dbg: "string", sr: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class SR_myimplementation(SR_skeleton): # by default each method will return a Not_implemented error # ... def reset(self, dbg, sr): """Operations which act on Storage Repositories""" result = {} return result # ...
[scan task sr] returns a list of VDIs contained within an attached SR
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
sr
|
in |
string
|
The Storage Repository to operate within |
vdis
|
out |
vdi_info
list
|
List of all the visible VDIs in the SR |
<method name="scan"> <tp:docstring> [scan task sr] returns a list of VDIs contained within an attached SR </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="sr" direction="in"> <tp:docstring> The Storage Repository to operate within </tp:docstring> </arg> <arg type="a(ssssssbssbxxba{ss})" name="vdis" direction="out"> <tp:docstring> List of all the visible VDIs in the SR </tp:docstring> </arg> </method>
(* these directives only needed in a toplevel: *) #require "xcp-api-client";; #require "lwt";; #require "lwt.syntax";; #require "rpc.unix";; open Xcp open Storage open Types module Client = SR_client(struct include Lwt let rpc call = return (Rpc_client.do_rpc ~content_type:`XML ~path:"/" ~host:"127.0.0.1" ~port:80 call) (* TODO: Rpc_client needs to support Lwt *) end) let result = Client.scan ~dbg:"string" ~sr:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Storage open Types module SR_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include SR_skeleton(M) (* ... *) let scan x = let open SR.Scan in return (Result.Ok (Out.([ { vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] }; { vdi = "string"; content_id = "string"; name_label = "string"; name_description = "string"; ty = "string"; metadata_of_pool = "string"; is_a_snapshot = true; snapshot_time = "string"; snapshot_of = "string"; read_only = true; virtual_size = 0L; physical_utilisation = 0L; persistent = true; sm_config = [ ("string", "string") ] } ]))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.SR.scan({ dbg: "string", sr: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class SR_myimplementation(SR_skeleton): # by default each method will return a Not_implemented error # ... def scan(self, dbg, sr): """Operations which act on Storage Repositories""" result = {} result["vdis"] = [ { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } }, { "vdi": "string", "content_id": "string", "name_label": "string", "name_description": "string", "ty": "string", "metadata_of_pool": "string", "is_a_snapshot": True, "snapshot_time": "string", "snapshot_of": "string", "read_only": True, "virtual_size": 0L, "physical_utilisation": 0L, "persistent": True, "sm_config": { "string": "string" } } ] return result # ...
Parameter Types | Description | |
Sr_not_attached
|
string
|
An SR must be attached in order to access VDIs |
Vdi_does_not_exist
|
string
|
The specified VDI could not be found in the SR |
Illegal_transition
|
string * string
|
The requested VDI state transition is invalid |
Backend_error
|
string * string list
|
A backend-specific error occurred |
Unimplemented
|
string
|
The operation has not been implemented |
Does_not_exist
|
string * string
|
The object does not exist |
Cancelled
|
string
|
The task has been asynchronously cancelled |
Redirect
|
string
|
The request should be resent to this address |
Sr_attached
|
string
|
The operation cannot be performed because the SR is still attached |