The memory management service (also known as "squeezed") shares host memory among running VMs via their balloon drivers. Each VM has an associated memory range (minimum and maximum amount of allocated memory) and the manager attempts to share the host memory fairly.
Debug context from the caller
A reference (or handle) to a memory reservation
A domain id
An amount of memory in KiB
Create and manipulate VM memory reservations
Properties of this service
Members:
Type | Description | |
name
|
string
|
Human-readable name of this service |
vendor
|
string
|
Vendor of this service |
version
|
string
|
Version number of this service |
features
|
string list
|
A set of feature flags |
instance_id
|
string
|
A unique id for this instance, regenerated over service restart |
[reserve kib] reserves [kib] of memory for some undisclosed purpose and returns a reservation id
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
amount
|
in |
kib
|
Amount of memory to reserve on the host |
reservation_id
|
out |
reservation_id
|
A reference to a reservation which can be transferred to a VM |
<method name="reserve"> <tp:docstring> [reserve kib] reserves [kib] of memory for some undisclosed purpose and returns a reservation id </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="x" name="amount" direction="in"> <tp:docstring> Amount of memory to reserve on the host </tp:docstring> </arg> <arg type="s" name="reservation_id" direction="out"> <tp:docstring> A reference to a reservation which can be transferred to a VM </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 Memory open Types module Client = Memory_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.reserve ~dbg:"string" ~amount:0L;;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Memory open Types module Memory_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include Memory_skeleton(M) (* ... *) let reserve x = let open Memory.Reserve in return (Result.Ok (Out.("string"))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.Memory.reserve({ dbg: "string", amount: 0L }) print (repr(results))
import xmlrpclib import xcp from storage import * class Memory_myimplementation(Memory_skeleton): # by default each method will return a Not_implemented error # ... def reserve(self, dbg, amount): """Create and manipulate VM memory reservations""" result = {} result["reservation_id"] = "string" return result # ...
[reserve_range min_kib max_kib] reserves as much as possible between [min_kib] and [max_kib] of memory for some undisclosed purpose and returns a reservation id
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
min
|
in |
kib
|
Minimum amount of memory to reserve on the host |
max
|
in |
kib
|
Maximum amount of memory to reserve on the host |
reservation_id
|
out |
reservation_id
|
A reference to a reservation which can be transferred to a VM |
<method name="reserve_range"> <tp:docstring> [reserve_range min_kib max_kib] reserves as much as possible between [min_kib] and [max_kib] of memory for some undisclosed purpose and returns a reservation id </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="x" name="min" direction="in"> <tp:docstring> Minimum amount of memory to reserve on the host </tp:docstring> </arg> <arg type="x" name="max" direction="in"> <tp:docstring> Maximum amount of memory to reserve on the host </tp:docstring> </arg> <arg type="s" name="reservation_id" direction="out"> <tp:docstring> A reference to a reservation which can be transferred to a VM </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 Memory open Types module Client = Memory_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.reserve_range ~dbg:"string" ~min:0L ~max:0L;;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Memory open Types module Memory_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include Memory_skeleton(M) (* ... *) let reserve_range x = let open Memory.Reserve_range in return (Result.Ok (Out.("string"))) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.Memory.reserve_range({ dbg: "string", min: 0L, max: 0L }) print (repr(results))
import xmlrpclib import xcp from storage import * class Memory_myimplementation(Memory_skeleton): # by default each method will return a Not_implemented error # ... def reserve_range(self, dbg, min, max): """Create and manipulate VM memory reservations""" result = {} result["reservation_id"] = "string" return result # ...
[transfer_to_domain reservation_id domid] transfers the memory reserved by [reservation_id] to domain [domid]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
reservation_id
|
in |
reservation_id
|
A reference to a memory reservation |
domid
|
in |
domid
|
Domain id to transfer the reservation to |
<method name="transfer_to_domain"> <tp:docstring> [transfer_to_domain reservation_id domid] transfers the memory reserved by [reservation_id] to domain [domid] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="reservation_id" direction="in"> <tp:docstring> A reference to a memory reservation </tp:docstring> </arg> <arg type="x" name="domid" direction="in"> <tp:docstring> Domain id to transfer the reservation to </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 Memory open Types module Client = Memory_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.transfer_to_domain ~dbg:"string" ~reservation_id:"string" ~domid:0L;;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Memory open Types module Memory_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include Memory_skeleton(M) (* ... *) let transfer_to_domain x = let open Memory.Transfer_to_domain in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.Memory.transfer_to_domain({ dbg: "string", reservation_id: "string", domid: 0L }) print (repr(results))
import xmlrpclib import xcp from storage import * class Memory_myimplementation(Memory_skeleton): # by default each method will return a Not_implemented error # ... def transfer_to_domain(self, dbg, reservation_id, domid): """Create and manipulate VM memory reservations""" result = {} return result # ...
[delete reservation_id] deletes the reservation identified by [reservation_id]
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
reservation_id
|
in |
reservation_id
|
A reference to a memory reservation |
<method name="delete"> <tp:docstring> [delete reservation_id] deletes the reservation identified by [reservation_id] </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </tp:docstring> </arg> <arg type="s" name="reservation_id" direction="in"> <tp:docstring> A reference to a memory reservation </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 Memory open Types module Client = Memory_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.delete ~dbg:"string" ~reservation_id:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Memory open Types module Memory_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include Memory_skeleton(M) (* ... *) let delete x = let open Memory.Delete in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.Memory.delete({ dbg: "string", reservation_id: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class Memory_myimplementation(Memory_skeleton): # by default each method will return a Not_implemented error # ... def delete(self, dbg, reservation_id): """Create and manipulate VM memory reservations""" result = {} return result # ...
Rebalance memory allocations between domains
Direction | Type | Description | |
dbg
|
in |
debug_info
|
Debug context from the caller |
<method name="balance"> <tp:docstring> Rebalance memory allocations between domains </tp:docstring> <arg type="s" name="dbg" direction="in"> <tp:docstring> Debug context from the caller </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 Memory open Types module Client = Memory_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.balance ~dbg:"string";;
(* this line only needed in a toplevel: *) #require "xcp-api-client";; open Xcp open Memory open Types module Memory_myimplementation = functor(M: M) -> struct (* by default every operation will return a 'not implemented' exception *) include Memory_skeleton(M) (* ... *) let balance x = let open Memory.Balance in return (Result.Ok ()) (* ... *) end
import xmlrpclib import xcp from storage import * if __name__ == "__main__": c = xcp.connect() results = c.Memory.balance({ dbg: "string" }) print (repr(results))
import xmlrpclib import xcp from storage import * class Memory_myimplementation(Memory_skeleton): # by default each method will return a Not_implemented error # ... def balance(self, dbg): """Create and manipulate VM memory reservations""" result = {} return result # ...
Parameter Types | Description |