1
The following changes since commit d47a851caeda96d5979bf48d4bae6a87784ad91d:
1
The following changes since commit 3f0602927b120a480b35dcf58cf6f95435b3ae91:
2
2
3
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170601' into staging (2017-06-02 14:07:53 +0100)
3
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170613' into staging (2017-06-13 15:49:07 +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 df3a429ae82c0f45becdfab105617701d75e0f05:
9
for you to fetch changes up to 5c3ad1a6a8fa041c57403dbe1fc5927eec0be66b:
10
10
11
gluster: add support for PREALLOC_MODE_FALLOC (2017-06-02 10:51:47 -0400)
11
block/iscsi: enable filename option and parsing (2017-06-14 17:39:46 -0400)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Gluster patch(es)
14
Block patches
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
16
17
Niels de Vos (1):
17
Jeff Cody (2):
18
gluster: add support for PREALLOC_MODE_FALLOC
18
block/rbd: enable filename option and parsing
19
block/iscsi: enable filename option and parsing
19
20
20
block/gluster.c | 78 ++++++++++++++++++++++++++++++---------------------------
21
block/iscsi.c | 22 +++++++++++++++++++++-
21
configure | 6 +++++
22
block/rbd.c | 22 +++++++++++++++++++++-
22
2 files changed, 47 insertions(+), 37 deletions(-)
23
2 files changed, 42 insertions(+), 2 deletions(-)
23
24
24
--
25
--
25
2.9.3
26
2.9.3
26
27
27
28
diff view generated by jsdifflib
1
From: Niels de Vos <ndevos@redhat.com>
1
When enabling option parsing and blockdev-add for rbd, we removed the
2
'filename' option. Unfortunately, this was a bit optimistic, as
3
previous versions of QEMU allowed the use of the option in backing
4
filenames via json. This means that without parsing this option, we
5
cannot open existing images that used to work fine.
2
6
3
Add missing support for "preallocation=falloc" to the Gluster block
7
See bug: https://bugzilla.redhat.com/show_bug.cgi?id=1457088
4
driver. This change bases its logic on that of block/file-posix.c and
5
removed the gluster_supports_zerofill() and qemu_gluster_zerofill()
6
functions in favour of #ifdef checks in an easy to read
7
switch-statement.
8
8
9
Both glfs_zerofill() and glfs_fallocate() have been introduced with
9
Tested-by: Richard W.M. Jones <rjones@redhat.com>
10
GlusterFS 3.5.0 (pkg-config glusterfs-api = 6). A #define for the
10
Signed-off-by: Jeff Cody <jcody@redhat.com>
11
availability of glfs_fallocate() has been added to ./configure.
11
Message-id: 937dc9fde348d13311eb8e23444df3bc3190b612.1497444637.git.jcody@redhat.com
12
13
Reported-by: Satheesaran Sundaramoorthi <sasundar@redhat.com>
14
Signed-off-by: Niels de Vos <ndevos@redhat.com>
15
Message-id: 20170528063114.28691-1-ndevos@redhat.com
16
URL: https://bugzilla.redhat.com/1450759
17
Signed-off-by: Niels de Vos <ndevos@redhat.com>
18
Signed-off-by: Jeff Cody <jcody@redhat.com>
12
Signed-off-by: Jeff Cody <jcody@redhat.com>
19
---
13
---
20
block/gluster.c | 78 ++++++++++++++++++++++++++++++---------------------------
14
block/rbd.c | 22 +++++++++++++++++++++-
21
configure | 6 +++++
15
1 file changed, 21 insertions(+), 1 deletion(-)
22
2 files changed, 47 insertions(+), 37 deletions(-)
23
16
24
diff --git a/block/gluster.c b/block/gluster.c
17
diff --git a/block/rbd.c b/block/rbd.c
25
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
26
--- a/block/gluster.c
19
--- a/block/rbd.c
27
+++ b/block/gluster.c
20
+++ b/block/rbd.c
28
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
21
@@ -XXX,XX +XXX,XX @@ static QemuOptsList runtime_opts = {
29
qemu_coroutine_yield();
22
.type = QEMU_OPT_STRING,
30
return acb.ret;
23
.help = "Legacy rados key/value option parameters",
31
}
24
},
32
-
25
+ {
33
-static inline bool gluster_supports_zerofill(void)
26
+ .name = "filename",
34
-{
27
+ .type = QEMU_OPT_STRING,
35
- return 1;
28
+ },
36
-}
29
{ /* end of list */ }
37
-
30
},
38
-static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset,
31
};
39
- int64_t size)
32
@@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
40
-{
33
{
41
- return glfs_zerofill(fd, offset, size);
34
BDRVRBDState *s = bs->opaque;
42
-}
35
const char *pool, *snap, *conf, *user, *image_name, *keypairs;
43
-
36
- const char *secretid;
44
-#else
37
+ const char *secretid, *filename;
45
-static inline bool gluster_supports_zerofill(void)
38
QemuOpts *opts;
46
-{
39
Error *local_err = NULL;
47
- return 0;
40
char *mon_host = NULL;
48
-}
41
int r;
49
-
42
50
-static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset,
43
+ /* If we are given a filename, parse the filename, with precedence given to
51
- int64_t size)
44
+ * filename encoded options */
52
-{
45
+ filename = qdict_get_try_str(options, "filename");
53
- return 0;
46
+ if (filename) {
54
-}
47
+ error_report("Warning: 'filename' option specified. "
55
#endif
48
+ "This is an unsupported option, and may be deprecated "
56
49
+ "in the future");
57
static int qemu_gluster_create(const char *filename,
50
+ qemu_rbd_parse_filename(filename, options, &local_err);
58
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename,
51
+ if (local_err) {
59
struct glfs *glfs;
52
+ r = -EINVAL;
60
struct glfs_fd *fd;
53
+ error_propagate(errp, local_err);
61
int ret = 0;
54
+ goto exit;
62
- int prealloc = 0;
55
+ }
63
+ PreallocMode prealloc;
64
int64_t total_size = 0;
65
char *tmp = NULL;
66
+ Error *local_err = NULL;
67
68
gconf = g_new0(BlockdevOptionsGluster, 1);
69
gconf->debug = qemu_opt_get_number_del(opts, GLUSTER_OPT_DEBUG,
70
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename,
71
BDRV_SECTOR_SIZE);
72
73
tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
74
- if (!tmp || !strcmp(tmp, "off")) {
75
- prealloc = 0;
76
- } else if (!strcmp(tmp, "full") && gluster_supports_zerofill()) {
77
- prealloc = 1;
78
- } else {
79
- error_setg(errp, "Invalid preallocation mode: '%s'"
80
- " or GlusterFS doesn't support zerofill API", tmp);
81
+ prealloc = qapi_enum_parse(PreallocMode_lookup, tmp,
82
+ PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
83
+ &local_err);
84
+ g_free(tmp);
85
+ if (local_err) {
86
+ error_propagate(errp, local_err);
87
ret = -EINVAL;
88
goto out;
89
}
90
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_create(const char *filename,
91
O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR);
92
if (!fd) {
93
ret = -errno;
94
- } else {
95
+ goto out;
96
+ }
56
+ }
97
+
57
+
98
+ switch (prealloc) {
58
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
99
+#ifdef CONFIG_GLUSTERFS_FALLOCATE
59
qemu_opts_absorb_qdict(opts, options, &local_err);
100
+ case PREALLOC_MODE_FALLOC:
60
if (local_err) {
101
+ if (glfs_fallocate(fd, 0, 0, total_size)) {
61
@@ -XXX,XX +XXX,XX @@ failed_shutdown:
102
+ error_setg(errp, "Could not preallocate data for the new file");
62
failed_opts:
103
+ ret = -errno;
63
qemu_opts_del(opts);
104
+ }
64
g_free(mon_host);
105
+ break;
65
+exit:
106
+#endif /* CONFIG_GLUSTERFS_FALLOCATE */
66
return r;
107
+#ifdef CONFIG_GLUSTERFS_ZEROFILL
67
}
108
+ case PREALLOC_MODE_FULL:
68
109
if (!glfs_ftruncate(fd, total_size)) {
110
- if (prealloc && qemu_gluster_zerofill(fd, 0, total_size)) {
111
+ if (glfs_zerofill(fd, 0, total_size)) {
112
+ error_setg(errp, "Could not zerofill the new file");
113
ret = -errno;
114
}
115
} else {
116
+ error_setg(errp, "Could not resize file");
117
ret = -errno;
118
}
119
+ break;
120
+#endif /* CONFIG_GLUSTERFS_ZEROFILL */
121
+ case PREALLOC_MODE_OFF:
122
+ if (glfs_ftruncate(fd, total_size) != 0) {
123
+ ret = -errno;
124
+ error_setg(errp, "Could not resize file");
125
+ }
126
+ break;
127
+ default:
128
+ ret = -EINVAL;
129
+ error_setg(errp, "Unsupported preallocation mode: %s",
130
+ PreallocMode_lookup[prealloc]);
131
+ break;
132
+ }
133
134
- if (glfs_close(fd) != 0) {
135
- ret = -errno;
136
- }
137
+ if (glfs_close(fd) != 0) {
138
+ ret = -errno;
139
}
140
out:
141
- g_free(tmp);
142
qapi_free_BlockdevOptionsGluster(gconf);
143
glfs_clear_preopened(glfs);
144
return ret;
145
diff --git a/configure b/configure
146
index XXXXXXX..XXXXXXX 100755
147
--- a/configure
148
+++ b/configure
149
@@ -XXX,XX +XXX,XX @@ seccomp=""
150
glusterfs=""
151
glusterfs_xlator_opt="no"
152
glusterfs_discard="no"
153
+glusterfs_fallocate="no"
154
glusterfs_zerofill="no"
155
gtk=""
156
gtkabi=""
157
@@ -XXX,XX +XXX,XX @@ if test "$glusterfs" != "no" ; then
158
glusterfs_discard="yes"
159
fi
160
if $pkg_config --atleast-version=6 glusterfs-api; then
161
+ glusterfs_fallocate="yes"
162
glusterfs_zerofill="yes"
163
fi
164
else
165
@@ -XXX,XX +XXX,XX @@ if test "$glusterfs_discard" = "yes" ; then
166
echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
167
fi
168
169
+if test "$glusterfs_fallocate" = "yes" ; then
170
+ echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
171
+fi
172
+
173
if test "$glusterfs_zerofill" = "yes" ; then
174
echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
175
fi
176
--
69
--
177
2.9.3
70
2.9.3
178
71
179
72
diff view generated by jsdifflib
New patch
1
When enabling option parsing and blockdev-add for iscsi, we removed the
2
'filename' option. Unfortunately, this was a bit optimistic, as
3
previous versions of QEMU allowed the use of the option in backing
4
filenames via json. This means that without parsing this option, we
5
cannot open existing images that used to work fine.
1
6
7
See bug: https://bugzilla.redhat.com/show_bug.cgi?id=1457088
8
9
Tested-by: Richard W.M. Jones <rjones@redhat.com>
10
Signed-off-by: Jeff Cody <jcody@redhat.com>
11
Message-id: 0789ab6c32814ab4b6896707d378804bd4424c65.1497444637.git.jcody@redhat.com
12
Signed-off-by: Jeff Cody <jcody@redhat.com>
13
---
14
block/iscsi.c | 22 +++++++++++++++++++++-
15
1 file changed, 21 insertions(+), 1 deletion(-)
16
17
diff --git a/block/iscsi.c b/block/iscsi.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/block/iscsi.c
20
+++ b/block/iscsi.c
21
@@ -XXX,XX +XXX,XX @@ static QemuOptsList runtime_opts = {
22
.name = "timeout",
23
.type = QEMU_OPT_NUMBER,
24
},
25
+ {
26
+ .name = "filename",
27
+ .type = QEMU_OPT_STRING,
28
+ },
29
{ /* end of list */ }
30
},
31
};
32
@@ -XXX,XX +XXX,XX @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
33
char *initiator_name = NULL;
34
QemuOpts *opts;
35
Error *local_err = NULL;
36
- const char *transport_name, *portal, *target;
37
+ const char *transport_name, *portal, *target, *filename;
38
#if LIBISCSI_API_VERSION >= (20160603)
39
enum iscsi_transport_type transport;
40
#endif
41
int i, ret = 0, timeout = 0, lun;
42
43
+ /* If we are given a filename, parse the filename, with precedence given to
44
+ * filename encoded options */
45
+ filename = qdict_get_try_str(options, "filename");
46
+ if (filename) {
47
+ error_report("Warning: 'filename' option specified. "
48
+ "This is an unsupported option, and may be deprecated "
49
+ "in the future");
50
+ iscsi_parse_filename(filename, options, &local_err);
51
+ if (local_err) {
52
+ ret = -EINVAL;
53
+ error_propagate(errp, local_err);
54
+ goto exit;
55
+ }
56
+ }
57
+
58
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
59
qemu_opts_absorb_qdict(opts, options, &local_err);
60
if (local_err) {
61
@@ -XXX,XX +XXX,XX @@ out:
62
}
63
memset(iscsilun, 0, sizeof(IscsiLun));
64
}
65
+exit:
66
return ret;
67
}
68
69
--
70
2.9.3
71
72
diff view generated by jsdifflib