[Pkg-libvirt-commits] [SCM] Libguestfs Debian packaging branch, experimental, updated. debian/1%1.21.40-1
Richard W.M. Jones
rjones at redhat.com
Sat Jun 1 11:04:39 UTC 2013
The following commit has been merged in the experimental branch:
commit a95214b1985e694946e3426120a6fdc13a3f081f
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Sat May 11 13:36:43 2013 +0100
drives: Remove check for ':' in filename (RHBZ#811649).
Modern qemu can now handle this properly. ':' is only special if what
precedes it looks like a transport, so:
qemu-system-x86_64 -drive foo:bar .. fails
qemu-system-x86_64 -drive ./foo:bar .. works
Thus by adding ./ in front of relative paths that contain ':' we can
work around this.
In addition, this broke iscsi:// URIs because iSCSI target names
routinely contain ':' characters.
diff --git a/src/drives.c b/src/drives.c
index 5deeb7a..bfafbeb 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -790,12 +790,6 @@ guestfs__add_drive_opts (guestfs_h *g, const char *filename,
struct drive *drv;
size_t i, drv_index;
- if (strchr (filename, ':') != NULL) {
- error (g, _("filename cannot contain ':' (colon) character. "
- "This is a limitation of qemu."));
- return -1;
- }
-
readonly = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK
? optargs->readonly : false;
format = optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK
@@ -1175,7 +1169,11 @@ guestfs___drive_source_qemu_param (guestfs_h *g, const struct drive_source *src)
*/
switch (src->protocol) {
case drive_protocol_file:
- return safe_strdup (g, src->u.path);
+ /* We might need to rewrite the path if it contains a ':' character. */
+ if (src->u.path[0] == '/' || strchr (src->u.path, ':') != NULL)
+ return safe_strdup (g, src->u.path);
+ else
+ return safe_asprintf (g, "./%s", src->u.path);
case drive_protocol_gluster:
switch (src->servers[0].transport) {
diff --git a/tests/regressions/rhbz811649.sh b/tests/regressions/rhbz811649.sh
index cc0b8a1..016d62f 100755
--- a/tests/regressions/rhbz811649.sh
+++ b/tests/regressions/rhbz811649.sh
@@ -29,10 +29,10 @@ filenames[2]='='
filenames[3]='水'
filenames[4]='-'
filenames[5]='-hda'
-#filenames[6]=':' # a future version of qemu may allow colon
-#filenames[7]='http:'
-#filenames[8]='file:'
-#filenames[9]='raw:'
+filenames[6]=':' # a future version of qemu may allow colon
+filenames[7]='http:'
+filenames[8]='file:'
+filenames[9]='raw:'
rm -f -- test1.img "${filenames[@]}"
--
Libguestfs Debian packaging
More information about the Pkg-libvirt-commits
mailing list