1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
|
/*
* libvirt-gobject-storage_pool.c: libvirt glib integration
*
* Copyright (C) 2008 Daniel P. Berrange
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#include <config.h>
#include <libvirt/virterror.h>
#include <string.h>
#include "libvirt-glib/libvirt-glib.h"
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
#define GVIR_STORAGE_POOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_STORAGE_POOL, GVirStoragePoolPrivate))
struct _GVirStoragePoolPrivate
{
GMutex *lock;
virStoragePoolPtr handle;
GHashTable *volumes;
gchar uuid[VIR_UUID_STRING_BUFLEN];
};
G_DEFINE_TYPE(GVirStoragePool, gvir_storage_pool, G_TYPE_OBJECT);
enum {
PROP_0,
PROP_HANDLE,
};
#define GVIR_STORAGE_POOL_ERROR gvir_storage_pool_error_quark()
static GQuark
gvir_storage_pool_error_quark(void)
{
return g_quark_from_static_string("gvir-storage-pool");
}
static void gvir_storage_pool_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GVirStoragePool *pool = GVIR_STORAGE_POOL(object);
GVirStoragePoolPrivate *priv = pool->priv;
switch (prop_id) {
case PROP_HANDLE:
g_value_set_boxed(value, priv->handle);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
}
static void gvir_storage_pool_set_property(GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GVirStoragePool *pool = GVIR_STORAGE_POOL(object);
GVirStoragePoolPrivate *priv = pool->priv;
switch (prop_id) {
case PROP_HANDLE:
if (priv->handle)
virStoragePoolFree(priv->handle);
priv->handle = g_value_dup_boxed(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
}
static void gvir_storage_pool_finalize(GObject *object)
{
GVirStoragePool *pool = GVIR_STORAGE_POOL(object);
GVirStoragePoolPrivate *priv = pool->priv;
g_debug("Finalize GVirStoragePool=%p", pool);
if (priv->volumes) {
g_hash_table_unref(priv->volumes);
priv->volumes = NULL;
}
virStoragePoolFree(priv->handle);
g_mutex_free(priv->lock);
G_OBJECT_CLASS(gvir_storage_pool_parent_class)->finalize(object);
}
static void gvir_storage_pool_constructed(GObject *object)
{
GVirStoragePool *conn = GVIR_STORAGE_POOL(object);
GVirStoragePoolPrivate *priv = conn->priv;
G_OBJECT_CLASS(gvir_storage_pool_parent_class)->constructed(object);
/* xxx we may want to turn this into an initable */
if (virStoragePoolGetUUIDString(priv->handle, priv->uuid) < 0) {
virErrorPtr verr = virGetLastError();
if (verr) {
g_warning("Failed to get storage pool UUID on %p: %s",
priv->handle, verr->message);
} else {
g_warning("Failed to get storage pool UUID on %p", priv->handle);
}
}
}
static void gvir_storage_pool_class_init(GVirStoragePoolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gvir_storage_pool_finalize;
object_class->get_property = gvir_storage_pool_get_property;
object_class->set_property = gvir_storage_pool_set_property;
object_class->constructed = gvir_storage_pool_constructed;
g_object_class_install_property(object_class,
PROP_HANDLE,
g_param_spec_boxed("handle",
"Handle",
"The storage_pool handle",
GVIR_TYPE_STORAGE_POOL_HANDLE,
G_PARAM_READABLE |
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private(klass, sizeof(GVirStoragePoolPrivate));
}
static void gvir_storage_pool_init(GVirStoragePool *pool)
{
GVirStoragePoolPrivate *priv;
g_debug("Init GVirStoragePool=%p", pool);
priv = pool->priv = GVIR_STORAGE_POOL_GET_PRIVATE(pool);
priv->lock = g_mutex_new();
}
typedef struct virStoragePool GVirStoragePoolHandle;
static GVirStoragePoolHandle*
gvir_storage_pool_handle_copy(GVirStoragePoolHandle *src)
{
virStoragePoolRef((virStoragePoolPtr)src);
return src;
}
static void
gvir_storage_pool_handle_free(GVirStoragePoolHandle *src)
{
virStoragePoolFree((virStoragePoolPtr)src);
}
G_DEFINE_BOXED_TYPE(GVirStoragePoolHandle, gvir_storage_pool_handle,
gvir_storage_pool_handle_copy, gvir_storage_pool_handle_free)
static GVirStoragePoolInfo *
gvir_storage_pool_info_copy(GVirStoragePoolInfo *info)
{
return g_slice_dup(GVirStoragePoolInfo, info);
}
static void
gvir_storage_pool_info_free(GVirStoragePoolInfo *info)
{
g_slice_free(GVirStoragePoolInfo, info);
}
G_DEFINE_BOXED_TYPE(GVirStoragePoolInfo, gvir_storage_pool_info,
gvir_storage_pool_info_copy, gvir_storage_pool_info_free)
const gchar *gvir_storage_pool_get_name(GVirStoragePool *pool)
{
GVirStoragePoolPrivate *priv = pool->priv;
const char *name;
if (!(name = virStoragePoolGetName(priv->handle))) {
g_warning("Failed to get storage_pool name on %p", priv->handle);
return NULL;
}
return name;
}
const gchar *gvir_storage_pool_get_uuid(GVirStoragePool *pool)
{
g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
return pool->priv->uuid;
}
/**
* gvir_storage_pool_get_config:
* @pool: the storage_pool
* @flags: the flags
* Returns: (transfer full): the config
*/
GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
guint flags,
GError **err)
{
GVirStoragePoolPrivate *priv = pool->priv;
gchar *xml;
if (!(xml = virStoragePoolGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
"Unable to get storage_pool XML config");
return NULL;
}
GVirConfigStoragePool *conf = gvir_config_storage_pool_new_from_xml(xml, err);
free(xml);
return conf;
}
/**
* gvir_storage_pool_get_info:
* @pool: the storage_pool
* Returns: (transfer full): the info
*/
GVirStoragePoolInfo *gvir_storage_pool_get_info(GVirStoragePool *pool,
GError **err)
{
GVirStoragePoolPrivate *priv = pool->priv;
virStoragePoolInfo info;
GVirStoragePoolInfo *ret;
if (virStoragePoolGetInfo(priv->handle, &info) < 0) {
if (err)
*err = gvir_error_new_literal(GVIR_STORAGE_POOL_ERROR,
0,
"Unable to get storage pool info");
return NULL;
}
ret = g_slice_new(GVirStoragePoolInfo);
ret->state = info.state;
ret->capacity = info.capacity;
ret->allocation = info.allocation;
ret->available = info.available;
return ret;
}
typedef gint (* CountFunction) (virStoragePoolPtr vpool);
typedef gint (* ListFunction) (virStoragePoolPtr vpool, gchar **lst, gint max);
static gchar ** fetch_list(virStoragePoolPtr vpool,
const char *name,
CountFunction count_func,
ListFunction list_func,
GCancellable *cancellable,
gint *length,
GError **err)
{
gchar **lst = NULL;
gint n = 0;
gint i;
if ((n = count_func(vpool)) < 0) {
gvir_set_error(err, GVIR_STORAGE_POOL_ERROR,
0,
"Unable to count %s", name);
goto error;
}
if (n) {
if (g_cancellable_set_error_if_cancelled(cancellable, err))
goto error;
lst = g_new(gchar *, n);
if ((n = list_func(vpool, lst, n)) < 0) {
gvir_set_error(err, GVIR_STORAGE_POOL_ERROR,
0,
"Unable to list %s %d", name, n);
goto error;
}
}
*length = n;
return lst;
error:
for (i = 0 ; i < n; i++)
g_free(lst[i]);
g_free(lst);
return NULL;
}
/**
* gvir_storage_pool_refresh:
* @pool: the storage pool
* @cancellable: (allow-none)(transfer none): cancellation object
*/
gboolean gvir_storage_pool_refresh(GVirStoragePool *pool,
GCancellable *cancellable,
GError **err)
{
GVirStoragePoolPrivate *priv = pool->priv;
GHashTable *vol_hash;
gchar **volumes = NULL;
gint nvolumes = 0;
gboolean ret = FALSE;
gint i;
virStoragePoolPtr vpool = NULL;
GError *lerr = NULL;
vpool = priv->handle;
if (virStoragePoolRefresh(vpool, 0) < 0) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
"Unable to refresh storage pool");
goto cleanup;
}
volumes = fetch_list(vpool,
"Storage Volumes",
virStoragePoolNumOfVolumes,
virStoragePoolListVolumes,
cancellable,
&nvolumes,
&lerr);
if (lerr) {
g_propagate_error(err, lerr);
lerr = NULL;
goto cleanup;
}
if (g_cancellable_set_error_if_cancelled(cancellable, err))
goto cleanup;
vol_hash = g_hash_table_new_full(g_str_hash,
g_str_equal,
g_free,
g_object_unref);
for (i = 0 ; i < nvolumes ; i++) {
if (g_cancellable_set_error_if_cancelled(cancellable, err))
goto cleanup;
virStorageVolPtr vvolume;
GVirStorageVol *volume;
vvolume = virStorageVolLookupByName(vpool, volumes[i]);
if (!vvolume)
continue;
volume = GVIR_STORAGE_VOL(g_object_new(GVIR_TYPE_STORAGE_VOL,
"handle", vvolume,
"pool", pool,
NULL));
g_hash_table_insert(vol_hash, g_strdup(volumes[i]), volume);
}
g_mutex_lock(priv->lock);
if (priv->volumes)
g_hash_table_unref(priv->volumes);
priv->volumes = vol_hash;
g_mutex_unlock(priv->lock);
ret = TRUE;
cleanup:
for (i = 0 ; i < nvolumes ; i++)
g_free(volumes[i]);
g_free(volumes);
return ret;
}
static void
gvir_storage_pool_refresh_helper(GSimpleAsyncResult *res,
GObject *object,
GCancellable *cancellable)
{
GVirStoragePool *pool = GVIR_STORAGE_POOL(object);
GError *err = NULL;
if (!gvir_storage_pool_refresh(pool, cancellable, &err)) {
g_simple_async_result_set_from_error(res, err);
g_error_free(err);
}
}
/**
* gvir_storage_pool_refresh_async:
* @pool: the storage pool
* @cancellable: (allow-none)(transfer none): cancellation object
* @callback: (scope async): completion callback
* @user_data: (closure): opaque data for callback
*/
void gvir_storage_pool_refresh_async(GVirStoragePool *pool,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *res;
res = g_simple_async_result_new(G_OBJECT(pool),
callback,
user_data,
gvir_storage_pool_refresh_async);
g_simple_async_result_run_in_thread(res,
gvir_storage_pool_refresh_helper,
G_PRIORITY_DEFAULT,
cancellable);
g_object_unref(res);
}
/**
* gvir_storage_pool_refresh_finish:
* @pool: the storage pool
* @result: (transfer none): async method result
*/
gboolean gvir_storage_pool_refresh_finish(GVirStoragePool *pool,
GAsyncResult *result,
GError **err)
{
g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(pool),
gvir_storage_pool_refresh_async),
FALSE);
if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result),
err))
return FALSE;
return TRUE;
}
static void gvir_storage_vol_ref(gpointer obj, gpointer ignore G_GNUC_UNUSED)
{
g_object_ref(obj);
}
/**
* gvir_storage_pool_get_volumes:
* @pool: the storage pool
*
* Return value: (element-type LibvirtGObject.StorageVol) (transfer full): List
* of #GVirStorageVol
*/
GList *gvir_storage_pool_get_volumes(GVirStoragePool *pool)
{
GVirStoragePoolPrivate *priv = pool->priv;
GList *volumes = NULL;
g_mutex_lock(priv->lock);
if (priv->volumes != NULL) {
volumes = g_hash_table_get_values(priv->volumes);
g_list_foreach(volumes, gvir_storage_vol_ref, NULL);
}
g_mutex_unlock(priv->lock);
return volumes;
}
/**
* gvir_storage_pool_get_volume:
* @pool: the storage pool
* @name: Name of the requested storage volume
*
* Return value: (transfer full): the #GVirStorageVol, or NULL
*/
GVirStorageVol *gvir_storage_pool_get_volume(GVirStoragePool *pool,
const gchar *name)
{
GVirStoragePoolPrivate *priv = pool->priv;
GVirStorageVol *volume;
g_mutex_lock(priv->lock);
volume = g_hash_table_lookup(priv->volumes, name);
if (volume)
g_object_ref(volume);
g_mutex_unlock(priv->lock);
return volume;
}
/**
* gvir_storage_pool_create_volume:
* @pool: the storage pool in which to create the volume
* @conf: the configuration for the new volume
* Returns: (transfer full): the newly created volume
*/
GVirStorageVol *gvir_storage_pool_create_volume
(GVirStoragePool *pool,
GVirConfigStorageVol *conf,
GError **err)
{
const gchar *xml;
virStorageVolPtr handle;
GVirStoragePoolPrivate *priv = pool->priv;
xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
g_return_val_if_fail(xml != NULL, NULL);
if (!(handle = virStorageVolCreateXML(priv->handle, xml, 0))) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
"Failed to create volume");
return NULL;
}
GVirStorageVol *volume;
const char *name;
volume = GVIR_STORAGE_VOL(g_object_new(GVIR_TYPE_STORAGE_VOL,
"handle", handle,
"pool", pool,
NULL));
name = gvir_storage_vol_get_name(volume);
if (name == NULL) {
g_object_unref(G_OBJECT(volume));
return NULL;
}
g_mutex_lock(priv->lock);
g_hash_table_insert(priv->volumes, g_strdup(name), volume);
g_mutex_unlock(priv->lock);
return g_object_ref(volume);
}
/**
* gvir_storage_pool_build:
* @pool: the storage pool to build
* @flags: the flags
* @err: return location for any #GError
*
* Return value: #True on success, #False otherwise.
*/
gboolean gvir_storage_pool_build (GVirStoragePool *pool,
guint flags,
GError **err)
{
if (virStoragePoolBuild(pool->priv->handle, flags)) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
"Failed to build storage pool");
return FALSE;
}
return TRUE;
}
typedef struct {
guint flags;
} StoragePoolBuildData;
static void
gvir_storage_pool_build_helper(GSimpleAsyncResult *res,
GObject *object,
GCancellable *cancellable G_GNUC_UNUSED)
{
GVirStoragePool *pool = GVIR_STORAGE_POOL(object);
StoragePoolBuildData *data;
GError *err = NULL;
data = (StoragePoolBuildData *) g_object_get_data(G_OBJECT(res),
"StoragePoolBuildData");
if (!gvir_storage_pool_build(pool, data->flags, &err)) {
g_simple_async_result_set_from_error(res, err);
g_error_free(err);
}
g_slice_free (StoragePoolBuildData, data);
}
/**
* gvir_storage_pool_build_async:
* @pool: the storage pool to build
* @flags: the flags
* @cancellable: (allow-none)(transfer none): cancellation object
* @callback: (scope async): completion callback
* @user_data: (closure): opaque data for callback
*/
void gvir_storage_pool_build_async (GVirStoragePool *pool,
guint flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *res;
StoragePoolBuildData *data;
data = g_slice_new0(StoragePoolBuildData);
data->flags = flags;
res = g_simple_async_result_new(G_OBJECT(pool),
callback,
user_data,
gvir_storage_pool_build_async);
g_object_set_data(G_OBJECT(res), "StoragePoolBuildData", data);
g_simple_async_result_run_in_thread(res,
gvir_storage_pool_build_helper,
G_PRIORITY_DEFAULT,
cancellable);
g_object_unref(res);
}
/**
* gvir_storage_pool_build_finish:
* @pool: the storage pool to build
* @result: (transfer none): async method result
* @err: return location for any #GError
*
* Return value: #True on success, #False otherwise.
*/
gboolean gvir_storage_pool_build_finish(GVirStoragePool *pool,
GAsyncResult *result,
GError **err)
{
g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(pool),
gvir_storage_pool_build_async),
FALSE);
if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result),
err))
return FALSE;
return TRUE;
}
/**
* gvir_storage_pool_start:
* @pool: the storage pool to start
* @flags: the flags
* @err: return location for any #GError
*
* Return value: #True on success, #False otherwise.
*/
gboolean gvir_storage_pool_start (GVirStoragePool *pool,
guint flags,
GError **err)
{
if (virStoragePoolCreate(pool->priv->handle, flags)) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
"Failed to start storage pool");
return FALSE;
}
return TRUE;
}
static void
gvir_storage_pool_start_helper(GSimpleAsyncResult *res,
GObject *object,
GCancellable *cancellable G_GNUC_UNUSED)
{
GVirStoragePool *pool = GVIR_STORAGE_POOL(object);
StoragePoolBuildData *data;
GError *err = NULL;
data = (StoragePoolBuildData *) g_object_get_data(G_OBJECT(res),
"StoragePoolBuildData");
if (!gvir_storage_pool_start(pool, data->flags, &err)) {
g_simple_async_result_set_from_error(res, err);
g_error_free(err);
}
g_slice_free (StoragePoolBuildData, data);
}
/**
* gvir_storage_pool_start_async:
* @pool: the storage pool to start
* @flags: the flags
* @cancellable: (allow-none)(transfer none): cancellation object
* @callback: (scope async): completion callback
* @user_data: (closure): opaque data for callback
*/
void gvir_storage_pool_start_async (GVirStoragePool *pool,
guint flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *res;
StoragePoolBuildData *data;
data = g_slice_new0(StoragePoolBuildData);
data->flags = flags;
res = g_simple_async_result_new(G_OBJECT(pool),
callback,
user_data,
gvir_storage_pool_start_async);
g_object_set_data(G_OBJECT(res), "StoragePoolBuildData", data);
g_simple_async_result_run_in_thread(res,
gvir_storage_pool_start_helper,
G_PRIORITY_DEFAULT,
cancellable);
g_object_unref(res);
}
/**
* gvir_storage_pool_start_finish:
* @pool: the storage pool to start
* @result: (transfer none): async method result
* @err: return location for any #GError
*
* Return value: #True on success, #False otherwise.
*/
gboolean gvir_storage_pool_start_finish(GVirStoragePool *pool,
GAsyncResult *result,
GError **err)
{
g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(pool),
gvir_storage_pool_start_async),
FALSE);
if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result),
err))
return FALSE;
return TRUE;
}
|