1 | The following changes since commit a1cf5fac2b929ffa2abd1285401f2535ff8c6fea: | 1 | The following changes since commit 64175afc695c0672876fbbfc31b299c86d562cb4: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/armbru/tags/pull-block-2017-02-21' into staging (2017-02-21 13:58:50 +0000) | 3 | arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented (2017-06-07 17:21:44 +0100) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the git repository at: |
6 | 6 | ||
7 | git@github.com:codyprime/qemu-kvm-jtc.git tags/block-pull-request | 7 | git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 6135c5e12606b8413708384e3e7d43f6010c5941: | 9 | for you to fetch changes up to 56faeb9bb6872b3f926b3b3e0452a70beea10af2: |
10 | 10 | ||
11 | qemu-options: Fix broken sheepdog URL (2017-02-21 10:38:09 -0500) | 11 | block/gluster.c: Handle qdict_array_entries() failure (2017-06-09 08:41:29 -0400) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches | 14 | Gluster patch |
15 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
16 | 16 | ||
17 | Anton Nefedov (1): | 17 | Peter Maydell (1): |
18 | mirror: do not increase offset during initial zero_or_discard phase | 18 | block/gluster.c: Handle qdict_array_entries() failure |
19 | 19 | ||
20 | Jeff Cody (1): | 20 | block/gluster.c | 3 +-- |
21 | QAPI: Fix blockdev-add example documentation | 21 | 1 file changed, 1 insertion(+), 2 deletions(-) |
22 | |||
23 | Kevin Wolf (6): | ||
24 | iscsi: Split URL into individual options | ||
25 | iscsi: Handle -iscsi user/password in bdrv_parse_filename() | ||
26 | iscsi: Add initiator-name option | ||
27 | iscsi: Add header-digest option | ||
28 | iscsi: Add timeout option | ||
29 | iscsi: Add blockdev-add support | ||
30 | |||
31 | Thomas Huth (1): | ||
32 | qemu-options: Fix broken sheepdog URL | ||
33 | |||
34 | block/iscsi.c | 353 +++++++++++++++++++++++++++++++-------------------- | ||
35 | block/mirror.c | 9 +- | ||
36 | qapi/block-core.json | 125 +++++++++++++----- | ||
37 | qemu-options.hx | 2 +- | ||
38 | 4 files changed, 317 insertions(+), 172 deletions(-) | ||
39 | 22 | ||
40 | -- | 23 | -- |
41 | 2.9.3 | 24 | 2.9.3 |
42 | 25 | ||
43 | 26 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Kevin Wolf <kwolf@redhat.com> | ||
2 | 1 | ||
3 | This introduces a .bdrv_parse_filename handler for iscsi which parses an | ||
4 | URL if given and translates it to individual options. | ||
5 | |||
6 | Reviewed-by: Fam Zheng <famz@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
8 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
9 | --- | ||
10 | block/iscsi.c | 193 ++++++++++++++++++++++++++++++++++++++++++---------------- | ||
11 | 1 file changed, 140 insertions(+), 53 deletions(-) | ||
12 | |||
13 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/block/iscsi.c | ||
16 | +++ b/block/iscsi.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) | ||
18 | } | ||
19 | } | ||
20 | |||
21 | -/* TODO Convert to fine grained options */ | ||
22 | -static QemuOptsList runtime_opts = { | ||
23 | - .name = "iscsi", | ||
24 | - .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head), | ||
25 | - .desc = { | ||
26 | - { | ||
27 | - .name = "filename", | ||
28 | - .type = QEMU_OPT_STRING, | ||
29 | - .help = "URL to the iscsi image", | ||
30 | - }, | ||
31 | - { /* end of list */ } | ||
32 | - }, | ||
33 | -}; | ||
34 | - | ||
35 | static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun, | ||
36 | int evpd, int pc, void **inq, Error **errp) | ||
37 | { | ||
38 | @@ -XXX,XX +XXX,XX @@ out: | ||
39 | * We support iscsi url's on the form | ||
40 | * iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun> | ||
41 | */ | ||
42 | +static void iscsi_parse_filename(const char *filename, QDict *options, | ||
43 | + Error **errp) | ||
44 | +{ | ||
45 | + struct iscsi_url *iscsi_url; | ||
46 | + const char *transport_name; | ||
47 | + char *lun_str; | ||
48 | + | ||
49 | + iscsi_url = iscsi_parse_full_url(NULL, filename); | ||
50 | + if (iscsi_url == NULL) { | ||
51 | + error_setg(errp, "Failed to parse URL : %s", filename); | ||
52 | + return; | ||
53 | + } | ||
54 | + | ||
55 | +#if LIBISCSI_API_VERSION >= (20160603) | ||
56 | + switch (iscsi_url->transport) { | ||
57 | + case TCP_TRANSPORT: | ||
58 | + transport_name = "tcp"; | ||
59 | + break; | ||
60 | + case ISER_TRANSPORT: | ||
61 | + transport_name = "iser"; | ||
62 | + break; | ||
63 | + default: | ||
64 | + error_setg(errp, "Unknown transport type (%d)", | ||
65 | + iscsi_url->transport); | ||
66 | + return; | ||
67 | + } | ||
68 | +#else | ||
69 | + transport_name = "tcp"; | ||
70 | +#endif | ||
71 | + | ||
72 | + qdict_set_default_str(options, "transport", transport_name); | ||
73 | + qdict_set_default_str(options, "portal", iscsi_url->portal); | ||
74 | + qdict_set_default_str(options, "target", iscsi_url->target); | ||
75 | + | ||
76 | + lun_str = g_strdup_printf("%d", iscsi_url->lun); | ||
77 | + qdict_set_default_str(options, "lun", lun_str); | ||
78 | + g_free(lun_str); | ||
79 | + | ||
80 | + if (iscsi_url->user[0] != '\0') { | ||
81 | + qdict_set_default_str(options, "user", iscsi_url->user); | ||
82 | + qdict_set_default_str(options, "password", iscsi_url->passwd); | ||
83 | + } | ||
84 | + | ||
85 | + iscsi_destroy_url(iscsi_url); | ||
86 | +} | ||
87 | + | ||
88 | +/* TODO Add -iscsi options */ | ||
89 | +static QemuOptsList runtime_opts = { | ||
90 | + .name = "iscsi", | ||
91 | + .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head), | ||
92 | + .desc = { | ||
93 | + { | ||
94 | + .name = "transport", | ||
95 | + .type = QEMU_OPT_STRING, | ||
96 | + }, | ||
97 | + { | ||
98 | + .name = "portal", | ||
99 | + .type = QEMU_OPT_STRING, | ||
100 | + }, | ||
101 | + { | ||
102 | + .name = "target", | ||
103 | + .type = QEMU_OPT_STRING, | ||
104 | + }, | ||
105 | + { | ||
106 | + .name = "user", | ||
107 | + .type = QEMU_OPT_STRING, | ||
108 | + }, | ||
109 | + { | ||
110 | + .name = "password", | ||
111 | + .type = QEMU_OPT_STRING, | ||
112 | + }, | ||
113 | + { | ||
114 | + .name = "lun", | ||
115 | + .type = QEMU_OPT_NUMBER, | ||
116 | + }, | ||
117 | + { /* end of list */ } | ||
118 | + }, | ||
119 | +}; | ||
120 | + | ||
121 | static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
122 | Error **errp) | ||
123 | { | ||
124 | IscsiLun *iscsilun = bs->opaque; | ||
125 | struct iscsi_context *iscsi = NULL; | ||
126 | - struct iscsi_url *iscsi_url = NULL; | ||
127 | struct scsi_task *task = NULL; | ||
128 | struct scsi_inquiry_standard *inq = NULL; | ||
129 | struct scsi_inquiry_supported_pages *inq_vpd; | ||
130 | char *initiator_name = NULL; | ||
131 | QemuOpts *opts; | ||
132 | Error *local_err = NULL; | ||
133 | - const char *filename; | ||
134 | - int i, ret = 0, timeout = 0; | ||
135 | + const char *transport_name, *portal, *target; | ||
136 | + const char *user, *password; | ||
137 | +#if LIBISCSI_API_VERSION >= (20160603) | ||
138 | + enum iscsi_transport_type transport; | ||
139 | +#endif | ||
140 | + int i, ret = 0, timeout = 0, lun; | ||
141 | |||
142 | opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); | ||
143 | qemu_opts_absorb_qdict(opts, options, &local_err); | ||
144 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
145 | goto out; | ||
146 | } | ||
147 | |||
148 | - filename = qemu_opt_get(opts, "filename"); | ||
149 | + transport_name = qemu_opt_get(opts, "transport"); | ||
150 | + portal = qemu_opt_get(opts, "portal"); | ||
151 | + target = qemu_opt_get(opts, "target"); | ||
152 | + user = qemu_opt_get(opts, "user"); | ||
153 | + password = qemu_opt_get(opts, "password"); | ||
154 | + lun = qemu_opt_get_number(opts, "lun", 0); | ||
155 | |||
156 | - iscsi_url = iscsi_parse_full_url(iscsi, filename); | ||
157 | - if (iscsi_url == NULL) { | ||
158 | - error_setg(errp, "Failed to parse URL : %s", filename); | ||
159 | + if (!transport_name || !portal || !target) { | ||
160 | + error_setg(errp, "Need all of transport, portal and target options"); | ||
161 | + ret = -EINVAL; | ||
162 | + goto out; | ||
163 | + } | ||
164 | + if (user && !password) { | ||
165 | + error_setg(errp, "If a user name is given, a password is required"); | ||
166 | + ret = -EINVAL; | ||
167 | + goto out; | ||
168 | + } | ||
169 | + | ||
170 | + if (!strcmp(transport_name, "tcp")) { | ||
171 | +#if LIBISCSI_API_VERSION >= (20160603) | ||
172 | + transport = TCP_TRANSPORT; | ||
173 | + } else if (!strcmp(transport_name, "iser")) { | ||
174 | + transport = ISER_TRANSPORT; | ||
175 | +#else | ||
176 | + /* TCP is what older libiscsi versions always use */ | ||
177 | +#endif | ||
178 | + } else { | ||
179 | + error_setg(errp, "Unknown transport: %s", transport_name); | ||
180 | ret = -EINVAL; | ||
181 | goto out; | ||
182 | } | ||
183 | |||
184 | memset(iscsilun, 0, sizeof(IscsiLun)); | ||
185 | |||
186 | - initiator_name = parse_initiator_name(iscsi_url->target); | ||
187 | + initiator_name = parse_initiator_name(target); | ||
188 | |||
189 | iscsi = iscsi_create_context(initiator_name); | ||
190 | if (iscsi == NULL) { | ||
191 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
192 | goto out; | ||
193 | } | ||
194 | #if LIBISCSI_API_VERSION >= (20160603) | ||
195 | - if (iscsi_init_transport(iscsi, iscsi_url->transport)) { | ||
196 | + if (iscsi_init_transport(iscsi, transport)) { | ||
197 | error_setg(errp, ("Error initializing transport.")); | ||
198 | ret = -EINVAL; | ||
199 | goto out; | ||
200 | } | ||
201 | #endif | ||
202 | - if (iscsi_set_targetname(iscsi, iscsi_url->target)) { | ||
203 | + if (iscsi_set_targetname(iscsi, target)) { | ||
204 | error_setg(errp, "iSCSI: Failed to set target name."); | ||
205 | ret = -EINVAL; | ||
206 | goto out; | ||
207 | } | ||
208 | |||
209 | - if (iscsi_url->user[0] != '\0') { | ||
210 | - ret = iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user, | ||
211 | - iscsi_url->passwd); | ||
212 | + if (user) { | ||
213 | + ret = iscsi_set_initiator_username_pwd(iscsi, user, password); | ||
214 | if (ret != 0) { | ||
215 | error_setg(errp, "Failed to set initiator username and password"); | ||
216 | ret = -EINVAL; | ||
217 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
218 | } | ||
219 | |||
220 | /* check if we got CHAP username/password via the options */ | ||
221 | - parse_chap(iscsi, iscsi_url->target, &local_err); | ||
222 | + parse_chap(iscsi, target, &local_err); | ||
223 | if (local_err != NULL) { | ||
224 | error_propagate(errp, local_err); | ||
225 | ret = -EINVAL; | ||
226 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
227 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C); | ||
228 | |||
229 | /* check if we got HEADER_DIGEST via the options */ | ||
230 | - parse_header_digest(iscsi, iscsi_url->target, &local_err); | ||
231 | + parse_header_digest(iscsi, target, &local_err); | ||
232 | if (local_err != NULL) { | ||
233 | error_propagate(errp, local_err); | ||
234 | ret = -EINVAL; | ||
235 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
236 | } | ||
237 | |||
238 | /* timeout handling is broken in libiscsi before 1.15.0 */ | ||
239 | - timeout = parse_timeout(iscsi_url->target); | ||
240 | + timeout = parse_timeout(target); | ||
241 | #if LIBISCSI_API_VERSION >= 20150621 | ||
242 | iscsi_set_timeout(iscsi, timeout); | ||
243 | #else | ||
244 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
245 | } | ||
246 | #endif | ||
247 | |||
248 | - if (iscsi_full_connect_sync(iscsi, iscsi_url->portal, iscsi_url->lun) != 0) { | ||
249 | + if (iscsi_full_connect_sync(iscsi, portal, lun) != 0) { | ||
250 | error_setg(errp, "iSCSI: Failed to connect to LUN : %s", | ||
251 | iscsi_get_error(iscsi)); | ||
252 | ret = -EINVAL; | ||
253 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
254 | |||
255 | iscsilun->iscsi = iscsi; | ||
256 | iscsilun->aio_context = bdrv_get_aio_context(bs); | ||
257 | - iscsilun->lun = iscsi_url->lun; | ||
258 | + iscsilun->lun = lun; | ||
259 | iscsilun->has_write_same = true; | ||
260 | |||
261 | task = iscsi_do_inquiry(iscsilun->iscsi, iscsilun->lun, 0, 0, | ||
262 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
263 | out: | ||
264 | qemu_opts_del(opts); | ||
265 | g_free(initiator_name); | ||
266 | - if (iscsi_url != NULL) { | ||
267 | - iscsi_destroy_url(iscsi_url); | ||
268 | - } | ||
269 | if (task != NULL) { | ||
270 | scsi_free_scsi_task(task); | ||
271 | } | ||
272 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_iscsi = { | ||
273 | .format_name = "iscsi", | ||
274 | .protocol_name = "iscsi", | ||
275 | |||
276 | - .instance_size = sizeof(IscsiLun), | ||
277 | - .bdrv_needs_filename = true, | ||
278 | - .bdrv_file_open = iscsi_open, | ||
279 | - .bdrv_close = iscsi_close, | ||
280 | - .bdrv_create = iscsi_create, | ||
281 | - .create_opts = &iscsi_create_opts, | ||
282 | - .bdrv_reopen_prepare = iscsi_reopen_prepare, | ||
283 | - .bdrv_reopen_commit = iscsi_reopen_commit, | ||
284 | - .bdrv_invalidate_cache = iscsi_invalidate_cache, | ||
285 | + .instance_size = sizeof(IscsiLun), | ||
286 | + .bdrv_parse_filename = iscsi_parse_filename, | ||
287 | + .bdrv_file_open = iscsi_open, | ||
288 | + .bdrv_close = iscsi_close, | ||
289 | + .bdrv_create = iscsi_create, | ||
290 | + .create_opts = &iscsi_create_opts, | ||
291 | + .bdrv_reopen_prepare = iscsi_reopen_prepare, | ||
292 | + .bdrv_reopen_commit = iscsi_reopen_commit, | ||
293 | + .bdrv_invalidate_cache = iscsi_invalidate_cache, | ||
294 | |||
295 | .bdrv_getlength = iscsi_getlength, | ||
296 | .bdrv_get_info = iscsi_get_info, | ||
297 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_iser = { | ||
298 | .format_name = "iser", | ||
299 | .protocol_name = "iser", | ||
300 | |||
301 | - .instance_size = sizeof(IscsiLun), | ||
302 | - .bdrv_needs_filename = true, | ||
303 | - .bdrv_file_open = iscsi_open, | ||
304 | - .bdrv_close = iscsi_close, | ||
305 | - .bdrv_create = iscsi_create, | ||
306 | - .create_opts = &iscsi_create_opts, | ||
307 | - .bdrv_reopen_prepare = iscsi_reopen_prepare, | ||
308 | - .bdrv_reopen_commit = iscsi_reopen_commit, | ||
309 | - .bdrv_invalidate_cache = iscsi_invalidate_cache, | ||
310 | + .instance_size = sizeof(IscsiLun), | ||
311 | + .bdrv_parse_filename = iscsi_parse_filename, | ||
312 | + .bdrv_file_open = iscsi_open, | ||
313 | + .bdrv_close = iscsi_close, | ||
314 | + .bdrv_create = iscsi_create, | ||
315 | + .create_opts = &iscsi_create_opts, | ||
316 | + .bdrv_reopen_prepare = iscsi_reopen_prepare, | ||
317 | + .bdrv_reopen_commit = iscsi_reopen_commit, | ||
318 | + .bdrv_invalidate_cache = iscsi_invalidate_cache, | ||
319 | |||
320 | .bdrv_getlength = iscsi_getlength, | ||
321 | .bdrv_get_info = iscsi_get_info, | ||
322 | -- | ||
323 | 2.9.3 | ||
324 | |||
325 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Kevin Wolf <kwolf@redhat.com> | ||
2 | 1 | ||
3 | This splits the logic in the old parse_chap() function into a part that | ||
4 | parses the -iscsi options into the new driver-specific options, and | ||
5 | another part that actually applies those options (called apply_chap() | ||
6 | now). | ||
7 | |||
8 | Note that this means that username and password specified with -iscsi | ||
9 | only take effect when a URL is provided. This is intentional, -iscsi is | ||
10 | a legacy interface only supported for compatibility, new users should | ||
11 | use the proper driver-specific options. | ||
12 | |||
13 | Reviewed-by: Fam Zheng <famz@redhat.com> | ||
14 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
15 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
16 | --- | ||
17 | block/iscsi.c | 78 +++++++++++++++++++++++++++++++++-------------------------- | ||
18 | 1 file changed, 44 insertions(+), 34 deletions(-) | ||
19 | |||
20 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/block/iscsi.c | ||
23 | +++ b/block/iscsi.c | ||
24 | @@ -XXX,XX +XXX,XX @@ retry: | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | -static void parse_chap(struct iscsi_context *iscsi, const char *target, | ||
29 | +static void apply_chap(struct iscsi_context *iscsi, QemuOpts *opts, | ||
30 | Error **errp) | ||
31 | { | ||
32 | - QemuOptsList *list; | ||
33 | - QemuOpts *opts; | ||
34 | const char *user = NULL; | ||
35 | const char *password = NULL; | ||
36 | const char *secretid; | ||
37 | char *secret = NULL; | ||
38 | |||
39 | - list = qemu_find_opts("iscsi"); | ||
40 | - if (!list) { | ||
41 | - return; | ||
42 | - } | ||
43 | - | ||
44 | - opts = qemu_opts_find(list, target); | ||
45 | - if (opts == NULL) { | ||
46 | - opts = QTAILQ_FIRST(&list->head); | ||
47 | - if (!opts) { | ||
48 | - return; | ||
49 | - } | ||
50 | - } | ||
51 | - | ||
52 | user = qemu_opt_get(opts, "user"); | ||
53 | if (!user) { | ||
54 | return; | ||
55 | @@ -XXX,XX +XXX,XX @@ out: | ||
56 | } | ||
57 | } | ||
58 | |||
59 | +static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
60 | +{ | ||
61 | + QemuOptsList *list; | ||
62 | + QemuOpts *opts; | ||
63 | + const char *user, *password, *password_secret; | ||
64 | + | ||
65 | + list = qemu_find_opts("iscsi"); | ||
66 | + if (!list) { | ||
67 | + return; | ||
68 | + } | ||
69 | + | ||
70 | + opts = qemu_opts_find(list, target); | ||
71 | + if (opts == NULL) { | ||
72 | + opts = QTAILQ_FIRST(&list->head); | ||
73 | + if (!opts) { | ||
74 | + return; | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | + user = qemu_opt_get(opts, "user"); | ||
79 | + if (user) { | ||
80 | + qdict_set_default_str(options, "user", user); | ||
81 | + } | ||
82 | + | ||
83 | + password = qemu_opt_get(opts, "password"); | ||
84 | + if (password) { | ||
85 | + qdict_set_default_str(options, "password", password); | ||
86 | + } | ||
87 | + | ||
88 | + password_secret = qemu_opt_get(opts, "password-secret"); | ||
89 | + if (password_secret) { | ||
90 | + qdict_set_default_str(options, "password-secret", password_secret); | ||
91 | + } | ||
92 | +} | ||
93 | + | ||
94 | /* | ||
95 | * We support iscsi url's on the form | ||
96 | * iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun> | ||
97 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_filename(const char *filename, QDict *options, | ||
98 | qdict_set_default_str(options, "lun", lun_str); | ||
99 | g_free(lun_str); | ||
100 | |||
101 | + /* User/password from -iscsi take precedence over those from the URL */ | ||
102 | + iscsi_parse_iscsi_option(iscsi_url->target, options); | ||
103 | + | ||
104 | if (iscsi_url->user[0] != '\0') { | ||
105 | qdict_set_default_str(options, "user", iscsi_url->user); | ||
106 | qdict_set_default_str(options, "password", iscsi_url->passwd); | ||
107 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList runtime_opts = { | ||
108 | .type = QEMU_OPT_STRING, | ||
109 | }, | ||
110 | { | ||
111 | + .name = "password-secret", | ||
112 | + .type = QEMU_OPT_STRING, | ||
113 | + }, | ||
114 | + { | ||
115 | .name = "lun", | ||
116 | .type = QEMU_OPT_NUMBER, | ||
117 | }, | ||
118 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
119 | QemuOpts *opts; | ||
120 | Error *local_err = NULL; | ||
121 | const char *transport_name, *portal, *target; | ||
122 | - const char *user, *password; | ||
123 | #if LIBISCSI_API_VERSION >= (20160603) | ||
124 | enum iscsi_transport_type transport; | ||
125 | #endif | ||
126 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
127 | transport_name = qemu_opt_get(opts, "transport"); | ||
128 | portal = qemu_opt_get(opts, "portal"); | ||
129 | target = qemu_opt_get(opts, "target"); | ||
130 | - user = qemu_opt_get(opts, "user"); | ||
131 | - password = qemu_opt_get(opts, "password"); | ||
132 | lun = qemu_opt_get_number(opts, "lun", 0); | ||
133 | |||
134 | if (!transport_name || !portal || !target) { | ||
135 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
136 | ret = -EINVAL; | ||
137 | goto out; | ||
138 | } | ||
139 | - if (user && !password) { | ||
140 | - error_setg(errp, "If a user name is given, a password is required"); | ||
141 | - ret = -EINVAL; | ||
142 | - goto out; | ||
143 | - } | ||
144 | |||
145 | if (!strcmp(transport_name, "tcp")) { | ||
146 | #if LIBISCSI_API_VERSION >= (20160603) | ||
147 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
148 | goto out; | ||
149 | } | ||
150 | |||
151 | - if (user) { | ||
152 | - ret = iscsi_set_initiator_username_pwd(iscsi, user, password); | ||
153 | - if (ret != 0) { | ||
154 | - error_setg(errp, "Failed to set initiator username and password"); | ||
155 | - ret = -EINVAL; | ||
156 | - goto out; | ||
157 | - } | ||
158 | - } | ||
159 | - | ||
160 | /* check if we got CHAP username/password via the options */ | ||
161 | - parse_chap(iscsi, target, &local_err); | ||
162 | + apply_chap(iscsi, opts, &local_err); | ||
163 | if (local_err != NULL) { | ||
164 | error_propagate(errp, local_err); | ||
165 | ret = -EINVAL; | ||
166 | -- | ||
167 | 2.9.3 | ||
168 | |||
169 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Kevin Wolf <kwolf@redhat.com> | ||
2 | 1 | ||
3 | This was previously only available with -iscsi. Again, after this patch, | ||
4 | the -iscsi option only takes effect if an URL is given. New users are | ||
5 | supposed to use the new driver-specific option. | ||
6 | |||
7 | Reviewed-by: Daniel P. Berrange <berrange@redhat.com> | ||
8 | Reviewed-by: Fam Zheng <famz@redhat.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
10 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
11 | --- | ||
12 | block/iscsi.c | 32 +++++++++++++++----------------- | ||
13 | 1 file changed, 15 insertions(+), 17 deletions(-) | ||
14 | |||
15 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/block/iscsi.c | ||
18 | +++ b/block/iscsi.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void parse_header_digest(struct iscsi_context *iscsi, const char *target, | ||
20 | } | ||
21 | } | ||
22 | |||
23 | -static char *parse_initiator_name(const char *target) | ||
24 | +static char *get_initiator_name(QemuOpts *opts) | ||
25 | { | ||
26 | - QemuOptsList *list; | ||
27 | - QemuOpts *opts; | ||
28 | const char *name; | ||
29 | char *iscsi_name; | ||
30 | UuidInfo *uuid_info; | ||
31 | |||
32 | - list = qemu_find_opts("iscsi"); | ||
33 | - if (list) { | ||
34 | - opts = qemu_opts_find(list, target); | ||
35 | - if (!opts) { | ||
36 | - opts = QTAILQ_FIRST(&list->head); | ||
37 | - } | ||
38 | - if (opts) { | ||
39 | - name = qemu_opt_get(opts, "initiator-name"); | ||
40 | - if (name) { | ||
41 | - return g_strdup(name); | ||
42 | - } | ||
43 | - } | ||
44 | + name = qemu_opt_get(opts, "initiator-name"); | ||
45 | + if (name) { | ||
46 | + return g_strdup(name); | ||
47 | } | ||
48 | |||
49 | uuid_info = qmp_query_uuid(NULL); | ||
50 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
51 | { | ||
52 | QemuOptsList *list; | ||
53 | QemuOpts *opts; | ||
54 | - const char *user, *password, *password_secret; | ||
55 | + const char *user, *password, *password_secret, *initiator_name; | ||
56 | |||
57 | list = qemu_find_opts("iscsi"); | ||
58 | if (!list) { | ||
59 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
60 | if (password_secret) { | ||
61 | qdict_set_default_str(options, "password-secret", password_secret); | ||
62 | } | ||
63 | + | ||
64 | + initiator_name = qemu_opt_get(opts, "initiator-name"); | ||
65 | + if (initiator_name) { | ||
66 | + qdict_set_default_str(options, "initiator-name", initiator_name); | ||
67 | + } | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList runtime_opts = { | ||
72 | .name = "lun", | ||
73 | .type = QEMU_OPT_NUMBER, | ||
74 | }, | ||
75 | + { | ||
76 | + .name = "initiator-name", | ||
77 | + .type = QEMU_OPT_STRING, | ||
78 | + }, | ||
79 | { /* end of list */ } | ||
80 | }, | ||
81 | }; | ||
82 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
83 | |||
84 | memset(iscsilun, 0, sizeof(IscsiLun)); | ||
85 | |||
86 | - initiator_name = parse_initiator_name(target); | ||
87 | + initiator_name = get_initiator_name(opts); | ||
88 | |||
89 | iscsi = iscsi_create_context(initiator_name); | ||
90 | if (iscsi == NULL) { | ||
91 | -- | ||
92 | 2.9.3 | ||
93 | |||
94 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Kevin Wolf <kwolf@redhat.com> | ||
2 | 1 | ||
3 | This was previously only available with -iscsi. Again, after this patch, | ||
4 | the -iscsi option only takes effect if an URL is given. New users are | ||
5 | supposed to use the new driver-specific option. | ||
6 | |||
7 | Reviewed-by: Daniel P. Berrange <berrange@redhat.com> | ||
8 | Reviewed-by: Fam Zheng <famz@redhat.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
10 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
11 | --- | ||
12 | block/iscsi.c | 39 +++++++++++++++------------------------ | ||
13 | 1 file changed, 15 insertions(+), 24 deletions(-) | ||
14 | |||
15 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/block/iscsi.c | ||
18 | +++ b/block/iscsi.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void apply_chap(struct iscsi_context *iscsi, QemuOpts *opts, | ||
20 | g_free(secret); | ||
21 | } | ||
22 | |||
23 | -static void parse_header_digest(struct iscsi_context *iscsi, const char *target, | ||
24 | +static void apply_header_digest(struct iscsi_context *iscsi, QemuOpts *opts, | ||
25 | Error **errp) | ||
26 | { | ||
27 | - QemuOptsList *list; | ||
28 | - QemuOpts *opts; | ||
29 | const char *digest = NULL; | ||
30 | |||
31 | - list = qemu_find_opts("iscsi"); | ||
32 | - if (!list) { | ||
33 | - return; | ||
34 | - } | ||
35 | - | ||
36 | - opts = qemu_opts_find(list, target); | ||
37 | - if (opts == NULL) { | ||
38 | - opts = QTAILQ_FIRST(&list->head); | ||
39 | - if (!opts) { | ||
40 | - return; | ||
41 | - } | ||
42 | - } | ||
43 | - | ||
44 | digest = qemu_opt_get(opts, "header-digest"); | ||
45 | if (!digest) { | ||
46 | - return; | ||
47 | - } | ||
48 | - | ||
49 | - if (!strcmp(digest, "CRC32C")) { | ||
50 | + iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C); | ||
51 | + } else if (!strcmp(digest, "CRC32C")) { | ||
52 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_CRC32C); | ||
53 | } else if (!strcmp(digest, "NONE")) { | ||
54 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE); | ||
55 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
56 | { | ||
57 | QemuOptsList *list; | ||
58 | QemuOpts *opts; | ||
59 | - const char *user, *password, *password_secret, *initiator_name; | ||
60 | + const char *user, *password, *password_secret, *initiator_name, | ||
61 | + *header_digest; | ||
62 | |||
63 | list = qemu_find_opts("iscsi"); | ||
64 | if (!list) { | ||
65 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
66 | if (initiator_name) { | ||
67 | qdict_set_default_str(options, "initiator-name", initiator_name); | ||
68 | } | ||
69 | + | ||
70 | + header_digest = qemu_opt_get(opts, "header-digest"); | ||
71 | + if (header_digest) { | ||
72 | + qdict_set_default_str(options, "header-digest", header_digest); | ||
73 | + } | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList runtime_opts = { | ||
78 | .name = "initiator-name", | ||
79 | .type = QEMU_OPT_STRING, | ||
80 | }, | ||
81 | + { | ||
82 | + .name = "header-digest", | ||
83 | + .type = QEMU_OPT_STRING, | ||
84 | + }, | ||
85 | { /* end of list */ } | ||
86 | }, | ||
87 | }; | ||
88 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
89 | goto out; | ||
90 | } | ||
91 | |||
92 | - iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C); | ||
93 | - | ||
94 | /* check if we got HEADER_DIGEST via the options */ | ||
95 | - parse_header_digest(iscsi, target, &local_err); | ||
96 | + apply_header_digest(iscsi, opts, &local_err); | ||
97 | if (local_err != NULL) { | ||
98 | error_propagate(errp, local_err); | ||
99 | ret = -EINVAL; | ||
100 | -- | ||
101 | 2.9.3 | ||
102 | |||
103 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Kevin Wolf <kwolf@redhat.com> | ||
2 | 1 | ||
3 | This was previously only available with -iscsi. Again, after this patch, | ||
4 | the -iscsi option only takes effect if an URL is given. New users are | ||
5 | supposed to use the new driver-specific option. | ||
6 | |||
7 | All -iscsi options have a corresponding driver-specific option for the | ||
8 | iscsi block driver now. | ||
9 | |||
10 | Reviewed-by: Daniel P. Berrange <berrange@redhat.com> | ||
11 | Reviewed-by: Fam Zheng <famz@redhat.com> | ||
12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
13 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
14 | --- | ||
15 | block/iscsi.c | 37 +++++++++++-------------------------- | ||
16 | 1 file changed, 11 insertions(+), 26 deletions(-) | ||
17 | |||
18 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/block/iscsi.c | ||
21 | +++ b/block/iscsi.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static char *get_initiator_name(QemuOpts *opts) | ||
23 | return iscsi_name; | ||
24 | } | ||
25 | |||
26 | -static int parse_timeout(const char *target) | ||
27 | -{ | ||
28 | - QemuOptsList *list; | ||
29 | - QemuOpts *opts; | ||
30 | - const char *timeout; | ||
31 | - | ||
32 | - list = qemu_find_opts("iscsi"); | ||
33 | - if (list) { | ||
34 | - opts = qemu_opts_find(list, target); | ||
35 | - if (!opts) { | ||
36 | - opts = QTAILQ_FIRST(&list->head); | ||
37 | - } | ||
38 | - if (opts) { | ||
39 | - timeout = qemu_opt_get(opts, "timeout"); | ||
40 | - if (timeout) { | ||
41 | - return atoi(timeout); | ||
42 | - } | ||
43 | - } | ||
44 | - } | ||
45 | - | ||
46 | - return 0; | ||
47 | -} | ||
48 | - | ||
49 | static void iscsi_nop_timed_event(void *opaque) | ||
50 | { | ||
51 | IscsiLun *iscsilun = opaque; | ||
52 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
53 | QemuOptsList *list; | ||
54 | QemuOpts *opts; | ||
55 | const char *user, *password, *password_secret, *initiator_name, | ||
56 | - *header_digest; | ||
57 | + *header_digest, *timeout; | ||
58 | |||
59 | list = qemu_find_opts("iscsi"); | ||
60 | if (!list) { | ||
61 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
62 | if (header_digest) { | ||
63 | qdict_set_default_str(options, "header-digest", header_digest); | ||
64 | } | ||
65 | + | ||
66 | + timeout = qemu_opt_get(opts, "timeout"); | ||
67 | + if (timeout) { | ||
68 | + qdict_set_default_str(options, "timeout", timeout); | ||
69 | + } | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_filename(const char *filename, QDict *options, | ||
74 | iscsi_destroy_url(iscsi_url); | ||
75 | } | ||
76 | |||
77 | -/* TODO Add -iscsi options */ | ||
78 | static QemuOptsList runtime_opts = { | ||
79 | .name = "iscsi", | ||
80 | .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head), | ||
81 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList runtime_opts = { | ||
82 | .name = "header-digest", | ||
83 | .type = QEMU_OPT_STRING, | ||
84 | }, | ||
85 | + { | ||
86 | + .name = "timeout", | ||
87 | + .type = QEMU_OPT_NUMBER, | ||
88 | + }, | ||
89 | { /* end of list */ } | ||
90 | }, | ||
91 | }; | ||
92 | @@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, | ||
93 | } | ||
94 | |||
95 | /* timeout handling is broken in libiscsi before 1.15.0 */ | ||
96 | - timeout = parse_timeout(target); | ||
97 | + timeout = qemu_opt_get_number(opts, "timeout", 0); | ||
98 | #if LIBISCSI_API_VERSION >= 20150621 | ||
99 | iscsi_set_timeout(iscsi, timeout); | ||
100 | #else | ||
101 | -- | ||
102 | 2.9.3 | ||
103 | |||
104 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Kevin Wolf <kwolf@redhat.com> | ||
2 | 1 | ||
3 | This adds blockdev-add support for iscsi devices. | ||
4 | |||
5 | Reviewed-by: Daniel P. Berrange <berrange@redhat.com> | ||
6 | Reviewed-by: Fam Zheng <famz@redhat.com> | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
8 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
9 | --- | ||
10 | block/iscsi.c | 14 ++++++---- | ||
11 | qapi/block-core.json | 75 ++++++++++++++++++++++++++++++++++++++++++++++++---- | ||
12 | 2 files changed, 79 insertions(+), 10 deletions(-) | ||
13 | |||
14 | diff --git a/block/iscsi.c b/block/iscsi.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/block/iscsi.c | ||
17 | +++ b/block/iscsi.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void apply_header_digest(struct iscsi_context *iscsi, QemuOpts *opts, | ||
19 | digest = qemu_opt_get(opts, "header-digest"); | ||
20 | if (!digest) { | ||
21 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C); | ||
22 | - } else if (!strcmp(digest, "CRC32C")) { | ||
23 | + } else if (!strcmp(digest, "crc32c")) { | ||
24 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_CRC32C); | ||
25 | - } else if (!strcmp(digest, "NONE")) { | ||
26 | + } else if (!strcmp(digest, "none")) { | ||
27 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE); | ||
28 | - } else if (!strcmp(digest, "CRC32C-NONE")) { | ||
29 | + } else if (!strcmp(digest, "crc32c-none")) { | ||
30 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_CRC32C_NONE); | ||
31 | - } else if (!strcmp(digest, "NONE-CRC32C")) { | ||
32 | + } else if (!strcmp(digest, "none-crc32c")) { | ||
33 | iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C); | ||
34 | } else { | ||
35 | error_setg(errp, "Invalid header-digest setting : %s", digest); | ||
36 | @@ -XXX,XX +XXX,XX @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) | ||
37 | |||
38 | header_digest = qemu_opt_get(opts, "header-digest"); | ||
39 | if (header_digest) { | ||
40 | - qdict_set_default_str(options, "header-digest", header_digest); | ||
41 | + /* -iscsi takes upper case values, but QAPI only supports lower case | ||
42 | + * enum constant names, so we have to convert here. */ | ||
43 | + char *qapi_value = g_ascii_strdown(header_digest, -1); | ||
44 | + qdict_set_default_str(options, "header-digest", qapi_value); | ||
45 | + g_free(qapi_value); | ||
46 | } | ||
47 | |||
48 | timeout = qemu_opt_get(opts, "timeout"); | ||
49 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/qapi/block-core.json | ||
52 | +++ b/qapi/block-core.json | ||
53 | @@ -XXX,XX +XXX,XX @@ | ||
54 | # @nfs: Since 2.8 | ||
55 | # @replication: Since 2.8 | ||
56 | # @ssh: Since 2.8 | ||
57 | +# @iscsi: Since 2.9 | ||
58 | # | ||
59 | # Since: 2.0 | ||
60 | ## | ||
61 | { 'enum': 'BlockdevDriver', | ||
62 | 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop', | ||
63 | 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom', | ||
64 | - 'host_device', 'http', 'https', 'luks', 'nbd', 'nfs', 'null-aio', | ||
65 | - 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', | ||
66 | - 'replication', 'ssh', 'vdi', 'vhdx', 'vmdk', 'vpc', | ||
67 | - 'vvfat' ] } | ||
68 | + 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', | ||
69 | + 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', | ||
70 | + 'quorum', 'raw', 'replication', 'ssh', 'vdi', 'vhdx', 'vmdk', | ||
71 | + 'vpc', 'vvfat' ] } | ||
72 | |||
73 | ## | ||
74 | # @BlockdevOptionsFile: | ||
75 | @@ -XXX,XX +XXX,XX @@ | ||
76 | '*logfile': 'str' } } | ||
77 | |||
78 | ## | ||
79 | +# @IscsiTransport: | ||
80 | +# | ||
81 | +# An enumeration of libiscsi transport types | ||
82 | +# | ||
83 | +# Since: 2.9 | ||
84 | +## | ||
85 | +{ 'enum': 'IscsiTransport', | ||
86 | + 'data': [ 'tcp', 'iser' ] } | ||
87 | + | ||
88 | +## | ||
89 | +# @IscsiHeaderDigest: | ||
90 | +# | ||
91 | +# An enumeration of header digests supported by libiscsi | ||
92 | +# | ||
93 | +# Since: 2.9 | ||
94 | +## | ||
95 | +{ 'enum': 'IscsiHeaderDigest', | ||
96 | + 'prefix': 'QAPI_ISCSI_HEADER_DIGEST', | ||
97 | + 'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] } | ||
98 | + | ||
99 | +## | ||
100 | +# @BlockdevOptionsIscsi: | ||
101 | +# | ||
102 | +# @transport The iscsi transport type | ||
103 | +# | ||
104 | +# @portal The address of the iscsi portal | ||
105 | +# | ||
106 | +# @target The target iqn name | ||
107 | +# | ||
108 | +# @lun #optional LUN to connect to. Defaults to 0. | ||
109 | +# | ||
110 | +# @user #optional User name to log in with. If omitted, no CHAP | ||
111 | +# authentication is performed. | ||
112 | +# | ||
113 | +# @password-secret #optional The ID of a QCryptoSecret object providing | ||
114 | +# the password for the login. This option is required if | ||
115 | +# @user is specified. | ||
116 | +# | ||
117 | +# @initiator-name #optional The iqn name we want to identify to the target | ||
118 | +# as. If this option is not specified, an initiator name is | ||
119 | +# generated automatically. | ||
120 | +# | ||
121 | +# @header-digest #optional The desired header digest. Defaults to | ||
122 | +# none-crc32c. | ||
123 | +# | ||
124 | +# @timeout #optional Timeout in seconds after which a request will | ||
125 | +# timeout. 0 means no timeout and is the default. | ||
126 | +# | ||
127 | +# Driver specific block device options for iscsi | ||
128 | +# | ||
129 | +# Since: 2.9 | ||
130 | +## | ||
131 | +{ 'struct': 'BlockdevOptionsIscsi', | ||
132 | + 'data': { 'transport': 'IscsiTransport', | ||
133 | + 'portal': 'str', | ||
134 | + 'target': 'str', | ||
135 | + '*lun': 'int', | ||
136 | + '*user': 'str', | ||
137 | + '*password-secret': 'str', | ||
138 | + '*initiator-name': 'str', | ||
139 | + '*header-digest': 'IscsiHeaderDigest', | ||
140 | + '*timeout': 'int' } } | ||
141 | + | ||
142 | +## | ||
143 | # @ReplicationMode: | ||
144 | # | ||
145 | # An enumeration of replication modes. | ||
146 | @@ -XXX,XX +XXX,XX @@ | ||
147 | 'host_device':'BlockdevOptionsFile', | ||
148 | 'http': 'BlockdevOptionsCurl', | ||
149 | 'https': 'BlockdevOptionsCurl', | ||
150 | -# TODO iscsi: Wait for structured options | ||
151 | + 'iscsi': 'BlockdevOptionsIscsi', | ||
152 | 'luks': 'BlockdevOptionsLUKS', | ||
153 | 'nbd': 'BlockdevOptionsNbd', | ||
154 | 'nfs': 'BlockdevOptionsNfs', | ||
155 | -- | ||
156 | 2.9.3 | ||
157 | |||
158 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
2 | --- | ||
3 | qapi/block-core.json | 50 +++++++++++++++++++++++++------------------------- | ||
4 | 1 file changed, 25 insertions(+), 25 deletions(-) | ||
5 | 1 | ||
6 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
7 | index XXXXXXX..XXXXXXX 100644 | ||
8 | --- a/qapi/block-core.json | ||
9 | +++ b/qapi/block-core.json | ||
10 | @@ -XXX,XX +XXX,XX @@ | ||
11 | # 1. | ||
12 | # -> { "execute": "blockdev-add", | ||
13 | # "arguments": { | ||
14 | -# "options" : { "driver": "qcow2", | ||
15 | -# "file": { "driver": "file", | ||
16 | -# "filename": "test.qcow2" } } } } | ||
17 | +# "driver": "qcow2", | ||
18 | +# "node-name": "test1", | ||
19 | +# "file": { | ||
20 | +# "driver": "file", | ||
21 | +# "filename": "test.qcow2" | ||
22 | +# } | ||
23 | +# } | ||
24 | +# } | ||
25 | # <- { "return": {} } | ||
26 | # | ||
27 | # 2. | ||
28 | # -> { "execute": "blockdev-add", | ||
29 | # "arguments": { | ||
30 | -# "options": { | ||
31 | -# "driver": "qcow2", | ||
32 | -# "node-name": "node0", | ||
33 | -# "discard": "unmap", | ||
34 | -# "cache": { | ||
35 | -# "direct": true, | ||
36 | -# "writeback": true | ||
37 | +# "driver": "qcow2", | ||
38 | +# "node-name": "node0", | ||
39 | +# "discard": "unmap", | ||
40 | +# "cache": { | ||
41 | +# "direct": true | ||
42 | # }, | ||
43 | # "file": { | ||
44 | -# "driver": "file", | ||
45 | -# "filename": "/tmp/test.qcow2" | ||
46 | +# "driver": "file", | ||
47 | +# "filename": "/tmp/test.qcow2" | ||
48 | # }, | ||
49 | # "backing": { | ||
50 | -# "driver": "raw", | ||
51 | -# "file": { | ||
52 | -# "driver": "file", | ||
53 | -# "filename": "/dev/fdset/4" | ||
54 | +# "driver": "raw", | ||
55 | +# "file": { | ||
56 | +# "driver": "file", | ||
57 | +# "filename": "/dev/fdset/4" | ||
58 | # } | ||
59 | # } | ||
60 | -# } | ||
61 | # } | ||
62 | # } | ||
63 | # | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | # | ||
66 | # -> { "execute": "blockdev-add", | ||
67 | # "arguments": { | ||
68 | -# "options": { | ||
69 | -# "driver": "qcow2", | ||
70 | -# "node-name": "node0", | ||
71 | -# "file": { | ||
72 | -# "driver": "file", | ||
73 | -# "filename": "test.qcow2" | ||
74 | -# } | ||
75 | -# } | ||
76 | +# "driver": "qcow2", | ||
77 | +# "node-name": "node0", | ||
78 | +# "file": { | ||
79 | +# "driver": "file", | ||
80 | +# "filename": "test.qcow2" | ||
81 | +# } | ||
82 | # } | ||
83 | # } | ||
84 | # <- { "return": {} } | ||
85 | -- | ||
86 | 2.9.3 | ||
87 | |||
88 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Nefedov <anton.nefedov@virtuozzo.com> | ||
2 | 1 | ||
3 | If explicit zeroing out before mirroring is required for the target image, | ||
4 | it moves the block job offset counter to EOF, then offset and len counters | ||
5 | count the image size twice. There is no harm but stats are confusing, | ||
6 | specifically the progress of the operation is always reported as 99% by | ||
7 | management tools. | ||
8 | |||
9 | The patch skips offset increase for the first "technical" pass over the | ||
10 | image. This should not cause any further harm. | ||
11 | |||
12 | Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> | ||
13 | Signed-off-by: Denis V. Lunev <den@openvz.org> | ||
14 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
15 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
16 | Message-id: 1486045515-8009-1-git-send-email-den@openvz.org | ||
17 | CC: Jeff Cody <jcody@redhat.com> | ||
18 | CC: Kevin Wolf <kwolf@redhat.com> | ||
19 | CC: Max Reitz <mreitz@redhat.com> | ||
20 | CC: Eric Blake <eblake@redhat.com> | ||
21 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
22 | --- | ||
23 | block/mirror.c | 9 +++++++-- | ||
24 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
25 | |||
26 | diff --git a/block/mirror.c b/block/mirror.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/block/mirror.c | ||
29 | +++ b/block/mirror.c | ||
30 | @@ -XXX,XX +XXX,XX @@ typedef struct MirrorBlockJob { | ||
31 | bool waiting_for_io; | ||
32 | int target_cluster_sectors; | ||
33 | int max_iov; | ||
34 | + bool initial_zeroing_ongoing; | ||
35 | } MirrorBlockJob; | ||
36 | |||
37 | typedef struct MirrorOp { | ||
38 | @@ -XXX,XX +XXX,XX @@ static void mirror_iteration_done(MirrorOp *op, int ret) | ||
39 | if (s->cow_bitmap) { | ||
40 | bitmap_set(s->cow_bitmap, chunk_num, nb_chunks); | ||
41 | } | ||
42 | - s->common.offset += (uint64_t)op->nb_sectors * BDRV_SECTOR_SIZE; | ||
43 | + if (!s->initial_zeroing_ongoing) { | ||
44 | + s->common.offset += (uint64_t)op->nb_sectors * BDRV_SECTOR_SIZE; | ||
45 | + } | ||
46 | } | ||
47 | - | ||
48 | qemu_iovec_destroy(&op->qiov); | ||
49 | g_free(op); | ||
50 | |||
51 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s) | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | + s->initial_zeroing_ongoing = true; | ||
56 | for (sector_num = 0; sector_num < end; ) { | ||
57 | int nb_sectors = MIN(end - sector_num, | ||
58 | QEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS); | ||
59 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s) | ||
60 | mirror_throttle(s); | ||
61 | |||
62 | if (block_job_is_cancelled(&s->common)) { | ||
63 | + s->initial_zeroing_ongoing = false; | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s) | ||
68 | } | ||
69 | |||
70 | mirror_wait_for_all_io(s); | ||
71 | + s->initial_zeroing_ongoing = false; | ||
72 | } | ||
73 | |||
74 | /* First part, loop on the sectors and initialize the dirty bitmap. */ | ||
75 | -- | ||
76 | 2.9.3 | ||
77 | |||
78 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Peter Maydell <peter.maydell@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The sheepdog URL is broken twice: First it uses a duplicated | 3 | In qemu_gluster_parse_json(), the call to qdict_array_entries() |
4 | http:// prefix, second the website seems to have moved to | 4 | could return a negative error code, which we were ignoring |
5 | https://sheepdog.github.io/sheepdog/ instead. | 5 | because we assigned the result to an unsigned variable. |
6 | Fix this by using the 'int' type instead, which matches the | ||
7 | return type of qdict_array_entries() and also the type | ||
8 | we use for the loop enumeration variable 'i'. | ||
6 | 9 | ||
7 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 10 | (Spotted by Coverity, CID 1360960.) |
11 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
14 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
15 | Message-id: 1496682098-1540-1-git-send-email-peter.maydell@linaro.org | ||
8 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 16 | Signed-off-by: Jeff Cody <jcody@redhat.com> |
9 | --- | 17 | --- |
10 | qemu-options.hx | 2 +- | 18 | block/gluster.c | 3 +-- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 19 | 1 file changed, 1 insertion(+), 2 deletions(-) |
12 | 20 | ||
13 | diff --git a/qemu-options.hx b/qemu-options.hx | 21 | diff --git a/block/gluster.c b/block/gluster.c |
14 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/qemu-options.hx | 23 | --- a/block/gluster.c |
16 | +++ b/qemu-options.hx | 24 | +++ b/block/gluster.c |
17 | @@ -XXX,XX +XXX,XX @@ Example | 25 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf, |
18 | qemu-system-i386 --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine | 26 | Error *local_err = NULL; |
19 | @end example | 27 | char *str = NULL; |
20 | 28 | const char *ptr; | |
21 | -See also @url{http://http://www.osrg.net/sheepdog/}. | 29 | - size_t num_servers; |
22 | +See also @url{https://sheepdog.github.io/sheepdog/}. | 30 | - int i, type; |
23 | 31 | + int i, type, num_servers; | |
24 | @item GlusterFS | 32 | |
25 | GlusterFS is a user space distributed file system. | 33 | /* create opts info from runtime_json_opts list */ |
34 | opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort); | ||
26 | -- | 35 | -- |
27 | 2.9.3 | 36 | 2.9.3 |
28 | 37 | ||
29 | 38 | diff view generated by jsdifflib |