Block patches
The following changes since commit a1cf5fac2b929ffa2abd1285401f2535ff8c6fea:
Merge remote-tracking branch 'remotes/armbru/tags/pull-block-2017-02-21' into staging (2017-02-21 13:58:50 +0000)
are available in the git repository at:
[email protected]:codyprime/qemu-kvm-jtc.git tags/block-pull-request
for you to fetch changes up to 6135c5e12606b8413708384e3e7d43f6010c5941:
qemu-options: Fix broken sheepdog URL (2017-02-21 10:38:09 -0500)
----------------------------------------------------------------
Block patches
----------------------------------------------------------------
Anton Nefedov (1):
mirror: do not increase offset during initial zero_or_discard phase
Jeff Cody (1):
QAPI: Fix blockdev-add example documentation
Kevin Wolf (6):
iscsi: Split URL into individual options
iscsi: Handle -iscsi user/password in bdrv_parse_filename()
iscsi: Add initiator-name option
iscsi: Add header-digest option
iscsi: Add timeout option
iscsi: Add blockdev-add support
Thomas Huth (1):
qemu-options: Fix broken sheepdog URL
block/iscsi.c | 353 +++++++++++++++++++++++++++++++-------------------- block/mirror.c | 9 +- qapi/block-core.json | 125 +++++++++++++----- qemu-options.hx | 2 +- 4 files changed, 317 insertions(+), 172 deletions(-)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 3/9] iscsi: Add initiator-name option
From: Kevin Wolf <[email protected]>
This was previously only available with -iscsi. Again, after this patch, the -iscsi option only takes effect if an URL is given. New users are supposed to use the new driver-specific option.
--- block/iscsi.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
block/iscsi.c +15 -17
@@ -1321,26 +1321,15 @@ static void parse_header_digest(struct iscsi_context *iscsi, const char *target, } } -static char *parse_initiator_name (const char *target) +static char *get_initiator_name (QemuOpts *opts) { -QemuOptsList *list; -QemuOpts *opts;const char *name;char *iscsi_name;UuidInfo *uuid_info; - list =qemu_find_opts ("iscsi" ); -if (list) { - opts =qemu_opts_find (list, target); -if (!opts) { - opts =QTAILQ_FIRST (&list->head); - } -if (opts) { - name =qemu_opt_get (opts,"initiator-name" ); -if (name) { -return g_strdup (name); - } - } + name =qemu_opt_get (opts,"initiator-name" ); +if (name) { +return g_strdup (name); } uuid_info =qmp_query_uuid (NULL );
@@ -1589,7 +1578,7 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) {QemuOptsList *list;QemuOpts *opts; -const char *user, *password, *password_secret; +const char *user, *password, *password_secret, *initiator_name; list =qemu_find_opts ("iscsi" );if (!list) {
@@ -1618,6 +1607,11 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options)if (password_secret) {qdict_set_default_str (options,"password-secret" , password_secret); } + + initiator_name =qemu_opt_get (opts,"initiator-name" ); +if (initiator_name) { +qdict_set_default_str (options,"initiator-name" , initiator_name); + } }/*
@@ -1706,6 +1700,10 @@ static QemuOptsList runtime_opts = { .name = "lun", .type = QEMU_OPT_NUMBER, }, + { + .name = "initiator-name", + .type = QEMU_OPT_STRING, + }, {/* end of list */ } }, };
@@ -1762,7 +1760,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,memset (iscsilun,0 ,sizeof (IscsiLun)); - initiator_name =parse_initiator_name (target); + initiator_name =get_initiator_name (opts); iscsi =iscsi_create_context (initiator_name);if (iscsi ==NULL ) {
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 5/9] iscsi: Add timeout option
In reply to Jeff CodyFrom: Kevin Wolf <[email protected]>
This was previously only available with -iscsi. Again, after this patch, the -iscsi option only takes effect if an URL is given. New users are supposed to use the new driver-specific option.
All -iscsi options have a corresponding driver-specific option for the iscsi block driver now.
--- block/iscsi.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-)
block/iscsi.c +11 -26
@@ -1327,29 +1327,6 @@ static char *get_initiator_name(QemuOpts *opts)return iscsi_name; } -static int parse_timeout (const char *target) -{ -QemuOptsList *list; -QemuOpts *opts; -const char *timeout; - - list =qemu_find_opts ("iscsi" ); -if (list) { - opts =qemu_opts_find (list, target); -if (!opts) { - opts =QTAILQ_FIRST (&list->head); - } -if (opts) { - timeout =qemu_opt_get (opts,"timeout" ); -if (timeout) { -return atoi (timeout); - } - } - } - -return 0 ; -} -static void iscsi_nop_timed_event (void *opaque) {IscsiLun *iscsilun = opaque;
@@ -1562,7 +1539,7 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options)QemuOptsList *list;QemuOpts *opts;const char *user, *password, *password_secret, *initiator_name, - *header_digest; + *header_digest, *timeout; list =qemu_find_opts ("iscsi" );if (!list) {
@@ -1601,6 +1578,11 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options)if (header_digest) {qdict_set_default_str (options,"header-digest" , header_digest); } + + timeout =qemu_opt_get (opts,"timeout" ); +if (timeout) { +qdict_set_default_str (options,"timeout" , timeout); + } }/*
@@ -1656,7 +1638,6 @@ static void iscsi_parse_filename(const char *filename, QDict *options,iscsi_destroy_url (iscsi_url); } -/* TODO Add -iscsi options */ static QemuOptsList runtime_opts = { .name ="iscsi" , .head =QTAILQ_HEAD_INITIALIZER (runtime_opts.head),
@@ -1697,6 +1678,10 @@ static QemuOptsList runtime_opts = { .name = "header-digest", .type = QEMU_OPT_STRING, }, + { + .name = "timeout", + .type = QEMU_OPT_NUMBER, + }, {/* end of list */ } }, };
@@ -1797,7 +1782,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, }/* timeout handling is broken in libiscsi before 1.15.0 */ - timeout =parse_timeout (target); + timeout =qemu_opt_get_number (opts,"timeout" ,0 );#if LIBISCSI_API_VERSION >=20150621 iscsi_set_timeout (iscsi, timeout);#else
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 2/9] iscsi: Handle -iscsi user/password in bdrv_parse_filename()
In reply to Jeff CodyFrom: Kevin Wolf <[email protected]>
This splits the logic in the old parse_chap() function into a part that parses the -iscsi options into the new driver-specific options, and another part that actually applies those options (called apply_chap() now).
Note that this means that username and password specified with -iscsi only take effect when a URL is provided. This is intentional, -iscsi is a legacy interface only supported for compatibility, new users should use the proper driver-specific options.
--- block/iscsi.c | 78 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 34 deletions(-)
block/iscsi.c +44 -34
@@ -1245,29 +1245,14 @@ retry:return 0 ; } -static void parse_chap (struct iscsi_context *iscsi,const char *target, +static void apply_chap (struct iscsi_context *iscsi,QemuOpts *opts,Error **errp) { -QemuOptsList *list; -QemuOpts *opts;const char *user =NULL ;const char *password =NULL ;const char *secretid;char *secret =NULL ; - list =qemu_find_opts ("iscsi" ); -if (!list) { -return ; - } - - opts =qemu_opts_find (list, target); -if (opts ==NULL ) { - opts =QTAILQ_FIRST (&list->head); -if (!opts) { -return ; - } - } - user =qemu_opt_get (opts,"user" );if (!user) {return ;
@@ -1600,6 +1585,41 @@ out: } } +static void iscsi_parse_iscsi_option (const char *target,QDict *options) +{ +QemuOptsList *list; +QemuOpts *opts; +const char *user, *password, *password_secret; + + list =qemu_find_opts ("iscsi" ); +if (!list) { +return ; + } + + opts =qemu_opts_find (list, target); +if (opts ==NULL ) { + opts =QTAILQ_FIRST (&list->head); +if (!opts) { +return ; + } + } + + user =qemu_opt_get (opts,"user" ); +if (user) { +qdict_set_default_str (options,"user" , user); + } + + password =qemu_opt_get (opts,"password" ); +if (password) { +qdict_set_default_str (options,"password" , password); + } + + password_secret =qemu_opt_get (opts,"password-secret" ); +if (password_secret) { +qdict_set_default_str (options,"password-secret" , password_secret); + } +} +/* * We support iscsi url's on the form * iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
@@ -1642,6 +1662,9 @@ static void iscsi_parse_filename(const char *filename, QDict *options,qdict_set_default_str (options,"lun" , lun_str);g_free (lun_str); +/* User/password from -iscsi take precedence over those from the URL */ +iscsi_parse_iscsi_option (iscsi_url->target, options); +if (iscsi_url->user[0 ] !='\0' ) {qdict_set_default_str (options,"user" , iscsi_url->user);qdict_set_default_str (options,"password" , iscsi_url->passwd);
@@ -1676,6 +1699,10 @@ static QemuOptsList runtime_opts = { .type = QEMU_OPT_STRING, }, { + .name = "password-secret", + .type = QEMU_OPT_STRING, + }, + { .name = "lun", .type = QEMU_OPT_NUMBER, },
@@ -1695,7 +1722,6 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,QemuOpts *opts;Error *local_err =NULL ;const char *transport_name, *portal, *target; -const char *user, *password;#if LIBISCSI_API_VERSION >= (20160603 )enum iscsi_transport_type transport;#endif
@@ -1712,8 +1738,6 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, transport_name =qemu_opt_get (opts,"transport" ); portal =qemu_opt_get (opts,"portal" ); target =qemu_opt_get (opts,"target" ); - user =qemu_opt_get (opts,"user" ); - password =qemu_opt_get (opts,"password" ); lun =qemu_opt_get_number (opts,"lun" ,0 );if (!transport_name || !portal || !target) {
@@ -1721,11 +1745,6 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, ret = -EINVAL ; goto out; } -if (user && !password) { -error_setg (errp,"If a user name is given, a password is required" ); - ret = -EINVAL ; - goto out; - }if (!strcmp (transport_name,"tcp" )) {#if LIBISCSI_API_VERSION >= (20160603 )
@@ -1764,17 +1783,8 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, goto out; } -if (user) { - ret =iscsi_set_initiator_username_pwd (iscsi, user, password); -if (ret !=0 ) { -error_setg (errp,"Failed to set initiator username and password" ); - ret = -EINVAL ; - goto out; - } - } -/* check if we got CHAP username/password via the options */ -parse_chap (iscsi, target, &local_err); +apply_chap (iscsi, opts, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err); ret = -EINVAL ;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 4/9] iscsi: Add header-digest option
In reply to Jeff CodyFrom: Kevin Wolf <[email protected]>
This was previously only available with -iscsi. Again, after this patch, the -iscsi option only takes effect if an URL is given. New users are supposed to use the new driver-specific option.
--- block/iscsi.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-)
block/iscsi.c +15 -24
@@ -1283,32 +1283,15 @@ static void apply_chap(struct iscsi_context *iscsi, QemuOpts *opts,g_free (secret); } -static void parse_header_digest (struct iscsi_context *iscsi,const char *target, +static void apply_header_digest (struct iscsi_context *iscsi,QemuOpts *opts,Error **errp) { -QemuOptsList *list; -QemuOpts *opts;const char *digest =NULL ; - list =qemu_find_opts ("iscsi" ); -if (!list) { -return ; - } - - opts =qemu_opts_find (list, target); -if (opts ==NULL ) { - opts =QTAILQ_FIRST (&list->head); -if (!opts) { -return ; - } - } - digest =qemu_opt_get (opts,"header-digest" );if (!digest) { -return ; - } - -if (!strcmp (digest,"CRC32C" )) { +iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_NONE_CRC32C ); + }else if (!strcmp (digest,"CRC32C" )) {iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_CRC32C ); }else if (!strcmp (digest,"NONE" )) {iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_NONE );
@@ -1578,7 +1561,8 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) {QemuOptsList *list;QemuOpts *opts; -const char *user, *password, *password_secret, *initiator_name; +const char *user, *password, *password_secret, *initiator_name, + *header_digest; list =qemu_find_opts ("iscsi" );if (!list) {
@@ -1612,6 +1596,11 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options)if (initiator_name) {qdict_set_default_str (options,"initiator-name" , initiator_name); } + + header_digest =qemu_opt_get (opts,"header-digest" ); +if (header_digest) { +qdict_set_default_str (options,"header-digest" , header_digest); + } }/*
@@ -1704,6 +1693,10 @@ static QemuOptsList runtime_opts = { .name = "initiator-name", .type = QEMU_OPT_STRING, }, + { + .name = "header-digest", + .type = QEMU_OPT_STRING, + }, {/* end of list */ } }, };
@@ -1795,10 +1788,8 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, goto out; } -iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_NONE_CRC32C ); -/* check if we got HEADER_DIGEST via the options */ -parse_header_digest (iscsi, target, &local_err); +apply_header_digest (iscsi, opts, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err); ret = -EINVAL ;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 7/9] QAPI: Fix blockdev-add example documentation
In reply to Jeff Cody--- qapi/block-core.json | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-)
qapi/block-core.json +25 -25
@@ -2910,34 +2910,36 @@ # 1. # -> { "execute": "blockdev-add", # "arguments": { -# "options" : { "driver": "qcow2", -# "file": { "driver": "file", -# "filename": "test.qcow2" } } } } +# "driver": "qcow2", +# "node-name": "test1", +# "file": { +# "driver": "file", +# "filename": "test.qcow2" +# } +# } +# } # <- { "return": {} } # # 2. # -> { "execute": "blockdev-add", # "arguments": { -# "options": { -# "driver": "qcow2", -# "node-name": "node0", -# "discard": "unmap", -# "cache": { -# "direct": true, -# "writeback": true +# "driver": "qcow2", +# "node-name": "node0", +# "discard": "unmap", +# "cache": { +# "direct": true # }, # "file": { -# "driver": "file", -# "filename": "/tmp/test.qcow2" +# "driver": "file", +# "filename": "/tmp/test.qcow2" # }, # "backing": { -# "driver": "raw", -# "file": { -# "driver": "file", -# "filename": "/dev/fdset/4" +# "driver": "raw", +# "file": { +# "driver": "file", +# "filename": "/dev/fdset/4" # } # } -# } # } # } #
@@ -2965,14 +2967,12 @@ # # -> { "execute": "blockdev-add", # "arguments": { -# "options": { -# "driver": "qcow2", -# "node-name": "node0", -# "file": { -# "driver": "file", -# "filename": "test.qcow2" -# } -# } +# "driver": "qcow2", +# "node-name": "node0", +# "file": { +# "driver": "file", +# "filename": "test.qcow2" +# } # } # } # <- { "return": {} }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 1/9] iscsi: Split URL into individual options
In reply to Jeff CodyFrom: Kevin Wolf <[email protected]>
This introduces a .bdrv_parse_filename handler for iscsi which parses an URL if given and translates it to individual options.
--- block/iscsi.c | 193 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 140 insertions(+), 53 deletions(-)
block/iscsi.c +140 -53
@@ -1483,20 +1483,6 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) } } -/* TODO Convert to fine grained options */ -static QemuOptsList runtime_opts = { - .name ="iscsi" , - .head =QTAILQ_HEAD_INITIALIZER (runtime_opts.head), - .desc = { - { - .name ="filename" , - .type =QEMU_OPT_STRING , - .help ="URL to the iscsi image" , - }, - {/* end of list */ } - }, -}; -static struct scsi_task *iscsi_do_inquiry (struct iscsi_context *iscsi,int lun,int evpd,int pc,void **inq,Error **errp) {
@@ -1618,20 +1604,102 @@ out:* We support iscsi url's on the form * iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun> */ +static void iscsi_parse_filename (const char *filename,QDict *options, +Error **errp) +{ +struct iscsi_url *iscsi_url; +const char *transport_name; +char *lun_str; + + iscsi_url =iscsi_parse_full_url (NULL , filename); +if (iscsi_url ==NULL ) { +error_setg (errp,"Failed to parse URL : %s" , filename); +return ; + } + +#if LIBISCSI_API_VERSION >= (20160603 ) +switch (iscsi_url->transport) { +case TCP_TRANSPORT : + transport_name ="tcp" ; +break ; +case ISER_TRANSPORT : + transport_name ="iser" ; +break ; +default : +error_setg (errp,"Unknown transport type (%d)" , + iscsi_url->transport); +return ; + } +#else + transport_name ="tcp" ; +#endif + +qdict_set_default_str (options,"transport" , transport_name); +qdict_set_default_str (options,"portal" , iscsi_url->portal); +qdict_set_default_str (options,"target" , iscsi_url->target); + + lun_str =g_strdup_printf ("%d" , iscsi_url->lun); +qdict_set_default_str (options,"lun" , lun_str); +g_free (lun_str); + +if (iscsi_url->user[0 ] !='\0' ) { +qdict_set_default_str (options,"user" , iscsi_url->user); +qdict_set_default_str (options,"password" , iscsi_url->passwd); + } + +iscsi_destroy_url (iscsi_url); +} + +/* TODO Add -iscsi options */ +static QemuOptsList runtime_opts = { + .name ="iscsi" , + .head =QTAILQ_HEAD_INITIALIZER (runtime_opts.head), + .desc = { + { + .name ="transport" , + .type =QEMU_OPT_STRING , + }, + { + .name ="portal" , + .type =QEMU_OPT_STRING , + }, + { + .name ="target" , + .type =QEMU_OPT_STRING , + }, + { + .name ="user" , + .type =QEMU_OPT_STRING , + }, + { + .name ="password" , + .type =QEMU_OPT_STRING , + }, + { + .name ="lun" , + .type =QEMU_OPT_NUMBER , + }, + {/* end of list */ } + }, +}; +static int iscsi_open (BlockDriverState *bs,QDict *options,int flags,Error **errp) {IscsiLun *iscsilun = bs->opaque;struct iscsi_context *iscsi =NULL ; -struct iscsi_url *iscsi_url =NULL ;struct scsi_task *task =NULL ;struct scsi_inquiry_standard *inq =NULL ;struct scsi_inquiry_supported_pages *inq_vpd;char *initiator_name =NULL ;QemuOpts *opts;Error *local_err =NULL ; -const char *filename; -int i, ret =0 , timeout =0 ; +const char *transport_name, *portal, *target; +const char *user, *password; +#if LIBISCSI_API_VERSION >= (20160603 ) +enum iscsi_transport_type transport; +#endif +int i, ret =0 , timeout =0 , lun; opts =qemu_opts_create (&runtime_opts,NULL ,0 , &error_abort);qemu_opts_absorb_qdict (opts, options, &local_err);
@@ -1641,18 +1709,41 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, goto out; } - filename =qemu_opt_get (opts,"filename" ); + transport_name =qemu_opt_get (opts,"transport" ); + portal =qemu_opt_get (opts,"portal" ); + target =qemu_opt_get (opts,"target" ); + user =qemu_opt_get (opts,"user" ); + password =qemu_opt_get (opts,"password" ); + lun =qemu_opt_get_number (opts,"lun" ,0 ); - iscsi_url =iscsi_parse_full_url (iscsi, filename); -if (iscsi_url ==NULL ) { -error_setg (errp,"Failed to parse URL : %s" , filename); +if (!transport_name || !portal || !target) { +error_setg (errp,"Need all of transport, portal and target options" ); + ret = -EINVAL ; + goto out; + } +if (user && !password) { +error_setg (errp,"If a user name is given, a password is required" ); + ret = -EINVAL ; + goto out; + } + +if (!strcmp (transport_name,"tcp" )) { +#if LIBISCSI_API_VERSION >= (20160603 ) + transport = TCP_TRANSPORT; + }else if (!strcmp (transport_name,"iser" )) { + transport =ISER_TRANSPORT ; +#else +/* TCP is what older libiscsi versions always use */ +#endif + }else { +error_setg (errp,"Unknown transport: %s" , transport_name); ret = -EINVAL ; goto out; }memset (iscsilun,0 ,sizeof (IscsiLun)); - initiator_name =parse_initiator_name (iscsi_url->target); + initiator_name =parse_initiator_name (target); iscsi =iscsi_create_context (initiator_name);if (iscsi ==NULL ) {
@@ -1661,21 +1752,20 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, goto out; }#if LIBISCSI_API_VERSION >= (20160603 ) -if (iscsi_init_transport (iscsi, iscsi_url->transport)) { +if (iscsi_init_transport (iscsi, transport)) {error_setg (errp, ("Error initializing transport." )); ret = -EINVAL ; goto out; }#endif -if (iscsi_set_targetname (iscsi, iscsi_url->target)) { +if (iscsi_set_targetname (iscsi, target)) {error_setg (errp,"iSCSI: Failed to set target name." ); ret = -EINVAL ; goto out; } -if (iscsi_url->user[0 ] !='\0' ) { - ret =iscsi_set_initiator_username_pwd (iscsi, iscsi_url->user, - iscsi_url->passwd); +if (user) { + ret =iscsi_set_initiator_username_pwd (iscsi, user, password);if (ret !=0 ) {error_setg (errp,"Failed to set initiator username and password" ); ret = -EINVAL ;
@@ -1684,7 +1774,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, }/* check if we got CHAP username/password via the options */ -parse_chap (iscsi, iscsi_url->target, &local_err); +parse_chap (iscsi, target, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err); ret = -EINVAL ;
@@ -1700,7 +1790,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_NONE_CRC32C );/* check if we got HEADER_DIGEST via the options */ -parse_header_digest (iscsi, iscsi_url->target, &local_err); +parse_header_digest (iscsi, target, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err); ret = -EINVAL ;
@@ -1708,7 +1798,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, }/* timeout handling is broken in libiscsi before 1.15.0 */ - timeout =parse_timeout (iscsi_url->target); + timeout =parse_timeout (target);#if LIBISCSI_API_VERSION >=20150621 iscsi_set_timeout (iscsi, timeout);#else
@@ -1717,7 +1807,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, }#endif -if (iscsi_full_connect_sync (iscsi, iscsi_url->portal, iscsi_url->lun) !=0 ) { +if (iscsi_full_connect_sync (iscsi, portal, lun) !=0 ) {error_setg (errp,"iSCSI: Failed to connect to LUN : %s" ,iscsi_get_error (iscsi)); ret = -EINVAL ;
@@ -1726,7 +1816,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, iscsilun->iscsi = iscsi; iscsilun->aio_context =bdrv_get_aio_context (bs); - iscsilun->lun = iscsi_url->lun; + iscsilun->lun = lun; iscsilun->has_write_same = true; task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 0, 0,
@@ -1829,9 +1919,6 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, out:qemu_opts_del (opts);g_free (initiator_name); -if (iscsi_url !=NULL ) { -iscsi_destroy_url (iscsi_url); - }if (task !=NULL ) {scsi_free_scsi_task (task); }
@@ -2040,15 +2127,15 @@ static BlockDriver bdrv_iscsi = { .format_name = "iscsi", .protocol_name = "iscsi", - .instance_size = sizeof(IscsiLun), - .bdrv_needs_filename = true, - .bdrv_file_open = iscsi_open, - .bdrv_close = iscsi_close, - .bdrv_create = iscsi_create, - .create_opts = &iscsi_create_opts, - .bdrv_reopen_prepare = iscsi_reopen_prepare, - .bdrv_reopen_commit = iscsi_reopen_commit, - .bdrv_invalidate_cache = iscsi_invalidate_cache, + .instance_size = sizeof(IscsiLun), + .bdrv_parse_filename = iscsi_parse_filename, + .bdrv_file_open = iscsi_open, + .bdrv_close = iscsi_close, + .bdrv_create = iscsi_create, + .create_opts = &iscsi_create_opts, + .bdrv_reopen_prepare = iscsi_reopen_prepare, + .bdrv_reopen_commit = iscsi_reopen_commit, + .bdrv_invalidate_cache = iscsi_invalidate_cache, .bdrv_getlength = iscsi_getlength, .bdrv_get_info = iscsi_get_info,
@@ -2075,15 +2162,15 @@ static BlockDriver bdrv_iser = { .format_name = "iser", .protocol_name = "iser", - .instance_size = sizeof(IscsiLun), - .bdrv_needs_filename = true, - .bdrv_file_open = iscsi_open, - .bdrv_close = iscsi_close, - .bdrv_create = iscsi_create, - .create_opts = &iscsi_create_opts, - .bdrv_reopen_prepare = iscsi_reopen_prepare, - .bdrv_reopen_commit = iscsi_reopen_commit, - .bdrv_invalidate_cache = iscsi_invalidate_cache, + .instance_size = sizeof(IscsiLun), + .bdrv_parse_filename = iscsi_parse_filename, + .bdrv_file_open = iscsi_open, + .bdrv_close = iscsi_close, + .bdrv_create = iscsi_create, + .create_opts = &iscsi_create_opts, + .bdrv_reopen_prepare = iscsi_reopen_prepare, + .bdrv_reopen_commit = iscsi_reopen_commit, + .bdrv_invalidate_cache = iscsi_invalidate_cache, .bdrv_getlength = iscsi_getlength, .bdrv_get_info = iscsi_get_info,
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 9/9] qemu-options: Fix broken sheepdog URL
In reply to Jeff CodyFrom: Thomas Huth <[email protected]>
The sheepdog URL is broken twice: First it uses a duplicated
http:// prefix, second the website seems to have moved to
https://sheepdog.github.io/sheepdog/ instead.
--- qemu-options.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-options.hx +1 -1
@@ -2586,7 +2586,7 @@ Example qemu-system-i386 --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine @end example -See also @url{http://http://www.osrg.net/sheepdog/}. +See also @url{https://sheepdog.github.io/sheepdog/}. @item GlusterFS GlusterFS is a user space distributed file system.
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 8/9] mirror: do not increase offset during initial zero_or_discard phase
In reply to Jeff CodyFrom: Anton Nefedov <[email protected]>
If explicit zeroing out before mirroring is required for the target image, it moves the block job offset counter to EOF, then offset and len counters count the image size twice. There is no harm but stats are confusing, specifically the progress of the operation is always reported as 99% by management tools.
The patch skips offset increase for the first "technical" pass over the image. This should not cause any further harm.
Message-id: [email protected]
--- block/mirror.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
block/mirror.c +7 -2
@@ -69,6 +69,7 @@ typedef struct MirrorBlockJob {bool waiting_for_io;int target_cluster_sectors;int max_iov; +bool initial_zeroing_ongoing; } MirrorBlockJob; typedef struct MirrorOp {
@@ -117,9 +118,10 @@ static void mirror_iteration_done(MirrorOp *op, int ret)if (s->cow_bitmap) {bitmap_set (s->cow_bitmap, chunk_num, nb_chunks); } - s->common.offset += (uint64_t )op->nb_sectors *BDRV_SECTOR_SIZE ; +if (!s->initial_zeroing_ongoing) { + s->common.offset += (uint64_t )op->nb_sectors *BDRV_SECTOR_SIZE ; + } } -qemu_iovec_destroy (&op->qiov);g_free (op);
@@ -572,6 +574,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)return 0 ; } + s->initial_zeroing_ongoing = true;for (sector_num =0 ; sector_num < end; ) {int nb_sectors =MIN (end - sector_num,QEMU_ALIGN_DOWN (INT_MAX , s->granularity) >>BDRV_SECTOR_BITS );
@@ -579,6 +582,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)mirror_throttle (s);if (block_job_is_cancelled (&s->common)) { + s->initial_zeroing_ongoing = false;return 0 ; }
@@ -593,6 +597,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s) }mirror_wait_for_all_io (s); + s->initial_zeroing_ongoing = false; }/* First part, loop on the sectors and initialize the dirty bitmap. */
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 6/9] iscsi: Add blockdev-add support
In reply to Jeff CodyFrom: Kevin Wolf <[email protected]>
This adds blockdev-add support for iscsi devices.
--- block/iscsi.c | 14 ++++++---- qapi/block-core.json | 75 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 79 insertions(+), 10 deletions(-)
block/iscsi.c +9 -5
@@ -1291,13 +1291,13 @@ static void apply_header_digest(struct iscsi_context *iscsi, QemuOpts *opts, digest =qemu_opt_get (opts,"header-digest" );if (!digest) {iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_NONE_CRC32C ); - }else if (!strcmp (digest,"CRC32C" )) { + }else if (!strcmp (digest,"crc32c" )) {iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_CRC32C ); - }else if (!strcmp (digest,"NONE" )) { + }else if (!strcmp (digest,"none" )) {iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_NONE ); - }else if (!strcmp (digest,"CRC32C-NONE" )) { + }else if (!strcmp (digest,"crc32c-none" )) {iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_CRC32C_NONE ); - }else if (!strcmp (digest,"NONE-CRC32C" )) { + }else if (!strcmp (digest,"none-crc32c" )) {iscsi_set_header_digest (iscsi,ISCSI_HEADER_DIGEST_NONE_CRC32C ); }else {error_setg (errp,"Invalid header-digest setting : %s" , digest);
@@ -1576,7 +1576,11 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) header_digest =qemu_opt_get (opts,"header-digest" );if (header_digest) { -qdict_set_default_str (options,"header-digest" , header_digest); +/* -iscsi takes upper case values, but QAPI only supports lower case +* enum constant names, so we have to convert here. */ +char *qapi_value =g_ascii_strdown (header_digest,-1 ); +qdict_set_default_str (options,"header-digest" , qapi_value); +g_free (qapi_value); } timeout =qemu_opt_get (opts,"timeout" );
qapi/block-core.json +70 -5
99 lines not on this page · raw message
Signature · 1 line
2.9.3
Peter Maydell
AppliedQuoted 6 lines · Jeff Cody
The following changes since commit
a1cf5fac2b929ffa2abd1285401f2535ff8c6fea:Merge remote-tracking branch 'remotes/armbru/tags/pull-block-2017-02-21' into staging (2017-02-21 13:58:50 +0000)
are available in the git repository at:
Quoted 8 lines
[email protected]:codyprime/qemu-kvm-jtc.git tags/block-pull-request
for you to fetch changes up to
6135c5e12606b8413708384e3e7d43f6010c5941:qemu-options: Fix broken sheepdog URL (2017-02-21 10:38:09 -0500)
----------------------------------------------------------------
Block patches
Applied, thanks.
-- PMM