rbd.c (db08dc213ba87d16c34c235f5c83f70f0239f023) rbd.c (a9ccedc3daa06723821663c6b3b02c1760035bb9)
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.

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

436
437static int qemu_rbd_aio_flush_cb(void *opaque)
438{
439 BDRVRBDState *s = opaque;
440
441 return (s->qemu_aio_count > 0);
442}
443
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.

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

436
437static int qemu_rbd_aio_flush_cb(void *opaque)
438{
439 BDRVRBDState *s = opaque;
440
441 return (s->qemu_aio_count > 0);
442}
443
444static int qemu_rbd_open(BlockDriverState *bs, const char *filename,
444/* TODO Convert to fine grained options */
445static QemuOptsList runtime_opts = {
446 .name = "rbd",
447 .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
448 .desc = {
449 {
450 .name = "filename",
451 .type = QEMU_OPT_STRING,
452 .help = "Specification of the rbd image",
453 },
454 { /* end of list */ }
455 },
456};
457
458static int qemu_rbd_open(BlockDriverState *bs, const char *dummy,
445 QDict *options, int flags)
446{
447 BDRVRBDState *s = bs->opaque;
448 char pool[RBD_MAX_POOL_NAME_SIZE];
449 char snap_buf[RBD_MAX_SNAP_NAME_SIZE];
450 char conf[RBD_MAX_CONF_SIZE];
451 char clientname_buf[RBD_MAX_CONF_SIZE];
452 char *clientname;
459 QDict *options, int flags)
460{
461 BDRVRBDState *s = bs->opaque;
462 char pool[RBD_MAX_POOL_NAME_SIZE];
463 char snap_buf[RBD_MAX_SNAP_NAME_SIZE];
464 char conf[RBD_MAX_CONF_SIZE];
465 char clientname_buf[RBD_MAX_CONF_SIZE];
466 char *clientname;
467 QemuOpts *opts;
468 Error *local_err = NULL;
469 const char *filename;
453 int r;
454
470 int r;
471
472 opts = qemu_opts_create_nofail(&runtime_opts);
473 qemu_opts_absorb_qdict(opts, options, &local_err);
474 if (error_is_set(&local_err)) {
475 qerror_report_err(local_err);
476 error_free(local_err);
477 qemu_opts_del(opts);
478 return -EINVAL;
479 }
480
481 filename = qemu_opt_get(opts, "filename");
482 qemu_opts_del(opts);
483
455 if (qemu_rbd_parsename(filename, pool, sizeof(pool),
456 snap_buf, sizeof(snap_buf),
457 s->name, sizeof(s->name),
458 conf, sizeof(conf)) < 0) {
459 return -EINVAL;
460 }
461
462 clientname = qemu_rbd_parse_clientname(conf, clientname_buf);

--- 536 unchanged lines hidden ---
484 if (qemu_rbd_parsename(filename, pool, sizeof(pool),
485 snap_buf, sizeof(snap_buf),
486 s->name, sizeof(s->name),
487 conf, sizeof(conf)) < 0) {
488 return -EINVAL;
489 }
490
491 clientname = qemu_rbd_parse_clientname(conf, clientname_buf);

--- 536 unchanged lines hidden ---