Wrap the virConnectGetDomainCapabilities C API. Signed-off-by: Pino Toscano <ptoscano@xxxxxxxxxx> --- libvirt/libvirt.ml | 2 ++ libvirt/libvirt.mli | 16 ++++++++++++++++ libvirt/libvirt_c_oneoffs.c | 16 ++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/libvirt/libvirt.ml b/libvirt/libvirt.ml index 49ccc3e..c7c5ffc 100644 --- a/libvirt/libvirt.ml +++ b/libvirt/libvirt.ml @@ -138,6 +138,8 @@ struct cb = _call_auth_default_callback; } + external get_domain_capabilities : ?emulatorbin:string -> ?arch:string -> ?machine:string -> ?virttype:string -> [>`R] t -> string = "ocaml_libvirt_connect_get_domain_capabilities" + external const : [>`R] t -> ro t = "%identity" end diff --git a/libvirt/libvirt.mli b/libvirt/libvirt.mli index 0bd3d05..7448722 100644 --- a/libvirt/libvirt.mli +++ b/libvirt/libvirt.mli @@ -456,6 +456,22 @@ sig of libvirt. *) + val get_domain_capabilities : ?emulatorbin:string -> ?arch:string -> ?machine:string -> ?virttype:string -> [>`R] t -> string + (** [get_domain_capabilities ()] returns the XML with the + available capabilities of the emulator or libvirt for domains. + + The optional flag [?emulatorbin] is used to specify a different + emulator. + + The optional flag [?arch] is used to specify a different + architecture. + + The optional flag [?machine] is used to specify a different + machine type. + + The optional flag [?virttype] is used to specify a different + type of virtualization. *) + external const : [>`R] t -> ro t = "%identity" (** [const conn] turns a read/write connection into a read-only connection. Note that the opposite operation is impossible. diff --git a/libvirt/libvirt_c_oneoffs.c b/libvirt/libvirt_c_oneoffs.c index 71ca78e..0a9e485 100644 --- a/libvirt/libvirt_c_oneoffs.c +++ b/libvirt/libvirt_c_oneoffs.c @@ -419,6 +419,22 @@ ocaml_libvirt_connect_call_auth_default_callback (value listv) CAMLreturn (retv); } +CAMLprim value +ocaml_libvirt_connect_get_domain_capabilities (value emulatorbinv, value archv, value machinev, value virttypev, value connv) +{ + CAMLparam5 (emulatorbinv, archv, machinev, virttypev, connv); + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *r; + + NONBLOCKING (r = virConnectGetDomainCapabilities (conn, Optstring_val (emulatorbinv), Optstring_val (archv), Optstring_val (machinev), Optstring_val (virttypev), 0)); + CHECK_ERROR (r == NULL, "virConnectGetDomainCapabilities"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + CAMLprim value ocaml_libvirt_domain_get_id (value domv) { -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list