Block patches
Subsystems (2)
The following changes since commit 138b38b61bf92d4e9588acf934e532499c94e185:
ppc: kvm: fix signedness warning (2010-12-08 21:30:19 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git for-anthony
Christian Brunner (1):
ceph/rbd block driver for qemu-kvm
Jes Sorensen (8):
Add missing tracing to qemu_mallocz()
Use qemu_mallocz() instead of calloc() in img_convert() img_convert(): Only try to free bs[] entries if bs is valid. Consolidate printing of block driver options
Fix formatting and missing braces in qemu-img.c
Fail if detecting an unknown option
Make error handling more consistent in img_create() and img_resize()
qemu-img: Deprecate obsolete -6 and -e options
Stefan Hajnoczi (5):
block: Make bdrv_create_file() ':' handling consistent
qemu-option: Don't reinvent append_option_parameters()
qemu-option: Fix parse_option_parameters() documentation typo
qemu-img: Free option parameter lists in img_create()
qemu-img: Fail creation if backing format is invalid
Makefile.objs | 1 + block.c | 2 +- block/rbd.c | 1059 +++++++++++++++++++++++++++++++++++++++++++++++++++++ block/rbd_types.h | 71 ++++ block_int.h | 1 - configure | 52 +++ qemu-img.c | 247 ++++++++----- qemu-malloc.c | 5 +- qemu-option.c | 13 +- 9 files changed, 1344 insertions(+), 107 deletions(-) create mode 100644 block/rbd.c create mode 100644 block/rbd_types.h
PATCH 1/14 block: Make bdrv_create_file() ':' handling consistent
From: Stefan Hajnoczi <[email protected]>
Filenames may start with "<protocol>:" to explicitly use a protocol like nbd. Filenames with unknown protocols are rejected in most of QEMU except for bdrv_create_file(). Even if a file with an invalid filename can be created, QEMU cannot use it since all the other relevant functions reject such paths. Make bdrv_create_file() consistent.
--- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
block.c +1 -1
@@ -215,7 +215,7 @@ int bdrv_create_file(const char* filename, QEMUOptionParameter *options) drv =bdrv_find_protocol (filename);if (drv ==NULL ) { - drv =bdrv_find_format ("file" ); +return -ENOENT ; }return bdrv_create (drv, filename, options);
Signature · 1 line
1.7.2.3
PATCH 2/14 Add missing tracing to qemu_mallocz()
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
--- qemu-malloc.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
qemu-malloc.c +4 -1
@@ -64,10 +64,13 @@ void *qemu_realloc(void *ptr, size_t size)void *qemu_mallocz (size_t size) { +void *ptr;if (!size && !allow_zero_malloc ()) {abort (); } -return qemu_oom_check (calloc (1 , size ? size :1 )); + ptr =qemu_oom_check (calloc (1 , size ? size :1 )); +trace_qemu_malloc (size, ptr); +return ptr; }char *qemu_strdup (const char *str)
Signature · 1 line
1.7.2.3
PATCH 3/14 Use qemu_mallocz() instead of calloc() in img_convert()
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
--- qemu-img.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
qemu-img.c +2 -6
@@ -699,11 +699,7 @@ static int img_convert(int argc, char **argv)return 1 ; } - bs =calloc (bs_n,sizeof (BlockDriverState *)); -if (!bs) { -error ("Out of memory" ); -return 1 ; - } + bs =qemu_mallocz (bs_n *sizeof (BlockDriverState *)); total_sectors =0 ;for (bs_i =0 ; bs_i < bs_n; bs_i++) {
@@ -983,7 +979,7 @@ out:bdrv_delete (bs[bs_i]); } } -free (bs); +qemu_free (bs);if (ret) {return 1 ; }
Signature · 1 line
1.7.2.3
PATCH 4/14 img_convert(): Only try to free bs[] entries if bs is valid.
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
This allows for jumping to 'out:' consistently for error exit.
--- qemu-img.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
qemu-img.c +8 -5
@@ -696,7 +696,8 @@ static int img_convert(int argc, char **argv)if (bs_n >1 && out_baseimg) {error ("-B makes no sense when concatenating multiple input images" ); -return 1 ; + ret =-1 ; + goto out; } bs =qemu_mallocz (bs_n *sizeof (BlockDriverState *));
@@ -974,12 +975,14 @@ out:if (out_bs) {bdrv_delete (out_bs); } -for (bs_i =0 ; bs_i < bs_n; bs_i++) { -if (bs[bs_i]) { -bdrv_delete (bs[bs_i]); +if (bs) { +for (bs_i =0 ; bs_i < bs_n; bs_i++) { +if (bs[bs_i]) { +bdrv_delete (bs[bs_i]); + } } +qemu_free (bs); } -qemu_free (bs);if (ret) {return 1 ; }
Signature · 1 line
1.7.2.3
PATCH 5/14 Consolidate printing of block driver options
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
This consolidates the printing of block driver options in print_block_option_help() which is called from both img_create() and img_convert().
This allows for the "?" detection to be done just after the parsing of options and the filename, instead of half way down the codepath of these functions.
--- qemu-img.c | 46 +++++++++++++++++++++++++++++++++++++--------- 1 files changed, 37 insertions(+), 9 deletions(-)
qemu-img.c +37 -9
@@ -188,6 +188,33 @@ static int read_password(char *buf, int buf_size) }#endif +static int print_block_option_help (const char *filename,const char *fmt) +{ +BlockDriver *drv, *proto_drv; +QEMUOptionParameter *create_options =NULL ; + +/* Find driver and parse its options */ + drv =bdrv_find_format (fmt); +if (!drv) { +error ("Unknown file format '%s'" , fmt); +return 1 ; + } + + proto_drv =bdrv_find_protocol (filename); +if (!proto_drv) { +error ("Unknown protocol '%s'" , filename); +return 1 ; + } + + create_options =append_option_parameters (create_options, + drv->create_options); + create_options =append_option_parameters (create_options, + proto_drv->create_options); +print_option_help (create_options); +free_option_parameters (create_options); +return 0 ; +} +static BlockDriverState *bdrv_new_open (const char *filename,const char *fmt,int flags)
@@ -310,6 +337,11 @@ static int img_create(int argc, char **argv)help (); filename = argv[optind++]; +if (options && !strcmp (options,"?" )) { + ret =print_block_option_help (filename, fmt); + goto out; + } +/* Find driver and parse its options */ drv =bdrv_find_format (fmt);if (!drv) {
@@ -328,11 +360,6 @@ static int img_create(int argc, char **argv) create_options =append_option_parameters (create_options, proto_drv->create_options); -if (options && !strcmp (options,"?" )) { -print_option_help (create_options); - goto out; - } -/* Create parameter list with default values */ param =parse_option_parameters ("" , create_options, param);set_option_parameter_int (param,BLOCK_OPT_SIZE ,-1 );
@@ -694,6 +721,11 @@ static int img_convert(int argc, char **argv) out_filename = argv[argc -1 ]; +if (options && !strcmp (options,"?" )) { + ret =print_block_option_help (out_filename, out_fmt); + goto out; + } +if (bs_n >1 && out_baseimg) {error ("-B makes no sense when concatenating multiple input images" ); ret =-1 ;
@@ -746,10 +778,6 @@ static int img_convert(int argc, char **argv) drv->create_options); create_options =append_option_parameters (create_options, proto_drv->create_options); -if (options && !strcmp (options,"?" )) { -print_option_help (create_options); - goto out; - }if (options) { param =parse_option_parameters (options, create_options, param);
Signature · 1 line
1.7.2.3
PATCH 6/14 Fix formatting and missing braces in qemu-img.c
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
--- qemu-img.c | 77 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 51 insertions(+), 26 deletions(-)
qemu-img.c +51 -26
@@ -305,8 +305,9 @@ static int img_create(int argc, char **argv) flags =0 ;for (;;) { c =getopt (argc, argv,"F:b:f:he6o:" ); -if (c ==-1 ) +if (c ==-1 ) {break ; + }switch (c) {case 'h' :help ();
@@ -333,8 +334,9 @@ static int img_create(int argc, char **argv) }/* Get the filename */ -if (optind >= argc) +if (optind >= argc) {help (); + } filename = argv[optind++];if (options && !strcmp (options,"?" )) {
@@ -471,8 +473,9 @@ static int img_check(int argc, char **argv) fmt =NULL ;for (;;) { c =getopt (argc, argv,"f:h" ); -if (c ==-1 ) +if (c ==-1 ) {break ; + }switch (c) {case 'h' :help ();
@@ -482,8 +485,9 @@ static int img_check(int argc, char **argv)break ; } } -if (optind >= argc) +if (optind >= argc) {help (); + } filename = argv[optind++]; bs =bdrv_new_open (filename, fmt,BDRV_O_FLAGS );
@@ -547,8 +551,9 @@ static int img_commit(int argc, char **argv) fmt =NULL ;for (;;) { c =getopt (argc, argv,"f:h" ); -if (c ==-1 ) +if (c ==-1 ) {break ; + }switch (c) {case 'h' :help ();
@@ -558,8 +563,9 @@ static int img_commit(int argc, char **argv)break ; } } -if (optind >= argc) +if (optind >= argc) {help (); + } filename = argv[optind++]; bs =bdrv_new_open (filename, fmt,BDRV_O_FLAGS |BDRV_O_RDWR );
@@ -683,8 +689,9 @@ static int img_convert(int argc, char **argv) flags =0 ;for (;;) { c =getopt (argc, argv,"f:O:B:s:hce6o:" ); -if (c ==-1 ) +if (c ==-1 ) {break ; + }switch (c) {case 'h' :help ();
@@ -717,7 +724,9 @@ static int img_convert(int argc, char **argv) } bs_n = argc - optind -1 ; -if (bs_n <1 )help (); +if (bs_n <1 ) { +help (); + } out_filename = argv[argc -1 ];
@@ -905,8 +914,9 @@ static int img_convert(int argc, char **argv) }assert (remainder ==0 ); -if (n < cluster_sectors) +if (n < cluster_sectors) {memset (buf + n *512 ,0 , cluster_size - n *512 ); + }if (is_not_zero (buf, cluster_size)) { ret =bdrv_write_compressed (out_bs, sector_num, buf, cluster_sectors);
@@ -926,12 +936,14 @@ static int img_convert(int argc, char **argv) sector_num =0 ;// total number of sectors converted so far for (;;) { nb_sectors = total_sectors - sector_num; -if (nb_sectors <=0 ) +if (nb_sectors <=0 ) {break ; -if (nb_sectors >= (IO_BUF_SIZE /512 )) + } +if (nb_sectors >= (IO_BUF_SIZE /512 )) { n = (IO_BUF_SIZE /512 ); -else + }else { n = nb_sectors; + }while (sector_num - bs_offset >= bs_sectors) { bs_i ++;
@@ -943,8 +955,9 @@ static int img_convert(int argc, char **argv)sector_num, bs_i, bs_offset, bs_sectors); */ } -if (n > bs_offset + bs_sectors - sector_num) +if (n > bs_offset + bs_sectors - sector_num) { n = bs_offset + bs_sectors - sector_num; + }if (has_zero_init) {/* If the output image is being created as a copy on write image,
@@ -1080,8 +1093,9 @@ static int img_info(int argc, char **argv) fmt =NULL ;for (;;) { c =getopt (argc, argv,"f:h" ); -if (c ==-1 ) +if (c ==-1 ) {break ; + }switch (c) {case 'h' :help ();
@@ -1091,8 +1105,9 @@ static int img_info(int argc, char **argv)break ; } } -if (optind >= argc) +if (optind >= argc) {help (); + } filename = argv[optind++]; bs =bdrv_new_open (filename, fmt,BDRV_O_FLAGS |BDRV_O_NO_BACKING );
@@ -1103,11 +1118,12 @@ static int img_info(int argc, char **argv)bdrv_get_geometry (bs, &total_sectors);get_human_readable_size (size_buf,sizeof (size_buf), total_sectors *512 ); allocated_size =get_allocated_file_size (filename); -if (allocated_size <0 ) +if (allocated_size <0 ) {snprintf (dsize_buf,sizeof (dsize_buf),"unavailable" ); -else + }else {get_human_readable_size (dsize_buf,sizeof (dsize_buf), allocated_size); + }printf ("image: %s\n" "file format: %s\n" "virtual size: %s (%" PRId64 " bytes)\n"
@@ -1115,11 +1131,13 @@ static int img_info(int argc, char **argv) filename, fmt_name, size_buf, (total_sectors *512 ), dsize_buf); -if (bdrv_is_encrypted (bs)) +if (bdrv_is_encrypted (bs)) {printf ("encrypted: yes\n" ); + }if (bdrv_get_info (bs, &bdi) >=0 ) { -if (bdi.cluster_size !=0 ) +if (bdi.cluster_size !=0 ) {printf ("cluster_size: %d\n" , bdi.cluster_size); + } }bdrv_get_backing_filename (bs, backing_filename,sizeof (backing_filename));if (backing_filename[0 ] !='\0' ) {
@@ -1152,8 +1170,9 @@ static int img_snapshot(int argc, char **argv)/* Parse commandline parameters */ for (;;) { c =getopt (argc, argv,"la:c:d:h" ); -if (c ==-1 ) +if (c ==-1 ) {break ; + }switch (c) {case 'h' :help ();
@@ -1193,8 +1212,9 @@ static int img_snapshot(int argc, char **argv) } } -if (optind >= argc) +if (optind >= argc) {help (); + } filename = argv[optind++];/* Open the image */
@@ -1218,23 +1238,26 @@ static int img_snapshot(int argc, char **argv) sn.date_nsec = tv.tv_usec *1000 ; ret =bdrv_snapshot_create (bs, &sn); -if (ret) +if (ret) {error ("Could not create snapshot '%s': %d (%s)" , snapshot_name, ret,strerror (-ret)); + }break ;case SNAPSHOT_APPLY : ret =bdrv_snapshot_goto (bs, snapshot_name); -if (ret) +if (ret) {error ("Could not apply snapshot '%s': %d (%s)" , snapshot_name, ret,strerror (-ret)); + }break ;case SNAPSHOT_DELETE : ret =bdrv_snapshot_delete (bs, snapshot_name); -if (ret) +if (ret) {error ("Could not delete snapshot '%s': %d (%s)" , snapshot_name, ret,strerror (-ret)); + }break ; }
@@ -1262,8 +1285,9 @@ static int img_rebase(int argc, char **argv)for (;;) { c =getopt (argc, argv,"uhf:F:b:" ); -if (c ==-1 ) +if (c ==-1 ) {break ; + }switch (c) {case 'h' :help ();
@@ -1283,8 +1307,9 @@ static int img_rebase(int argc, char **argv) } } -if ((optind >= argc) || !out_baseimg) +if ((optind >= argc) || !out_baseimg) {help (); + } filename = argv[optind++];/*
Signature · 1 line
1.7.2.3
PATCH 7/14 Fail if detecting an unknown option
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
This patch changes qemu-img to exit if an unknown option is detected, instead of trying to continue with a set of arguments which may be incorrect.
--- qemu-img.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
qemu-img.c +8 -0
@@ -309,6 +309,7 @@ static int img_create(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();break ;
@@ -477,6 +478,7 @@ static int img_check(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();break ;
@@ -555,6 +557,7 @@ static int img_commit(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();break ;
@@ -693,6 +696,7 @@ static int img_convert(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();break ;
@@ -1097,6 +1101,7 @@ static int img_info(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();break ;
@@ -1174,6 +1179,7 @@ static int img_snapshot(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();return 0 ;
@@ -1289,6 +1295,7 @@ static int img_rebase(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();return 0 ;
@@ -1503,6 +1510,7 @@ static int img_resize(int argc, char **argv)break ; }switch (c) { +case '?' :case 'h' :help ();break ;
Signature · 1 line
1.7.2.3
PATCH 8/14 Make error handling more consistent in img_create() and img_resize()
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
--- qemu-img.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)
qemu-img.c +12 -6
@@ -349,13 +349,15 @@ static int img_create(int argc, char **argv) drv =bdrv_find_format (fmt);if (!drv) {error ("Unknown file format '%s'" , fmt); -return 1 ; + ret =-1 ; + goto out; } proto_drv =bdrv_find_protocol (filename);if (!proto_drv) {error ("Unknown protocol '%s'" , filename); -return 1 ; + ret =-1 ; + goto out; } create_options = append_option_parameters(create_options,
@@ -1492,7 +1494,7 @@ static int img_resize(int argc, char **argv)int c, ret, relative;const char *filename, *fmt, *size;int64_t n, total_size; -BlockDriverState *bs; +BlockDriverState *bs =NULL ;QEMUOptionParameter *param;QEMUOptionParameter resize_options[] = { {
@@ -1544,14 +1546,16 @@ static int img_resize(int argc, char **argv) param =parse_option_parameters ("" , resize_options,NULL );if (set_option_parameter (param,BLOCK_OPT_SIZE , size)) {/* Error message already printed when size parsing fails */ -exit (1 ); + ret =-1 ; + goto out; } n =get_option_parameter (param,BLOCK_OPT_SIZE )->value.n;free_option_parameters (param); bs =bdrv_new_open (filename, fmt,BDRV_O_FLAGS |BDRV_O_RDWR );if (!bs) { -return 1 ; + ret =-1 ; + goto out; }if (relative) {
@@ -1581,7 +1585,9 @@ static int img_resize(int argc, char **argv)break ; } out: -bdrv_delete (bs); +if (bs) { +bdrv_delete (bs); + }if (ret) {return 1 ; }
Signature · 1 line
1.7.2.3
PATCH 9/14 ceph/rbd block driver for qemu-kvm
In reply to Kevin WolfFrom: Christian Brunner <[email protected]>
RBD is an block driver for the distributed file system Ceph
(http://ceph.newdream.net/). This driver uses librados (which is part of the Ceph server) for direct access to the Ceph object store and is running entirely in userspace (Yehuda also wrote a driver for the linux kernel, that can be used to access rbd volumes as a block device).
--- Makefile.objs | 1 + block/rbd.c | 1059 +++++++++++++++++++++++++++++++++++++++++++++++++++++ block/rbd_types.h | 71 ++++ configure | 52 +++ 4 files changed, 1183 insertions(+), 0 deletions(-) create mode 100644 block/rbd.c create mode 100644 block/rbd_types.h
Makefile.objs +1 -0
@@ -24,6 +24,7 @@ block-nested-y += parallels.o nbd.o blkdebug.o sheepdog.o blkverify.o block-nested-$(CONFIG_WIN32) += raw-win32.o block-nested-$(CONFIG_POSIX) += raw-posix.o block-nested-$(CONFIG_CURL) += curl.o +block-nested-$(CONFIG_RBD) += rbd.o block-obj-y += $(addprefix block/, $(block-nested-y))
block/rbd.c new file +1059 -0
1,059 lines not on this page · raw message
block/rbd_types.h new file +71 -0
71 lines not on this page · raw message
configure +52 -0
88 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 10/14 qemu-img: Deprecate obsolete -6 and -e options
In reply to Kevin WolfFrom: Jes Sorensen <[email protected]>
If -6 or -e is specified, an error message is printed and we exit. It does not print help() to avoid the error message getting lost in the noise.
--- block_int.h | 1 - qemu-img.c | 53 ++++++++++++++++++++++------------------------------- 2 files changed, 22 insertions(+), 32 deletions(-)
block_int.h +0 -1
@@ -29,7 +29,6 @@#include "qemu-queue.h" #define BLOCK_FLAG_ENCRYPT 1 -#define BLOCK_FLAG_COMPRESS 2#define BLOCK_FLAG_COMPAT6 4#define BLOCK_OPT_SIZE "size"
qemu-img.c +22 -31
124 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 11/14 qemu-option: Don't reinvent append_option_parameters()
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
parse_option_parameters() may need to create a new option parameter list from a template list. Use append_option_parameters() instead of duplicating the code.
--- qemu-option.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-)
qemu-option.c +1 -8
@@ -416,20 +416,13 @@ QEMUOptionParameter *parse_option_parameters(const char *param,char value[256 ];char *param_delim, *value_delim;char next_delim; -size_t num_options;if (list ==NULL ) {return NULL ; }if (dest ==NULL ) { -// Count valid options - num_options =count_option_parameters (list); - -// Create a copy of the option list to fill in values - dest =qemu_mallocz ((num_options +1 ) *sizeof (QEMUOptionParameter)); - allocated = dest; -memcpy (dest, list, (num_options +1 ) *sizeof (QEMUOptionParameter)); + dest = allocated =append_option_parameters (NULL , list); }while (*param) {
Signature · 1 line
1.7.2.3
PATCH 12/14 qemu-option: Fix parse_option_parameters() documentation typo
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
Yoda said, "list is the templace is". Fix this.
--- qemu-option.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-option.c +2 -2
@@ -394,8 +394,8 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest,/* * Parses a parameter string (param) into an option list (dest). * -* list is the templace is. If dest is NULL, a new copy of list is created for -* it. If list is NULL, this function fails. +* list is the template option list. If dest is NULL, a new copy of list is +* created. If list is NULL, this function fails. * * A parameter string consists of one or more parameters, separated by commas. * Each parameter consists of its name and possibly of a value. In the latter
Signature · 1 line
1.7.2.3
PATCH 13/14 qemu-img: Free option parameter lists in img_create()
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
Free option parameter lists in the img_create() error return path.
--- qemu-img.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-img.c +2 -2
@@ -428,8 +428,6 @@ static int img_create(int argc, char **argv)puts ("" ); ret =bdrv_create (drv, filename, param); -free_option_parameters (create_options); -free_option_parameters (param);if (ret <0 ) {if (ret == -ENOTSUP ) {
@@ -441,6 +439,8 @@ static int img_create(int argc, char **argv) } } out: +free_option_parameters (create_options); +free_option_parameters (param);if (ret) {return 1 ; }
Signature · 1 line
1.7.2.3
PATCH 14/14 qemu-img: Fail creation if backing format is invalid
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
The qemu-img create command should check the backing format to ensure only image files with valid backing formats are created. By checking in qemu-img.c we can print a useful error message.
--- qemu-img.c | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-)
qemu-img.c +12 -10
@@ -288,6 +288,7 @@ static int img_create(int argc, char **argv)const char *base_filename =NULL ;BlockDriver *drv, *proto_drv;QEMUOptionParameter *param =NULL , *create_options =NULL ; +QEMUOptionParameter *backing_fmt =NULL ;char *options =NULL ;for (;;) {
@@ -379,14 +380,22 @@ static int img_create(int argc, char **argv) goto out; } + backing_fmt =get_option_parameter (param,BLOCK_OPT_BACKING_FMT ); +if (backing_fmt && backing_fmt->value.s) { +if (!bdrv_find_format (backing_fmt->value.s)) { +error ("Unknown backing file format '%s'" , + backing_fmt->value.s); + ret =-1 ; + goto out; + } + } +// The size for the image must always be specified, with one exception: // If we are using a backing file, we can obtain the size from there if (get_option_parameter (param,BLOCK_OPT_SIZE )->value.n ==-1 ) {QEMUOptionParameter *backing_file =get_option_parameter (param,BLOCK_OPT_BACKING_FILE ); -QEMUOptionParameter *backing_fmt = -get_option_parameter (param,BLOCK_OPT_BACKING_FMT );if (backing_file && backing_file->value.s) {BlockDriverState *bs;
@@ -395,14 +404,7 @@ static int img_create(int argc, char **argv)char buf[32 ];if (backing_fmt && backing_fmt->value.s) { -if (bdrv_find_format (backing_fmt->value.s)) { - fmt = backing_fmt->value.s; - }else { -error ("Unknown backing file format '%s'" , - backing_fmt->value.s); - ret =-1 ; - goto out; - } + fmt = backing_fmt->value.s; } bs =bdrv_new_open (backing_file->value.s, fmt,BDRV_O_FLAGS );
Signature · 1 line
1.7.2.3
Am 09.12.2010 12:09, schrieb Kevin Wolf:
Quoted 27 lines
The following changes since commit
138b38b61bf92d4e9588acf934e532499c94e185:ppc: kvm: fix signedness warning (2010-12-08 21:30:19 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.gitfor-anthonyChristian Brunner (1):
ceph/rbd block driver for qemu-kvmJes Sorensen (8):
Add missing tracing toqemu_mallocz()
Useqemu_mallocz()instead ofcalloc()inimg_convert()img_convert(): Only try to free bs[] entries if bs is valid. Consolidate printing of block driver options
Fix formatting and missing braces inqemu-img.c
Fail if detecting an unknown option
Make error handling more consistent inimg_create()andimg_resize()
qemu-img: Deprecate obsolete -6 and -e optionsStefan Hajnoczi (5):
block: Makebdrv_create_file()':' handling consistent
qemu-option: Don't reinventappend_option_parameters()
qemu-option: Fixparse_option_parameters()documentation typo
qemu-img: Free option parameter lists inimg_create()
qemu-img: Fail creation if backing format is invalid
Quoted 12 lines
Makefile.objs | 1 + block.c | 2 +- block/rbd.c | 1059 +++++++++++++++++++++++++++++++++++++++++++++++++++++ block/rbd_types.h | 71 ++++ block_int.h | 1 - configure | 52 +++ qemu-img.c | 247 ++++++++----- qemu-malloc.c | 5 +- qemu-option.c | 13 +- 9 files changed, 1344 insertions(+), 107 deletions(-) create mode 100644 block/rbd.c create mode 100644 block/rbd_types.h
Ping?
Kevin
Quoted 10 lines · Kevin Wolf
The following changes since commit
138b38b61bf92d4e9588acf934e532499c94e185:ppc: kvm: fix signedness warning (2010-12-08 21:30:19 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.gitfor-anthonyChristian Brunner (1):
ceph/rbd block driver for qemu-kvm
Pulled. Thanks.
Regards,
Anthony Liguori
Quoted 32 lines
Jes Sorensen (8):
Add missing tracing toqemu_mallocz()
Useqemu_mallocz()instead ofcalloc()inimg_convert()img_convert(): Only try to free bs[] entries if bs is valid. Consolidate printing of block driver options
Fix formatting and missing braces inqemu-img.c
Fail if detecting an unknown option
Make error handling more consistent inimg_create()andimg_resize()
qemu-img: Deprecate obsolete -6 and -e optionsStefan Hajnoczi (5):
block: Makebdrv_create_file()':' handling consistent
qemu-option: Don't reinventappend_option_parameters()
qemu-option: Fixparse_option_parameters()documentation typo
qemu-img: Free option parameter lists inimg_create()
qemu-img: Fail creation if backing format is invalidMakefile.objs | 1 + block.c | 2 +- block/rbd.c | 1059 +++++++++++++++++++++++++++++++++++++++++++++++++++++ block/rbd_types.h | 71 ++++ block_int.h | 1 - configure | 52 +++ qemu-img.c | 247 ++++++++----- qemu-malloc.c | 5 +- qemu-option.c | 13 +- 9 files changed, 1344 insertions(+), 107 deletions(-)create mode 100644
block/rbd.c
create mode 100644block/rbd_types.h