/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Define to 1 if you have the `virConnectDiscoverStoragePools' function. */
-#undef HAVE_VIRCONNECTDISCOVERSTORAGEPOOLS
-
/* Define to 1 if you have the `virConnectGetHostname' function. */
#undef HAVE_VIRCONNECTGETHOSTNAME
/* Define to 1 if you have the `virDomainBlockStats' function. */
#undef HAVE_VIRDOMAINBLOCKSTATS
-/* Define to 1 if you have the `virDomainCoreDumpJob' function. */
-#undef HAVE_VIRDOMAINCOREDUMPJOB
-
-/* Define to 1 if you have the `virDomainCreateJob' function. */
-#undef HAVE_VIRDOMAINCREATEJOB
-
-/* Define to 1 if you have the `virDomainCreateLinuxJob' function. */
-#undef HAVE_VIRDOMAINCREATELINUXJOB
-
/* Define to 1 if you have the `virDomainGetSchedulerParameters' function. */
#undef HAVE_VIRDOMAINGETSCHEDULERPARAMETERS
/* Define to 1 if you have the `virDomainMigrate' function. */
#undef HAVE_VIRDOMAINMIGRATE
-/* Define to 1 if you have the `virDomainRestoreJob' function. */
-#undef HAVE_VIRDOMAINRESTOREJOB
-
-/* Define to 1 if you have the `virDomainSaveJob' function. */
-#undef HAVE_VIRDOMAINSAVEJOB
-
/* Define to 1 if you have the `virDomainSetSchedulerParameters' function. */
#undef HAVE_VIRDOMAINSETSCHEDULERPARAMETERS
-/* Define to 1 if you have the `virJobCancel' function. */
-#undef HAVE_VIRJOBCANCEL
-
-/* Define to 1 if you have the `virJobFree' function. */
-#undef HAVE_VIRJOBFREE
-
-/* Define to 1 if you have the `virJobGetDomain' function. */
-#undef HAVE_VIRJOBGETDOMAIN
-
-/* Define to 1 if you have the `virJobGetInfo' function. */
-#undef HAVE_VIRJOBGETINFO
-
-/* Define to 1 if you have the `virJobGetNetwork' function. */
-#undef HAVE_VIRJOBGETNETWORK
-
/* Define to 1 if the system has the type `virJobPtr'. */
#undef HAVE_VIRJOBPTR
-/* Define to 1 if you have the `virNetworkCreateJob' function. */
-#undef HAVE_VIRNETWORKCREATEJOB
-
-/* Define to 1 if you have the `virNetworkCreateXMLJob' function. */
-#undef HAVE_VIRNETWORKCREATEXMLJOB
-
/* Define to 1 if you have the `virNodeGetCellsFreeMemory' function. */
#undef HAVE_VIRNODEGETCELLSFREEMEMORY
/* Define to 1 if you have the `virNodeGetFreeMemory' function. */
#undef HAVE_VIRNODEGETFREEMEMORY
+/* Define to 1 if you have the `virStoragePoolBuild' function. */
+#undef HAVE_VIRSTORAGEPOOLBUILD
+
/* Define to 1 if you have the `virStoragePoolCreate' function. */
#undef HAVE_VIRSTORAGEPOOLCREATE
/* Define to 1 if you have the `virStoragePoolDefineXML' function. */
#undef HAVE_VIRSTORAGEPOOLDEFINEXML
+/* Define to 1 if you have the `virStoragePoolDelete' function. */
+#undef HAVE_VIRSTORAGEPOOLDELETE
+
/* Define to 1 if you have the `virStoragePoolDestroy' function. */
#undef HAVE_VIRSTORAGEPOOLDESTROY
/* Define to 1 if you have the `virStoragePoolSetAutostart' function. */
#undef HAVE_VIRSTORAGEPOOLSETAUTOSTART
-/* Define to 1 if you have the `virStoragePoolShutdown' function. */
-#undef HAVE_VIRSTORAGEPOOLSHUTDOWN
-
/* Define to 1 if you have the `virStoragePoolUndefine' function. */
#undef HAVE_VIRSTORAGEPOOLUNDEFINE
/* Define to 1 if you have the `virStorageVolCreateXML' function. */
#undef HAVE_VIRSTORAGEVOLCREATEXML
-/* Define to 1 if you have the `virStorageVolDestroy' function. */
-#undef HAVE_VIRSTORAGEVOLDESTROY
+/* Define to 1 if you have the `virStorageVolDelete' function. */
+#undef HAVE_VIRSTORAGEVOLDELETE
/* Define to 1 if you have the `virStorageVolFree' function. */
#undef HAVE_VIRSTORAGEVOLFREE
virDomainSetSchedulerParameters \
virNodeGetFreeMemory \
virNodeGetCellsFreeMemory \
- virJobGetInfo \
- virJobGetDomain \
- virJobGetNetwork \
- virJobCancel \
- virJobFree \
- virDomainCreateLinuxJob \
- virDomainSaveJob \
- virDomainRestoreJob \
- virDomainCoreDumpJob \
- virDomainCreateJob \
- virNetworkCreateXMLJob \
- virNetworkCreateJob \
virStoragePoolGetConnect \
virConnectNumOfStoragePools \
virConnectListStoragePools \
virConnectNumOfDefinedStoragePools \
virConnectListDefinedStoragePools \
- virConnectDiscoverStoragePools \
virStoragePoolLookupByName \
virStoragePoolLookupByUUID \
virStoragePoolLookupByUUIDString \
virStoragePoolLookupByVolume \
virStoragePoolCreateXML \
virStoragePoolDefineXML \
+ virStoragePoolBuild \
virStoragePoolUndefine \
virStoragePoolCreate \
virStoragePoolDestroy \
- virStoragePoolShutdown \
+ virStoragePoolDelete \
virStoragePoolFree \
virStoragePoolRefresh \
virStoragePoolGetName \
virStorageVolGetName \
virStorageVolGetKey \
virStorageVolCreateXML \
- virStorageVolDestroy \
+ virStorageVolDelete \
virStorageVolFree \
virStorageVolGetInfo \
virStorageVolGetXMLDesc \
virStorageVolGetPath \
])
+# This jobs API was never published and is due to get overhauled
+# in the near future:
+# virJobGetInfo
+# virJobGetDomain
+# virJobGetNetwork
+# virJobCancel
+# virJobFree
+# virDomainCreateLinuxJob
+# virDomainSaveJob
+# virDomainRestoreJob
+# virDomainCoreDumpJob
+# virDomainCreateJob
+# virNetworkCreateXMLJob
+# virNetworkCreateJob
+
dnl Check for optional types added since 0.2.1.
AC_CHECK_TYPES([virJobPtr, virStoragePoolPtr, virStorageVolPtr],,,
[#include <libvirt/libvirt.h>])
{ name => "virStoragePoolGetName",
sig => "pool : static string", weak => 1 },
{ name => "virStoragePoolGetXMLDesc",
- sig => "pool, 0 : string", weak => 1 },
+ sig => "pool, 0U : string", weak => 1 },
{ name => "virStoragePoolGetUUID",
sig => "pool : uuid", weak => 1 },
{ name => "virStoragePoolGetUUIDString",
sig => "pool : uuid string", weak => 1 },
{ name => "virStoragePoolCreateXML",
- sig => "conn, string : pool", weak => 1 },
+ sig => "conn, string, 0U : pool", weak => 1 },
{ name => "virStoragePoolDefineXML",
- sig => "conn, string : pool", weak => 1 },
+ sig => "conn, string, 0U : pool", weak => 1 },
+ { name => "virStoragePoolBuild",
+ sig => "pool, uint : unit", weak => 1 },
{ name => "virStoragePoolUndefine",
sig => "pool : unit", weak => 1 },
{ name => "virStoragePoolCreate",
- sig => "pool : unit", weak => 1 },
- { name => "virStoragePoolShutdown",
- sig => "pool : unit", weak => 1 },
+ sig => "pool, 0U : unit", weak => 1 },
+ { name => "virStoragePoolDelete",
+ sig => "pool, uint : unit", weak => 1 },
{ name => "virStoragePoolRefresh",
sig => "pool, 0U : unit", weak => 1 },
{ name => "virStoragePoolGetAutostart",
sig => "pool : bool", weak => 1 },
{ name => "virStoragePoolSetAutostart",
sig => "pool, bool : unit", weak => 1 },
+ { name => "virStoragePoolNumOfVolumes",
+ sig => "pool : int", weak => 1 },
+ { name => "virStoragePoolListVolumes",
+ sig => "pool, int : string array", weak => 1 },
{ name => "virStorageVolFree", sig => "vol : free", weak => 1 },
- { name => "virStorageVolDestroy", sig => "vol : free", weak => 1 },
+ { name => "virStorageVolDelete",
+ sig => "vol, uint : unit", weak => 1 },
{ name => "virStorageVolLookupByName",
sig => "pool, string : vol from pool", weak => 1 },
{ name => "virStorageVolLookupByKey",
{ name => "virStorageVolLookupByPath",
sig => "conn, string : vol", weak => 1 },
{ name => "virStorageVolCreateXML",
- sig => "pool, string, 0 : vol from pool", weak => 1 },
+ sig => "pool, string, 0U : vol from pool", weak => 1 },
{ name => "virStorageVolGetXMLDesc",
- sig => "vol, 0 : string", weak => 1 },
+ sig => "vol, 0U : string", weak => 1 },
{ name => "virStorageVolGetPath",
sig => "vol : string", weak => 1 },
{ name => "virStorageVolGetKey",
"int $c_name ($c_type $1, int b)"
} elsif ($sig eq "conn, int : int array") {
"int $c_name (virConnectPtr conn, int *ids, int maxids)"
- } elsif ($sig eq "conn, int : string array") {
- "int $c_name (virConnectPtr conn, char **const names, int maxnames)"
+ } elsif ($sig =~ /^(\w+), int : string array$/) {
+ my $c_type = short_name_to_c_type ($1);
+ "int $c_name ($c_type $1, char **const names, int maxnames)"
} elsif ($sig =~ /^(\w+), 0(U?) : string$/) {
my $c_type = short_name_to_c_type ($1);
my $unsigned = $2 eq "U" ? "unsigned " : "";
} elsif ($sig =~ /^(\w+), string, 0(U?) : unit$/) {
my $c_type = short_name_to_c_type ($1);
my $unsigned = $2 eq "U" ? "unsigned " : "";
- "int $c_name ($c_type $1, const char *str, $unsigned int flags)"
+ "int $c_name ($c_type $1, const char *str, ${unsigned}int flags)"
} elsif ($sig =~ /^(\w+), string : (\w+)$/) {
my $c_type = short_name_to_c_type ($1);
my $c_ret_type = short_name_to_c_type ($2);
my $c_type = short_name_to_c_type ($1);
my $unsigned = $2 eq "U" ? "unsigned " : "";
my $c_ret_type = short_name_to_c_type ($3);
- "$c_ret_type $c_name ($c_type $1, const char *str, $unsigned int flags)"
- } elsif ($sig =~ /^(\w+), int : (\w+)$/) {
+ "$c_ret_type $c_name ($c_type $1, const char *str, ${unsigned}int flags)"
+ } elsif ($sig =~ /^(\w+), (u?)int : unit$/) {
my $c_type = short_name_to_c_type ($1);
- my $c_ret_type = short_name_to_c_type ($2);
- "$c_ret_type $c_name ($c_type $1, int i)"
+ my $unsigned = $2 eq "u" ? "unsigned " : "";
+ "int $c_name ($c_type $1, ${unsigned}int i)"
+ } elsif ($sig =~ /^(\w+), (u?)int : (\w+)$/) {
+ my $c_type = short_name_to_c_type ($1);
+ my $unsigned = $2 eq "u" ? "unsigned " : "";
+ my $c_ret_type = short_name_to_c_type ($3);
+ "$c_ret_type $c_name ($c_type $1, ${unsigned}int i)"
} elsif ($sig =~ /^(\w+), uuid : (\w+)$/) {
my $c_type = short_name_to_c_type ($1);
my $c_ret_type = short_name_to_c_type ($2);
( "$1v", "bv" )
} elsif ($sig eq "conn, int : int array") {
( "connv", "iv" )
- } elsif ($sig eq "conn, int : string array") {
- ( "connv", "iv" )
+ } elsif ($sig =~ /^(\w+), int : string array$/) {
+ ( "$1v", "iv" )
} elsif ($sig =~ /^(\w+), 0U? : string$/) {
( "$1v" )
} elsif ($sig =~ /^(\w+), 0U? : unit$/) {
( "$1v", "strv" )
} elsif ($sig =~ /^(\w+), string, 0U? : (\w+)$/) {
( "$1v", "strv" )
- } elsif ($sig =~ /^(\w+), int : (\w+)$/) {
+ } elsif ($sig =~ /^(\w+), u?int : (\w+)$/) {
( "$1v", "iv" )
} elsif ($sig =~ /^(\w+), uuid : (\w+)$/) {
( "$1v", "uuidv" )
CAMLreturn (rv);
"
- } elsif ($sig eq "conn, int : string array") {
+ } elsif ($sig =~ /^(\w+), int : string array$/) {
"\
CAMLlocal2 (rv, strv);
- virConnectPtr conn = Connect_val (connv);
+ " . gen_unpack_args ($1) . "
int i = Int_val (iv);
char *names[i];
int r;
- NONBLOCKING (r = $c_name (conn, names, i));
+ NONBLOCKING (r = $c_name ($1, names, i));
CHECK_ERROR (r == -1, conn, \"$c_name\");
rv = caml_alloc (r, 0);
"
} elsif ($sig =~ /^(\w+), string : unit$/) {
"\
- CAMLlocal1 (rv);
" . gen_unpack_args ($1) . "
char *str = String_val (strv);
int r;
CAMLreturn (rv);
"
- } elsif ($sig =~ /^(\w+), int : (\w+)$/) {
- my $c_ret_type = short_name_to_c_type ($2);
+ } elsif ($sig =~ /^(\w+), (u?)int : unit$/) {
+ my $unsigned = $2 eq "u" ? "unsigned " : "";
+ "\
+ " . gen_unpack_args ($1) . "
+ ${unsigned}int i = Int_val (iv);
+ int r;
+
+ NONBLOCKING (r = $c_name ($1, i));
+ CHECK_ERROR (!r, conn, \"$c_name\");
+
+ CAMLreturn (Val_unit);
+"
+ } elsif ($sig =~ /^(\w+), (u?)int : (\w+)$/) {
+ my $c_ret_type = short_name_to_c_type ($3);
+ my $unsigned = $2 eq "u" ? "unsigned " : "";
"\
CAMLlocal1 (rv);
" . gen_unpack_args ($1) . "
- int i = Int_val (iv);
+ ${unsigned}int i = Int_val (iv);
$c_ret_type r;
NONBLOCKING (r = $c_name ($1, i));
CHECK_ERROR (!r, conn, \"$c_name\");
- " . gen_pack_result ($2) . "
+ " . gen_pack_result ($3) . "
CAMLreturn (rv);
"
my $is_weak = $function->{weak};
my $sig = $function->{sig};
- my $is_pool_func = $c_name =~ /^virStoragePool/;
- my $is_vol_func = $c_name =~ /^virStorageVol/;
+ #print "generating $c_name with sig \"$sig\" ...\n";
+
+ #my $is_pool_func = $c_name =~ /^virStoragePool/;
+ #my $is_vol_func = $c_name =~ /^virStorageVol/;
# Generate an equivalent C-external name for the function, unless
# one is defined already.
module Pool =
struct
type 'rw t
- type pool_state = Inactive | Active
+ type pool_state = Inactive | Building | Running | Degraded
+ type pool_build_flags = New | Repair | Resize
+ type pool_delete_flags = Normal | Zeroed
type pool_info = {
state : pool_state;
capacity : int64;
allocation : int64;
+ available : int64;
}
external lookup_by_name : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_storage_pool_lookup_by_name"
external lookup_by_uuid_string : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_storage_pool_lookup_by_uuid_string"
external create_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_storage_pool_create_xml"
external define_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_storage_pool_define_xml"
+ external build : [>`W] t -> pool_build_flags -> unit = "ocaml_libvirt_storage_pool_build"
external undefine : [>`W] t -> unit = "ocaml_libvirt_storage_pool_undefine"
external create : [>`W] t -> unit = "ocaml_libvirt_storage_pool_create"
external destroy : [>`W] t -> unit = "ocaml_libvirt_storage_pool_destroy"
- external shutdown : [>`W] t -> unit = "ocaml_libvirt_storage_pool_shutdown"
+ external delete : [>`W] t -> unit = "ocaml_libvirt_storage_pool_delete"
external free : [>`R] t -> unit = "ocaml_libvirt_storage_pool_free"
external refresh : [`R] t -> unit = "ocaml_libvirt_storage_pool_refresh"
external get_name : [`R] t -> string = "ocaml_libvirt_storage_pool_get_name"
external get_xml_desc : [`R] t -> xml = "ocaml_libvirt_storage_pool_get_xml_desc"
external get_autostart : [`R] t -> bool = "ocaml_libvirt_storage_pool_get_autostart"
external set_autostart : [`W] t -> bool -> unit = "ocaml_libvirt_storage_pool_set_autostart"
+ external num_of_volumes : [`R] t -> int = "ocaml_libvirt_storage_pool_num_of_volumes"
+ external list_volumes : [`R] t -> int -> string array = "ocaml_libvirt_storage_pool_list_volumes"
external const : [>`R] t -> ro t = "%identity"
end
module Volume =
struct
type 'rw t
- type vol_type = File | Block | Virtual
+ type vol_type = File | Block
+ type vol_delete_flags = Normal | Zeroed
type vol_info = {
typ : vol_type;
capacity : int64;
external get_info : [`R] t -> vol_info = "ocaml_libvirt_storage_vol_get_info"
external get_xml_desc : [`R] t -> xml = "ocaml_libvirt_storage_vol_get_xml_desc"
external create_xml : [`W] Pool.t -> xml -> unit = "ocaml_libvirt_storage_vol_create_xml"
- external destroy : [`W] t -> unit = "ocaml_libvirt_storage_vol_destroy"
+ external delete : [`W] t -> unit = "ocaml_libvirt_storage_vol_delete"
external free : [>`R] t -> unit = "ocaml_libvirt_storage_vol_free"
external const : [>`R] t -> ro t = "%identity"
end
type 'rw t
(** Storage pool handle. *)
- type pool_state = Inactive | Active
+ type pool_state = Inactive | Building | Running | Degraded
(** State of the storage pool. *)
+ type pool_build_flags = New | Repair | Resize
+ (** Flags for creating a storage pool. *)
+
+ type pool_delete_flags = Normal | Zeroed
+ (** Flags for deleting a storage pool. *)
+
type pool_info = {
- state : pool_state; (** Inactive | Active *)
+ state : pool_state; (** Pool state. *)
capacity : int64; (** Logical size in bytes. *)
allocation : int64; (** Currently allocated in bytes. *)
+ available : int64; (** Remaining free space bytes. *)
}
val lookup_by_name : 'a Connect.t -> string -> 'a t
(** Create a storage pool. *)
val define_xml : [>`W] Connect.t -> xml -> rw t
(** Define but don't activate a storage pool. *)
+ val build : [>`W] t -> pool_build_flags -> unit
+ (** Build a storage pool. *)
val undefine : [>`W] t -> unit
(** Undefine configuration of a storage pool. *)
val create : [>`W] t -> unit
(** Start up a defined (inactive) storage pool. *)
val destroy : [>`W] t -> unit
(** Destroy a storage pool. *)
- val shutdown : [>`W] t -> unit
- (** Shutdown a storage pool. *)
+ val delete : [>`W] t -> unit
+ (** Delete a storage pool. *)
val free : [>`R] t -> unit
(** Free a storage pool object in memory.
val set_autostart : [`W] t -> bool -> unit
(** Set the autostart flag for the storage pool. *)
+ val num_of_volumes : [`R] t -> int
+ (** Returns the number of storage volumes within the storage pool. *)
+ val list_volumes : [`R] t -> int -> string array
+ (** Return list of storage volumes. *)
+
external const : [>`R] t -> ro t = "%identity"
(** [const conn] turns a read/write storage pool into a read-only
pool. Note that the opposite operation is impossible.
type 'rw t
(** Storage volume handle. *)
- type vol_type = File | Block | Virtual
+ type vol_type = File | Block
(** Type of a storage volume. *)
+ type vol_delete_flags = Normal | Zeroed
+ (** Flags for deleting a storage volume. *)
+
type vol_info = {
typ : vol_type; (** Type of storage volume. *)
capacity : int64; (** Logical size in bytes. *)
val create_xml : [`W] Pool.t -> xml -> unit
(** Create a storage volume. *)
- val destroy : [`W] t -> unit
- (** Destroy a storage volume. *)
+ val delete : [`W] t -> unit
+ (** Delete a storage volume. *)
val free : [>`R] t -> unit
(** Free a storage volume object in memory.
#ifdef HAVE_WEAK_SYMBOLS
#ifdef HAVE_VIRDOMAINCREATELINUXJOB
-extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
+extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
#endif
#endif
{
CAMLparam2 (domv, strv);
- CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
virConnectPtr conn = Connect_domv (domv);
char *str = String_val (strv);
{
CAMLparam2 (connv, strv);
- CAMLlocal1 (rv);
virConnectPtr conn = Connect_val (connv);
char *str = String_val (strv);
int r;
{
CAMLparam2 (domv, strv);
- CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
virConnectPtr conn = Connect_domv (domv);
char *str = String_val (strv);
{
CAMLparam2 (domv, strv);
- CAMLlocal1 (rv);
virDomainPtr dom = Domain_val (domv);
virConnectPtr conn = Connect_domv (domv);
char *str = String_val (strv);
}
/* Automatically generated binding for virStoragePoolGetXMLDesc.
- * In generator.pl this function has signature "pool, 0 : string".
+ * In generator.pl this function has signature "pool, 0U : string".
*/
#ifdef HAVE_WEAK_SYMBOLS
#ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
-extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak));
+extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
#endif
#endif
}
/* Automatically generated binding for virStoragePoolCreateXML.
- * In generator.pl this function has signature "conn, string : pool".
+ * In generator.pl this function has signature "conn, string, 0U : pool".
*/
#ifdef HAVE_WEAK_SYMBOLS
#ifdef HAVE_VIRSTORAGEPOOLCREATEXML
-extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str) __attribute__((weak));
+extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
#endif
#endif
char *str = String_val (strv);
virStoragePoolPtr r;
- NONBLOCKING (r = virStoragePoolCreateXML (conn, str));
+ NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0));
CHECK_ERROR (!r, conn, "virStoragePoolCreateXML");
rv = Val_pool (r, connv);
}
/* Automatically generated binding for virStoragePoolDefineXML.
- * In generator.pl this function has signature "conn, string : pool".
+ * In generator.pl this function has signature "conn, string, 0U : pool".
*/
#ifdef HAVE_WEAK_SYMBOLS
#ifdef HAVE_VIRSTORAGEPOOLDEFINEXML
-extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str) __attribute__((weak));
+extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
#endif
#endif
char *str = String_val (strv);
virStoragePoolPtr r;
- NONBLOCKING (r = virStoragePoolDefineXML (conn, str));
+ NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0));
CHECK_ERROR (!r, conn, "virStoragePoolDefineXML");
rv = Val_pool (r, connv);
#endif
}
+/* Automatically generated binding for virStoragePoolBuild.
+ * In generator.pl this function has signature "pool, uint : unit".
+ */
+
+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRSTORAGEPOOLBUILD
+extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_build (value poolv, value iv)
+{
+ CAMLparam2 (poolv, iv);
+#ifndef HAVE_VIRSTORAGEPOOLBUILD
+ /* Symbol virStoragePoolBuild not found at compile time. */
+ not_supported ("virStoragePoolBuild");
+ /* Suppresses a compiler warning. */
+ (void) caml__frame;
+#else
+ /* Check that the symbol virStoragePoolBuild
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStoragePoolBuild);
+
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ unsigned int i = Int_val (iv);
+ int r;
+
+ NONBLOCKING (r = virStoragePoolBuild (pool, i));
+ CHECK_ERROR (!r, conn, "virStoragePoolBuild");
+
+ CAMLreturn (Val_unit);
+#endif
+}
+
/* Automatically generated binding for virStoragePoolUndefine.
* In generator.pl this function has signature "pool : unit".
*/
}
/* Automatically generated binding for virStoragePoolCreate.
- * In generator.pl this function has signature "pool : unit".
+ * In generator.pl this function has signature "pool, 0U : unit".
*/
#ifdef HAVE_WEAK_SYMBOLS
#ifdef HAVE_VIRSTORAGEPOOLCREATE
-extern int virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak));
+extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
#endif
#endif
virConnectPtr conn = Connect_polv (poolv);
int r;
- NONBLOCKING (r = virStoragePoolCreate (pool));
+ NONBLOCKING (r = virStoragePoolCreate (pool, 0));
CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
CAMLreturn (Val_unit);
#endif
}
-/* Automatically generated binding for virStoragePoolShutdown.
- * In generator.pl this function has signature "pool : unit".
+/* Automatically generated binding for virStoragePoolDelete.
+ * In generator.pl this function has signature "pool, uint : unit".
*/
#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN
-extern int virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak));
+#ifdef HAVE_VIRSTORAGEPOOLDELETE
+extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
#endif
#endif
CAMLprim value
-ocaml_libvirt_storage_pool_shutdown (value poolv)
+ocaml_libvirt_storage_pool_delete (value poolv, value iv)
{
- CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLSHUTDOWN
- /* Symbol virStoragePoolShutdown not found at compile time. */
- not_supported ("virStoragePoolShutdown");
+ CAMLparam2 (poolv, iv);
+#ifndef HAVE_VIRSTORAGEPOOLDELETE
+ /* Symbol virStoragePoolDelete not found at compile time. */
+ not_supported ("virStoragePoolDelete");
/* Suppresses a compiler warning. */
(void) caml__frame;
#else
- /* Check that the symbol virStoragePoolShutdown
+ /* Check that the symbol virStoragePoolDelete
* is in runtime version of libvirt.
*/
- WEAK_SYMBOL_CHECK (virStoragePoolShutdown);
+ WEAK_SYMBOL_CHECK (virStoragePoolDelete);
virStoragePoolPtr pool = Pool_val (poolv);
virConnectPtr conn = Connect_polv (poolv);
+ unsigned int i = Int_val (iv);
int r;
- NONBLOCKING (r = virStoragePoolShutdown (pool));
- CHECK_ERROR (r == -1, conn, "virStoragePoolShutdown");
+ NONBLOCKING (r = virStoragePoolDelete (pool, i));
+ CHECK_ERROR (!r, conn, "virStoragePoolDelete");
CAMLreturn (Val_unit);
#endif
#endif
}
+/* Automatically generated binding for virStoragePoolNumOfVolumes.
+ * In generator.pl this function has signature "pool : int".
+ */
+
+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
+extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_num_of_volumes (value poolv)
+{
+ CAMLparam1 (poolv);
+#ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
+ /* Symbol virStoragePoolNumOfVolumes not found at compile time. */
+ not_supported ("virStoragePoolNumOfVolumes");
+ /* Suppresses a compiler warning. */
+ (void) caml__frame;
+#else
+ /* Check that the symbol virStoragePoolNumOfVolumes
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes);
+
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ int r;
+
+ NONBLOCKING (r = virStoragePoolNumOfVolumes (pool));
+ CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes");
+
+ CAMLreturn (Val_int (r));
+#endif
+}
+
+/* Automatically generated binding for virStoragePoolListVolumes.
+ * In generator.pl this function has signature "pool, int : string array".
+ */
+
+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES
+extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
+{
+ CAMLparam2 (poolv, iv);
+#ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES
+ /* Symbol virStoragePoolListVolumes not found at compile time. */
+ not_supported ("virStoragePoolListVolumes");
+ /* Suppresses a compiler warning. */
+ (void) caml__frame;
+#else
+ /* Check that the symbol virStoragePoolListVolumes
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStoragePoolListVolumes);
+
+ CAMLlocal2 (rv, strv);
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ int i = Int_val (iv);
+ char *names[i];
+ int r;
+
+ NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i));
+ CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");
+
+ rv = caml_alloc (r, 0);
+ for (i = 0; i < r; ++i) {
+ strv = caml_copy_string (names[i]);
+ Store_field (rv, i, strv);
+ free (names[i]);
+ }
+
+ CAMLreturn (rv);
+#endif
+}
+
/* Automatically generated binding for virStorageVolFree.
* In generator.pl this function has signature "vol : free".
*/
#endif
}
-/* Automatically generated binding for virStorageVolDestroy.
- * In generator.pl this function has signature "vol : free".
+/* Automatically generated binding for virStorageVolDelete.
+ * In generator.pl this function has signature "vol, uint : unit".
*/
#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLDESTROY
-extern int virStorageVolDestroy (virStorageVolPtr vol) __attribute__((weak));
+#ifdef HAVE_VIRSTORAGEVOLDELETE
+extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak));
#endif
#endif
CAMLprim value
-ocaml_libvirt_storage_vol_destroy (value volv)
+ocaml_libvirt_storage_vol_delete (value volv, value iv)
{
- CAMLparam1 (volv);
-#ifndef HAVE_VIRSTORAGEVOLDESTROY
- /* Symbol virStorageVolDestroy not found at compile time. */
- not_supported ("virStorageVolDestroy");
+ CAMLparam2 (volv, iv);
+#ifndef HAVE_VIRSTORAGEVOLDELETE
+ /* Symbol virStorageVolDelete not found at compile time. */
+ not_supported ("virStorageVolDelete");
/* Suppresses a compiler warning. */
(void) caml__frame;
#else
- /* Check that the symbol virStorageVolDestroy
+ /* Check that the symbol virStorageVolDelete
* is in runtime version of libvirt.
*/
- WEAK_SYMBOL_CHECK (virStorageVolDestroy);
+ WEAK_SYMBOL_CHECK (virStorageVolDelete);
virStorageVolPtr vol = Volume_val (volv);
virConnectPtr conn = Connect_volv (volv);
+ unsigned int i = Int_val (iv);
int r;
- NONBLOCKING (r = virStorageVolDestroy (vol));
- CHECK_ERROR (r == -1, conn, "virStorageVolDestroy");
-
- /* So that we don't double-free in the finalizer: */
- Volume_val (volv) = NULL;
+ NONBLOCKING (r = virStorageVolDelete (vol, i));
+ CHECK_ERROR (!r, conn, "virStorageVolDelete");
CAMLreturn (Val_unit);
#endif
}
/* Automatically generated binding for virStorageVolCreateXML.
- * In generator.pl this function has signature "pool, string, 0 : vol from pool".
+ * In generator.pl this function has signature "pool, string, 0U : vol from pool".
*/
#ifdef HAVE_WEAK_SYMBOLS
#ifdef HAVE_VIRSTORAGEVOLCREATEXML
-extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, int flags) __attribute__((weak));
+extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned int flags) __attribute__((weak));
#endif
#endif
}
/* Automatically generated binding for virStorageVolGetXMLDesc.
- * In generator.pl this function has signature "vol, 0 : string".
+ * In generator.pl this function has signature "vol, 0U : string".
*/
#ifdef HAVE_WEAK_SYMBOLS
#ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
-extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, int flags) __attribute__((weak));
+extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags) __attribute__((weak));
#endif
#endif
NONBLOCKING (r = virStoragePoolGetInfo (pool, &info));
CHECK_ERROR (r == -1, conn, "virStoragePoolGetInfo");
- rv = caml_alloc (3, 0);
+ rv = caml_alloc (4, 0);
Store_field (rv, 0, Val_int (info.state));
v = caml_copy_int64 (info.capacity); Store_field (rv, 1, v);
- v = caml_copy_int64 (info.allocation); Store_field (rv, 1, v);
+ v = caml_copy_int64 (info.allocation); Store_field (rv, 2, v);
+ v = caml_copy_int64 (info.available); Store_field (rv, 3, v);
CAMLreturn (rv);
#else