rbd.c (3dbf00e058e450173c6f892bb572df871eb4ea58) rbd.c (99a3c89d5d538dc6c360e35dffb797cfe06e9cda)
1/*
2 * QEMU Block driver for RADOS (Ceph)
3 *
4 * Copyright (C) 2010-2011 Christian Brunner <chb@muc.de>,
5 * Josh Durgin <josh.durgin@dreamhost.com>
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2. See
8 * the COPYING file in the top-level directory.

--- 446 unchanged lines hidden (view full) ---

455 goto failed_opts;
456 }
457
458 s->snap = NULL;
459 if (snap_buf[0] != '\0') {
460 s->snap = g_strdup(snap_buf);
461 }
462
1/*
2 * QEMU Block driver for RADOS (Ceph)
3 *
4 * Copyright (C) 2010-2011 Christian Brunner <chb@muc.de>,
5 * Josh Durgin <josh.durgin@dreamhost.com>
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2. See
8 * the COPYING file in the top-level directory.

--- 446 unchanged lines hidden (view full) ---

455 goto failed_opts;
456 }
457
458 s->snap = NULL;
459 if (snap_buf[0] != '\0') {
460 s->snap = g_strdup(snap_buf);
461 }
462
463 if (strstr(conf, "conf=") == NULL) {
464 /* try default location, but ignore failure */
465 rados_conf_read_file(s->cluster, NULL);
466 }
467
468 if (conf[0] != '\0') {
469 r = qemu_rbd_set_conf(s->cluster, conf, errp);
470 if (r < 0) {
471 goto failed_shutdown;
472 }
473 }
474
463 /*
464 * Fallback to more conservative semantics if setting cache
465 * options fails. Ignore errors from setting rbd_cache because the
466 * only possible error is that the option does not exist, and
467 * librbd defaults to no caching. If write through caching cannot
468 * be set up, fall back to no caching.
469 */
470 if (flags & BDRV_O_NOCACHE) {
471 rados_conf_set(s->cluster, "rbd_cache", "false");
472 } else {
473 rados_conf_set(s->cluster, "rbd_cache", "true");
474 }
475
475 /*
476 * Fallback to more conservative semantics if setting cache
477 * options fails. Ignore errors from setting rbd_cache because the
478 * only possible error is that the option does not exist, and
479 * librbd defaults to no caching. If write through caching cannot
480 * be set up, fall back to no caching.
481 */
482 if (flags & BDRV_O_NOCACHE) {
483 rados_conf_set(s->cluster, "rbd_cache", "false");
484 } else {
485 rados_conf_set(s->cluster, "rbd_cache", "true");
486 }
487
476 if (strstr(conf, "conf=") == NULL) {
477 /* try default location, but ignore failure */
478 rados_conf_read_file(s->cluster, NULL);
479 }
480
481 if (conf[0] != '\0') {
482 r = qemu_rbd_set_conf(s->cluster, conf, errp);
483 if (r < 0) {
484 goto failed_shutdown;
485 }
486 }
487
488 r = rados_connect(s->cluster);
489 if (r < 0) {
490 error_setg(errp, "error connecting");
491 goto failed_shutdown;
492 }
493
494 r = rados_ioctx_create(s->cluster, pool, &s->io_ctx);
495 if (r < 0) {

--- 456 unchanged lines hidden ---
488 r = rados_connect(s->cluster);
489 if (r < 0) {
490 error_setg(errp, "error connecting");
491 goto failed_shutdown;
492 }
493
494 r = rados_ioctx_create(s->cluster, pool, &s->io_ctx);
495 if (r < 0) {

--- 456 unchanged lines hidden ---