volume
The xapi toolstack delegates all storage control-plane functions to "Volume plugins".These plugins allow the toolstack to create/destroy/snapshot/clone volumes which are organised into groups called Storage Repositories (SR). Volumes have a set of URIs which can be used by the "Datapath plugins" to connect the disk data to VMs.
type debug_info = string
Debug context from the caller
type key = string
Primary key for a volume. This can be any string which is meaningful to the implementation. For example this could be an NFS filename, an LVM LV name or even a URI. This string is abstract.
type sr = string
Primary key for a specific Storage Repository. This can be any string which is meaningful to the implementation. For example this could be an NFS directory name, an LVM VG name or even a URI. This string is abstract.
type health = variant { ... }
The health status of an SR.
Constructors:
| Name |
Type |
Description |
Healthy |
string |
Storage is fully available |
Recovering |
string |
Storage is busy recovering, e.g. rebuilding mirrors. |
type sr_stat = struct { ... }
A set of high-level properties associated with an SR. These properties can change dynamically and can be queried by a SR.stat call.
Members:
| Name |
Type |
Description |
sr |
sr |
The URI identifying this volume. A typical value would be a file:// URI pointing to a directory or block device. |
name |
string |
Short, human-readable label for the SR. |
description |
string |
Longer, human-readable description of the SR. Descriptions are generally only displayed by clients when the user is examining SRs in detail. |
free_space |
int64 |
Number of bytes free on the backing storage (in bytes) |
total_space |
int64 |
Total physical size of the backing storage (in bytes) |
datasources |
string list |
URIs naming datasources: time-varying quantities representing anything from disk access latency to free space. The entities named by these URIs are self-describing. |
clustered |
bool |
Indicates whether the SR uses clustered local storage. |
health |
health |
The health status of the SR. |
type volume = struct { ... }
A set of properties associated with a volume. These properties can change dynamically and can be queried by the Volume.stat call.
Members:
| Name |
Type |
Description |
key |
key |
A primary key for this volume. The key must be unique within the enclosing Storage Repository (SR). A typical value would be a filename or an LVM volume name. |
uuid |
string option |
A uuid (or guid) for the volume, if one is available. If a storage system has a built-in notion of a guid, then it will be returned here. |
name |
string |
Short, human-readable label for the volume. Names are commonly used by when displaying short lists of volumes. |
description |
string |
Longer, human-readable description of the volume. Descriptions are generally only displayed by clients when the user is examining volumes individually. |
read_write |
bool |
True means the VDI may be written to, false means the volume is read-only. Some storage media is read-only so all volumes are read-only; for example .iso disk images on an NFS share. Some volume are created read-only; for example because they are snapshots of some other VDI. |
virtual_size |
int64 |
Size of the volume from the perspective of a VM (in bytes) |
physical_utilisation |
int64 |
Amount of space currently used on the backing storage (in bytes) |
uri |
string list |
A list of URIs which can be opened and used for I/O. A URI could reference a local block device, a remote NFS share, iSCSI LUN or RBD volume. In cases where the data may be accessed over several protocols, he list should be sorted into descending order of desirability. Xapi will open the most desirable URI for which it has an available datapath plugin. |
keys |
(string * string) list |
A lit of key=value pairs which have been stored in the Volume metadata. These should not be interpreted by the Volume plugin. |
Volume
Operations which operate on volumes (also known as Virtual Disk Images)
create
[create sr name description size] creates a new volume in [sr] with [name] and [description]. The volume will have size >= [size] i.e. it is always permissable for an implementation to round-up the volume to the nearest convenient block size
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
name |
in |
string |
A human-readable name to associate with the new disk. This name is intended to be short, to be a good summary of the disk. |
description |
in |
string |
A human-readable description to associate with the new disk. This can be arbitrarily long, up to the general string size limit. |
size |
in |
int64 |
A minimum size (in bytes) for the disk. Depending on the characteristics of the implementation this may be rounded up to (for example) the nearest convenient block size. The created disk will not be smaller than this size. |
volume |
out |
volume |
Properties of the created volume |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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" ~name:"string" ~description:"string" ~size:0L;;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let create x =
let open Types.Volume.Create in
let open Types in
return (`Ok (Out.({ key = "string"; uuid = Some "string"; name = "string"; description = "string"; read_write = true; virtual_size = 0L; physical_utilisation = 0L; uri = [ "string"; "string" ]; keys = [ ("string", "string") ] })))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.create({ dbg: "string", sr: "string", name: "string", description: "string", size: 0L })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def create(self, dbg, sr, name, description, size):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
result["volume"] = { "key": "string", "uuid": None, "name": "string", "description": "string", "read_write": True, "virtual_size": 0L, "physical_utilisation": 0L, "uri": [ "string", "string" ], "keys": { "string": "string" } }
return result
# ...
snapshot
[snapshot sr volume] creates a new volue which is a snapshot of [volume] in [sr]. Snapshots should never be written to; they are intended for backup/restore only. Note the name and description are copied but any extra metadata associated by [set] is not copied.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
volume |
out |
volume |
Properties of the created volume |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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" ~key:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let snapshot x =
let open Types.Volume.Snapshot in
let open Types in
return (`Ok (Out.({ key = "string"; uuid = Some "string"; name = "string"; description = "string"; read_write = true; virtual_size = 0L; physical_utilisation = 0L; uri = [ "string"; "string" ]; keys = [ ("string", "string") ] })))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.snapshot({ dbg: "string", sr: "string", key: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def snapshot(self, dbg, sr, key):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
result["volume"] = { "key": "string", "uuid": None, "name": "string", "description": "string", "read_write": True, "virtual_size": 0L, "physical_utilisation": 0L, "uri": [ "string", "string" ], "keys": { "string": "string" } }
return result
# ...
clone
[clone sr volume] creates a new volume which is a writable clone of [volume] in [sr]. Note the name and description are copied but any extra metadata associated by [set] is not copied.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
volume |
out |
volume |
Properties of the created volume |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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" ~key:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let clone x =
let open Types.Volume.Clone in
let open Types in
return (`Ok (Out.({ key = "string"; uuid = Some "string"; name = "string"; description = "string"; read_write = true; virtual_size = 0L; physical_utilisation = 0L; uri = [ "string"; "string" ]; keys = [ ("string", "string") ] })))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.clone({ dbg: "string", sr: "string", key: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def clone(self, dbg, sr, key):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
result["volume"] = { "key": "string", "uuid": None, "name": "string", "description": "string", "read_write": True, "virtual_size": 0L, "physical_utilisation": 0L, "uri": [ "string", "string" ], "keys": { "string": "string" } }
return result
# ...
destroy
[destroy sr volume] removes [volume] from [sr]
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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" ~key:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let destroy x =
let open Types.Volume.Destroy in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.destroy({ dbg: "string", sr: "string", key: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def destroy(self, dbg, sr, key):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
return result
# ...
set_name
[set_name sr volume new_name] changes the name of [volume]
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
new_name |
in |
string |
New name |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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_name ~dbg:"string" ~sr:"string" ~key:"string" ~new_name:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let set_name x =
let open Types.Volume.Set_name in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.set_name({ dbg: "string", sr: "string", key: "string", new_name: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def set_name(self, dbg, sr, key, new_name):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
return result
# ...
set_description
[set_description sr volume new_description] changes the description of [volume]
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
new_description |
in |
string |
New description |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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_description ~dbg:"string" ~sr:"string" ~key:"string" ~new_description:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let set_description x =
let open Types.Volume.Set_description in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.set_description({ dbg: "string", sr: "string", key: "string", new_description: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def set_description(self, dbg, sr, key, new_description):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
return result
# ...
set
[set sr volume key value] associates [key] with [value] in the metadata of [volume] Note these keys and values are not interpreted by the plugin; they are intended for the higher-level software only.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
k |
in |
string |
Key |
v |
in |
string |
Value |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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 ~dbg:"string" ~sr:"string" ~key:"string" ~k:"string" ~v:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let set x =
let open Types.Volume.Set in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.set({ dbg: "string", sr: "string", key: "string", k: "string", v: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def set(self, dbg, sr, key, k, v):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
return result
# ...
unset
[unset sr volume key] removes [key] and any value associated with it from the metadata of [volume] Note these keys and values are not interpreted by the plugin; they are intended for the higher-level software only.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
k |
in |
string |
Key |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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.unset ~dbg:"string" ~sr:"string" ~key:"string" ~k:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let unset x =
let open Types.Volume.Unset in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.unset({ dbg: "string", sr: "string", key: "string", k: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def unset(self, dbg, sr, key, k):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
return result
# ...
resize
[resize sr volume new_size] enlarges [volume] to be at least [new_size].
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
new_size |
in |
int64 |
New disk size |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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.resize ~dbg:"string" ~sr:"string" ~key:"string" ~new_size:0L;;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let resize x =
let open Types.Volume.Resize in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.resize({ dbg: "string", sr: "string", key: "string", new_size: 0L })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def resize(self, dbg, sr, key, new_size):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
return result
# ...
stat
[stat sr volume] returns metadata associated with [volume].
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
key |
in |
string |
The volume key |
volume |
out |
volume |
Volume metadata |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
open Types
module Client = Volume_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" ~key:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module Volume_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include Volume_skeleton(M)
(* ... *)
let stat x =
let open Types.Volume.Stat in
let open Types in
return (`Ok (Out.({ key = "string"; uuid = Some "string"; name = "string"; description = "string"; read_write = true; virtual_size = 0L; physical_utilisation = 0L; uri = [ "string"; "string" ]; keys = [ ("string", "string") ] })))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.Volume.stat({ dbg: "string", sr: "string", key: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class Volume_myimplementation(Volume_skeleton):
# by default each method will return a Not_implemented error
# ...
def stat(self, dbg, sr, key):
"""Operations which operate on volumes (also known as Virtual Disk Images)"""
result = {}
result["volume"] = { "key": "string", "uuid": None, "name": "string", "description": "string", "read_write": True, "virtual_size": 0L, "physical_utilisation": 0L, "uri": [ "string", "string" ], "keys": { "string": "string" } }
return result
# ...
SR
Operations which act on Storage Repositories
probe
[probe uri]: looks for existing SRs on the storage device
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
uri |
in |
string |
The Storage Repository URI |
result |
out |
struct { ... } |
Contents of the storage device |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
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.probe ~dbg:"string" ~uri:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module SR_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include SR_skeleton(M)
(* ... *)
let probe x =
let open Types.SR.Probe in
let open Types in
return (`Ok (Out.({ srs = [ { sr = "string"; name = "string"; description = "string"; free_space = 0L; total_space = 0L; datasources = [ "string"; "string" ]; clustered = true; health = Healthy "string" }; { sr = "string"; name = "string"; description = "string"; free_space = 0L; total_space = 0L; datasources = [ "string"; "string" ]; clustered = true; health = Healthy "string" } ]; uris = [ "string"; "string" ] })))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.SR.probe({ dbg: "string", uri: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class SR_myimplementation(SR_skeleton):
# by default each method will return a Not_implemented error
# ...
def probe(self, dbg, uri):
"""Operations which act on Storage Repositories"""
result = {}
result["result"] = { "srs": [ { "sr": "string", "name": "string", "description": "string", "free_space": 0L, "total_space": 0L, "datasources": [ "string", "string" ], "clustered": True, "health": None }, { "sr": "string", "name": "string", "description": "string", "free_space": 0L, "total_space": 0L, "datasources": [ "string", "string" ], "clustered": True, "health": None } ], "uris": [ "string", "string" ] }
return result
# ...
create
[create uri configuration]: creates a fresh SR
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
uri |
in |
string |
The Storage Repository URI |
configuration |
in |
(string * string) list |
Plugin-specific configuration which describes where and how to create the storage repository. This may include the physical block device name, a remote NFS server and path or an RBD storage pool. |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
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" ~uri:"string" ~configuration:[ ("string", "string") ];;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
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 Types.SR.Create in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.SR.create({ dbg: "string", uri: "string", configuration: { "string": "string" } })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class SR_myimplementation(SR_skeleton):
# by default each method will return a Not_implemented error
# ...
def create(self, dbg, uri, configuration):
"""Operations which act on Storage Repositories"""
result = {}
return result
# ...
attach
[attach uri]: attaches the SR to the local host. Once an SR is attached then volumes may be manipulated.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
uri |
in |
string |
The Storage Repository URI |
sr |
out |
string |
The Storage Repository |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
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" ~uri:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
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 Types.SR.Attach in
let open Types in
return (`Ok (Out.("string")))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.SR.attach({ dbg: "string", uri: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class SR_myimplementation(SR_skeleton):
# by default each method will return a Not_implemented error
# ...
def attach(self, dbg, uri):
"""Operations which act on Storage Repositories"""
result = {}
result["sr"] = "string"
return result
# ...
detach
[detach sr]: detaches the SR, clearing up any associated resources. Once the SR is detached then volumes may not be manipulated.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
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";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
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 Types.SR.Detach in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.SR.detach({ dbg: "string", sr: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
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
[destroy sr]: destroys the [sr] and deletes any volumes associated with it. Note that an SR must be attached to be destroyed; otherwise Sr_not_attached is thrown.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
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";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
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 Types.SR.Destroy in
let open Types in
return (`Ok ())
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.SR.destroy({ dbg: "string", sr: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
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
# ...
stat
[stat sr] returns summary metadata associated with [sr]. Note this call does not return details of sub-volumes, see SR.ls.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
sr |
out |
sr_stat |
SR metadata |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
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.stat ~dbg:"string" ~sr:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
module SR_myimplementation = functor(M: M) -> struct
(* by default every operation will return a 'not implemented' exception *)
include SR_skeleton(M)
(* ... *)
let stat x =
let open Types.SR.Stat in
let open Types in
return (`Ok (Out.({ sr = "string"; name = "string"; description = "string"; free_space = 0L; total_space = 0L; datasources = [ "string"; "string" ]; clustered = true; health = Healthy "string" })))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.SR.stat({ dbg: "string", sr: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class SR_myimplementation(SR_skeleton):
# by default each method will return a Not_implemented error
# ...
def stat(self, dbg, sr):
"""Operations which act on Storage Repositories"""
result = {}
result["sr"] = { "sr": "string", "name": "string", "description": "string", "free_space": 0L, "total_space": 0L, "datasources": [ "string", "string" ], "clustered": True, "health": None }
return result
# ...
ls
[ls sr] returns a list of volumes contained within an attached SR.
- Definition
- OCaml example
- Python example
| Name |
Direction |
Type |
Description |
dbg |
in |
debug_info |
Debug context from the caller |
sr |
in |
string |
The Storage Repository |
volumes |
out |
volume list |
List of all the visible volumes in the SR |
Client
(* these directives only needed in a toplevel: *)
#require "xcp-api-client";;
#require "lwt";;
#require "lwt.syntax";;
#require "rpc.unix";;
open S
open Volume
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" ~sr:"string";;
Server
(* this line only needed in a toplevel: *)
#require "xcp-api-client";;
open S
open Volume
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 Types.SR.Ls in
let open Types in
return (`Ok (Out.([ { key = "string"; uuid = Some "string"; name = "string"; description = "string"; read_write = true; virtual_size = 0L; physical_utilisation = 0L; uri = [ "string"; "string" ]; keys = [ ("string", "string") ] }; { key = "string"; uuid = Some "string"; name = "string"; description = "string"; read_write = true; virtual_size = 0L; physical_utilisation = 0L; uri = [ "string"; "string" ]; keys = [ ("string", "string") ] } ])))
(* ... *)
end
Client
import xmlrpclib
import xapi
from storage import *
if __name__ == "__main__":
c = xapi.connect()
results = c.SR.ls({ dbg: "string", sr: "string" })
print (repr(results))
Server
import xmlrpclib
import xapi
from storage import *
class SR_myimplementation(SR_skeleton):
# by default each method will return a Not_implemented error
# ...
def ls(self, dbg, sr):
"""Operations which act on Storage Repositories"""
result = {}
result["volumes"] = [ { "key": "string", "uuid": None, "name": "string", "description": "string", "read_write": True, "virtual_size": 0L, "physical_utilisation": 0L, "uri": [ "string", "string" ], "keys": { "string": "string" } }, { "key": "string", "uuid": None, "name": "string", "description": "string", "read_write": True, "virtual_size": 0L, "physical_utilisation": 0L, "uri": [ "string", "string" ], "keys": { "string": "string" } } ]
return result
# ...
exceptions
| Name |
Type |
Description |
Sr_not_attached |
string |
An SR must be attached in order to access volumes |
SR_does_not_exist |
string |
The specified SR could not be found |
Volume_does_not_exist |
string |
The specified volume could not be found in the SR |
Unimplemented |
string |
The operation has not been implemented |
Cancelled |
string |
The task has been asynchronously cancelled |