[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/26] rbd: migrate rbd driver QemuOptionParameter u
From: |
Leandro Dorileo |
Subject: |
[Qemu-devel] [PATCH 17/26] rbd: migrate rbd driver QemuOptionParameter usage |
Date: |
Thu, 20 Mar 2014 21:13:24 -0300 |
Do the directly migration from QemuOptionParameter to QemuOpts on
rbd block driver.
Signed-off-by: Leandro Dorileo <address@hidden>
---
block/rbd.c | 60 +++++++++++++++++++++++++++++-------------------------------
1 file changed, 29 insertions(+), 31 deletions(-)
diff --git a/block/rbd.c b/block/rbd.c
index dbc79f4..ae8c471 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -282,7 +282,7 @@ static int qemu_rbd_set_conf(rados_t cluster, const char
*conf)
return ret;
}
-static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options,
+static int qemu_rbd_create(const char *filename, QemuOpts *options,
Error **errp)
{
int64_t bytes = 0;
@@ -305,25 +305,19 @@ static int qemu_rbd_create(const char *filename,
QEMUOptionParameter *options,
return -EINVAL;
}
- /* Read out options */
- while (options && options->name) {
- if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
- bytes = options->value.n;
- } else if (!strcmp(options->name, BLOCK_OPT_CLUSTER_SIZE)) {
- if (options->value.n) {
- objsize = options->value.n;
- if ((objsize - 1) & objsize) { /* not a power of 2? */
- error_report("obj size needs to be power of 2");
- return -EINVAL;
- }
- if (objsize < 4096) {
- error_report("obj size too small");
- return -EINVAL;
- }
- obj_order = ffs(objsize) - 1;
- }
+ bytes = qemu_opt_get_size(options, BLOCK_OPT_SIZE, 0);
+ objsize = qemu_opt_get_size(options, BLOCK_OPT_CLUSTER_SIZE, 0);
+
+ if (objsize != 0) {
+ if ((objsize - 1) & objsize) { /* not a power of 2? */
+ error_report("obj size needs to be power of 2");
+ return -EINVAL;
+ }
+ if (objsize < 4096) {
+ error_report("obj size too small");
+ return -EINVAL;
}
- options++;
+ obj_order = ffs(objsize) - 1;
}
clientname = qemu_rbd_parse_clientname(conf, clientname_buf);
@@ -900,18 +894,22 @@ static BlockDriverAIOCB*
qemu_rbd_aio_discard(BlockDriverState *bs,
}
#endif
-static QEMUOptionParameter qemu_rbd_create_options[] = {
- {
- .name = BLOCK_OPT_SIZE,
- .type = OPT_SIZE,
- .help = "Virtual disk size"
- },
- {
- .name = BLOCK_OPT_CLUSTER_SIZE,
- .type = OPT_SIZE,
- .help = "RBD object size"
+static QemuOptsList qemu_rbd_create_options = {
+ .name = "qemu_rbd_create_options",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_rbd_create_options.head),
+ .desc = {
+ {
+ .name = BLOCK_OPT_SIZE,
+ .type = QEMU_OPT_SIZE,
+ .help = "Virtual disk size"
+ },
+ {
+ .name = BLOCK_OPT_CLUSTER_SIZE,
+ .type = QEMU_OPT_SIZE,
+ .help = "RBD object size"
+ },
+ {NULL}
},
- {NULL}
};
static BlockDriver bdrv_rbd = {
@@ -923,7 +921,7 @@ static BlockDriver bdrv_rbd = {
.bdrv_create = qemu_rbd_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_get_info = qemu_rbd_getinfo,
- .create_options = qemu_rbd_create_options,
+ .create_options = &qemu_rbd_create_options,
.bdrv_getlength = qemu_rbd_getlength,
.bdrv_truncate = qemu_rbd_truncate,
.protocol_name = "rbd",
--
1.9.0
- [Qemu-devel] [PATCH 21/26] vhdx: migrate vhdx driver QemuOptionParameter usage, (continued)
- [Qemu-devel] [PATCH 21/26] vhdx: migrate vhdx driver QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 22/26] vmdk: migrate vmdk driver QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 23/26] vpc: migrate vpc driver QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 24/26] vvfat: migrate vvfat driver QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 25/26] QemuOpt: get rid of QEMUOptionParameter, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 26/26] qemu-img: migrate QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 18/26] sheepdog: migrate sheepdog driver QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 20/26] vdi: migrate vdi driver QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 19/26] ssh: migrate ssh driver QemuOptionParameter usage, Leandro Dorileo, 2014/03/20
- [Qemu-devel] [PATCH 17/26] rbd: migrate rbd driver QemuOptionParameter usage,
Leandro Dorileo <=