On Wed, Jul 01, 2015 at 09:40:45PM +0100, Zeeshan Ali (Khattak) wrote:
@@ -901,77 +801,31 @@ gboolean
gvir_connection_fetch_storage_pools(GVirConnection *conn,
if (g_cancellable_set_error_if_cancelled(cancellable, err))
goto cleanup;
- active = fetch_list(vconn,
- "Storage Pools",
- virConnectNumOfStoragePools,
- virConnectListStoragePools,
- cancellable,
- &nactive,
- &lerr);
- if (lerr) {
- g_propagate_error(err, lerr);
- lerr = NULL;
+ npools = virConnectListAllStoragePools(vconn, &vpools, 0);
+ if (npools < 0) {
+ gvir_set_error(err, GVIR_CONNECTION_ERROR,
+ 0,
+ _("Failed to fetch list of pools"));
goto cleanup;
}
if (g_cancellable_set_error_if_cancelled(cancellable, err))
goto cleanup;
- inactive = fetch_list(vconn,
- "Storage Pools",
- virConnectNumOfDefinedStoragePools,
- virConnectListDefinedStoragePools,
- cancellable,
- &ninactive,
- &lerr);
- if (lerr) {
- g_propagate_error(err, lerr);
- lerr = NULL;
- goto cleanup;
- }
-
pools = g_hash_table_new_full(g_str_hash,
g_str_equal,
NULL,
g_object_unref);
- for (i = 0 ; i < nactive ; i++) {
+ for (i = 0 ; i < npools; i++) {
if (g_cancellable_set_error_if_cancelled(cancellable, err))
goto cleanup;
- virStoragePoolPtr vpool;
GVirStoragePool *pool;
While touching this code, you could move 'pool' declaration to the
beginning of the 'for' block.
Christophe