Bug 1071058 - qemu-img unable to create image filename containing a ':'
Summary: qemu-img unable to create image filename containing a ':'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Max Reitz
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1072130 1105389 1248966
TreeView+ depends on / blocked
 
Reported: 2014-02-28 03:36 UTC by Jun Li
Modified: 2015-07-31 08:39 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1072130 1105389 1248966 (view as bug list)
Environment:
Last Closed: 2015-03-05 09:44:21 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0624 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2015-03-05 14:37:36 UTC

Description Jun Li 2014-02-28 03:36:51 UTC
Description of problem:
qemu-img can not create image with filename containing a ':'.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-1.5.3-49.el7.x86_64
3.10.0-95.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.create a image with filename containing a ':'.
# qemu-img create -f qcow2 ip-192.168.254.185:asdf 5G
2.
3.

Actual results:
# qemu-img create -f qcow2 ip-192.168.254.185:asdf 5G
qemu-img: ip-192.168.254.185:asdf: Unknown protocol 'ip-192.168.254.185:asdf'

Expected results:
can create this named image correctly.

Additional info:
Also test with 
# qemu-img create -f qcow2 ip-192.168.254.185\:asdf 5G
qemu-img: ip-192.168.254.185:asdf: Unknown protocol 'ip-192.168.254.185:asdf'

Comment 2 Kevin Wolf 2014-03-03 10:15:19 UTC
Yes, this is known. You're probably better off not creating images containing a
colon, too, because using them is more troublesome...

Anyway, in the long run we should allow this. I guess this is something like the
changes we already made to bdrv_open(), so maybe bdrv_create() should follow
suit. The tricky design question is how to mix creation options and (probably
mostly protocol level) open options for underlying BDSes, no top of which the
new image should be created.

I'll move it to 7.1 for now, but this needs considerable upstream work and is
not our highest priority, so it might well end up later.

Comment 6 chcheng 2014-09-28 10:00:13 UTC
Tried it on qemu-kvm-rhev-2.1.2-1 with the same steps as comment #0.

host info:
# rpm -qa | grep qemu
qemu-img-rhev-2.1.2-1.el7.x86_64
qemu-kvm-rhev-2.1.2-1.el7.x86_64

step:
1.# qemu-img create -f qcow2 ip-192.168.254.185:asdf 5G
  # qemu-img create -f qcow2 disk:test 5G

Results:
1.# qemu-img create -f qcow2 ip-192.168.254.185:asdf 5G
qemu-img: ip-192.168.254.185:asdf: Unknown protocol 'ip-192.168.254.185:asdf'
  # qemu-img create -f qcow2 disk:test 5G
qemu-img: disk:test: Unknown protocol 'disk:test'


Base on above, this issue did not fixed at all, Re-assign it to fix, thanks.

Best Regards,
chcheng

Comment 7 Max Reitz 2014-09-30 17:11:09 UTC
Hi,

This issue is not fixable like that. "disk:test" designates an object named "test" to be used over a protocol named "disk". This is just how it is. If we were to make all invalid protocol names to be interpreted as file names (i.e., "disk:test" is being interpreted as "file:disk:test" because there is no protocol named "disk"), then you could still create a file named "nbd:test" and that would not work.

So, as stated in comment 5 for bug 1072130, there are (at least) two correct ways to access such files: By using "./disk:test" or by explicitly specifying the desired protocol, i.e. "file:disk:test". The latter is broken in RHEL 6 and RHEL 7 and will not be fixed (because "./disk:test" works just fine); in RHEV 7 on the other hand, it has been fixed (which is why this BZ has not been closed with WONTFIX like BZ 1072130).

Additionally, qemu-io and qemu itself allow an option syntax which makes protocol prefixes obsolete. Therefore, "qemu-io -c 'open -o file.filename=disk:test' -c info" works as well. qemu-img on the other hand does not have this capability, so you need to use "./disk:test" or "file:disk:test" there.

Changing status therefore back to MODIFIED; if this resolution is not considered enough, I will close this BZ with WONTFIX.

Max

Comment 9 Jun Li 2014-10-10 09:11:24 UTC
Verify:
Version of components:
qemu-kvm-1.5.3-70.el7.x86_64

As comment 7 show, verify this bz as followings:
# qemu-img create -f qcow2 ./ip-192.168.254.185:asdf 5G
Formatting './ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off 

# qemu-img create -f qcow2 file:ip-192.168.254.185:asdf 5G
Formatting 'file:ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off

As above show and based on comment 7, this bz has been verified.


Hi Max,

  Could you give the fixed version of qemu-kvm, so QE can use it to reproduce this bz. Thx.

Best Regards,
Jun Li

Comment 10 Jun Li 2014-10-10 09:15:13 UTC
Verify this bz:
Version of components:
qemu-kvm-rhev-2.1.2-1.el7.x86_64

As comment 7 show, verify this bz as followings:
# qemu-img create -f qcow2 ./ip-192.168.254.185:asdf 5G
Formatting './ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off 

# qemu-img create -f qcow2 file:ip-192.168.254.185:asdf 5G
Formatting 'file:ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off 

As above show and based on comment 7, this bz has been verified.

Comment 11 Max Reitz 2014-10-12 08:13:52 UTC
Hi Jun,

as far as I can see, it's contained in any of the RHEV7 qemu versions. That includes qemu-kvm-2.1.2-1.el7, qemu-kvm-rhev-2.0.0-2.el7ev, qemu-kvm-rhev-2.1.0-1.el7 and qemu-kvm-rhev-2.1.2-2.el7.

To test this issue, you should not only create a file with qemu-img, but also verify its filename. Before the fix I'm referring to "qemu-img create -f qcow2 file:foo:bar 64M" would create a file named "file:foo:bar", whereas it should be named "foo:bar".

Max

Comment 12 Jun Li 2014-10-13 06:35:59 UTC
(In reply to Max Reitz from comment #11)
> Hi Jun,
> 
> as far as I can see, it's contained in any of the RHEV7 qemu versions. That
> includes qemu-kvm-2.1.2-1.el7, qemu-kvm-rhev-2.0.0-2.el7ev,
> qemu-kvm-rhev-2.1.0-1.el7 and qemu-kvm-rhev-2.1.2-2.el7.
> 
> To test this issue, you should not only create a file with qemu-img, but
> also verify its filename. Before the fix I'm referring to "qemu-img create
> -f qcow2 file:foo:bar 64M" would create a file named "file:foo:bar", whereas
> it should be named "foo:bar".
> 
> Max

ok, thanks.

Verify this bz:
Version of components:
qemu-kvm-rhev-2.1.2-1.el7.x86_64

As comment 7 show, verify this bz as followings:
# qemu-img create -f qcow2 ./ip-192.168.254.185:asdf 5G
Formatting './ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off 

# ll
total 196
-rw-r--r--. 1 root root 197120 Oct 13 14:28 ip-192.168.254.185:asdf

# qemu-img info ./ip-192.168.254.185\:asdf 
image: ./ip-192.168.254.185:asdf
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
---
# qemu-img create -f qcow2 file:ip-192.168.254.185:asdf 5G
Formatting 'file:ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off
 
# ll
total 196
-rw-r--r--. 1 root root 197120 Oct 13 14:31 ip-192.168.254.185:asdf

# qemu-img info file:ip-192.168.254.185:asdf
image: ip-192.168.254.185:asdf
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false


As above show and based on comment 7 and comment 11, this bz has been verified.

BTW, based on comment 11, no version of qemu-kvm-rhev to reproduce this bz.

Comment 15 errata-xmlrpc 2015-03-05 09:44:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0624.html


Note You need to log in before you can comment on or make changes to this bug.