X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=block%2Fnfs.c;h=ca9e24efe5487e56c5b8c0d58b2196191a7afb28;hb=99c9c3cb24e566258a0a141178934f9cb5198842;hp=194f301501627ffce39e29da35e876b608ee0b76;hpb=f2426947decc96bde4f9ea50097dac66a0a48acc;p=mirror_qemu.git diff --git a/block/nfs.c b/block/nfs.c index 194f301501..ca9e24efe5 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -409,6 +409,19 @@ out: return ret; } +static QemuOptsList nfs_create_opts = { + .name = "nfs-create-opts", + .head = QTAILQ_HEAD_INITIALIZER(nfs_create_opts.head), + .desc = { + { + .name = BLOCK_OPT_SIZE, + .type = QEMU_OPT_SIZE, + .help = "Virtual disk size" + }, + { /* end of list */ } + } +}; + static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp) { int ret = 0; @@ -418,7 +431,8 @@ static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp) client->aio_context = qemu_get_aio_context(); /* Read out options */ - total_size = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0); + total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), + BDRV_SECTOR_SIZE); ret = nfs_client_open(client, url, O_CREAT, errp); if (ret < 0) { @@ -469,6 +483,8 @@ static BlockDriver bdrv_nfs = { .instance_size = sizeof(NFSClient), .bdrv_needs_filename = true, + .create_opts = &nfs_create_opts, + .bdrv_has_zero_init = nfs_has_zero_init, .bdrv_get_allocated_file_size = nfs_get_allocated_file_size, .bdrv_truncate = nfs_file_truncate,