Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
QEMU should support to create overlay over a backing file image or a snapshot through ssh protocol.
Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.10.0-13.el7
kernel-3.10.0-823.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
1. create image and install os
# qemu-img create -f qcow2 /home/nfs/win2016.qcow2 20G
2. create snapshot
2.1 Use relative path to create snapshot on the ssh server side
# qemu-img create -f qcow2 -b win2016.qcow2 -F qcow2 sn_rel.qcow2
2.2 Use absolute path to create snapshot on the ssh server side
# qemu-img create -f qcow2 -b /home/nfs/win2016.qcow2 -F qcow2 /home/nfs/sn_abs.qcow2
3. setup ssh environment
#ssh-keygen
#ssh-copy-id root.224.145
#exec /usr/bin/ssh-agent $SHELL
#ssh-add
4. create overlay
4.1 create overlay over backing file image
# qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/win2016.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn.qcow2
Formatting 'ssh_sn.qcow2', fmt=qcow2 size=21474836480 backing_file=json:{"file.driver":"ssh",, "file.host":"10.73.224.145",, "file.port":"22",, "file.path":"/home/nfs/win2016.qcow2",, "file.user":"root",, "file.host_key_check":"no"} cluster_size=65536 lazy_refcounts=off refcount_bits=16
# qemu-img info ssh_sn.qcow2
image: ssh_sn.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 196K
cluster_size: 65536
backing file: json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/win2016.qcow2", "file.user":"root", "file.host_key_check":"no"}
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
4.2 create overlay over snapshot created using absolute path
# qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_abs.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_abs.qcow2
qemu-img: ssh_sn_abs.qcow2: Could not open backing file: Could not open '/home/nfs/win2016.qcow2': No such file or directory
Could not open backing image to determine size.
4.3 create overlay over snapshot created using relative path
# qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_rel.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_rel.qcow2
qemu-img: ssh_sn_rel.qcow2: Cannot use relative backing file names for 'json:{"port": "22", "host": "10.73.224.145", "host_key_check": "no", "driver": "ssh", "path": "/home/nfs/sn_rel.qcow2", "user": "root"}'
Could not open backing image to determine size.
Actual results:
Failed to create overlay
Expected results:
overlay should be created successfully
Additional info:
Error output on qemu-kvm-rhev-2.9.0-14.el7 is almost same as above.
1. absolute path
# qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_abs.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_abs.qcow2
qemu-img: ssh_sn_abs.qcow2: Could not open backing file: Could not open '/home/nfs/win2016.qcow2': No such file or directory
2. relative path
# qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_rel.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_rel.qcow2
qemu-img: ssh_sn_rel.qcow2: Cannot use relative backing file names for 'json:{"port": "22", "host": "10.73.224.145", "host_key_check": "no", "driver": "ssh", "path": "/home/nfs/sn_rel.qcow2", "user": "root"}'
I hope this will be supported by fixing BZ 1510560, at least for the cases where that's possible.
If you need some ssh options that cannot be represented through a normal filename (so that you have to use a json:{} filename), it would be rather difficult to support relative backing filenames and I don't think we will ever do that.
In any case, I'll look into this in the course of BZ 1510560.
Max
The relative filename case will indeed be (partially) supported by fixing BZ 1510560. I say "partially", because it won't work with host_key_check set.
Here is how that looks:
$ qemu-img info ssh://desktop/tmp/sn_rel.qcow2
[...]
backing file: base.qcow2 (actual path: ssh://maxx@desktop:22/tmp/base.qcow2)
[...]
You can use json:{} filenames, because qemu will convert them to plain filenames automatically (if possible):
$ qemu-img info 'json:{"file.driver":"ssh", "file.host":"desktop", "file.port":"22", "file.path":"/tmp/sn_rel.qcow2", "file.user":"maxx"}'
image: ssh://maxx@desktop:22/tmp/sn_rel.qcow2
[...]
However, that is not possible for all options. So if host-key-check is set, then you cannot generate such a plain filename and then relative filenames cannot be used. qemu will tell you this:
$ ./qemu-img create -f qcow2 -b 'json:{[...] "file.host_key_check":"yes"}' ssh_sn_rel.qcow2
qemu-img: ssh_sn_rel.qcow2: Cannot generate a base directory with host_key_check set
This could in theory be implemented, but in practice I think we will not do that. If a user has such a complicated setup that they need options that cannot be expressed in plain filenames, we can ask them to either put all of the backing file information in a json:{} filename into the file, or manage the backing chain completely manually (that is, with the .backing blockdev runtime option).
And for absolute filenames it doesn't work at all, because qemu always interprets absolute filenames as paths on your local filesystem. Changing this would one one hand be a great effort, and on the other probably break many existing use cases.
(Upstream series for ssh is here: http://lists.nongnu.org/archive/html/qemu-block/2018-02/msg00193.html -- but it will need a v2, and it is based on a much larger series)
Max
Currently, this is not required by any layered product, so I'm closing it. If it becomes a priority, then please reopen it with a description of the use-case.
Description of problem: QEMU should support to create overlay over a backing file image or a snapshot through ssh protocol. Version-Release number of selected component (if applicable): qemu-kvm-rhev-2.10.0-13.el7 kernel-3.10.0-823.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. create image and install os # qemu-img create -f qcow2 /home/nfs/win2016.qcow2 20G 2. create snapshot 2.1 Use relative path to create snapshot on the ssh server side # qemu-img create -f qcow2 -b win2016.qcow2 -F qcow2 sn_rel.qcow2 2.2 Use absolute path to create snapshot on the ssh server side # qemu-img create -f qcow2 -b /home/nfs/win2016.qcow2 -F qcow2 /home/nfs/sn_abs.qcow2 3. setup ssh environment #ssh-keygen #ssh-copy-id root.224.145 #exec /usr/bin/ssh-agent $SHELL #ssh-add 4. create overlay 4.1 create overlay over backing file image # qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/win2016.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn.qcow2 Formatting 'ssh_sn.qcow2', fmt=qcow2 size=21474836480 backing_file=json:{"file.driver":"ssh",, "file.host":"10.73.224.145",, "file.port":"22",, "file.path":"/home/nfs/win2016.qcow2",, "file.user":"root",, "file.host_key_check":"no"} cluster_size=65536 lazy_refcounts=off refcount_bits=16 # qemu-img info ssh_sn.qcow2 image: ssh_sn.qcow2 file format: qcow2 virtual size: 20G (21474836480 bytes) disk size: 196K cluster_size: 65536 backing file: json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/win2016.qcow2", "file.user":"root", "file.host_key_check":"no"} Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false 4.2 create overlay over snapshot created using absolute path # qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_abs.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_abs.qcow2 qemu-img: ssh_sn_abs.qcow2: Could not open backing file: Could not open '/home/nfs/win2016.qcow2': No such file or directory Could not open backing image to determine size. 4.3 create overlay over snapshot created using relative path # qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_rel.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_rel.qcow2 qemu-img: ssh_sn_rel.qcow2: Cannot use relative backing file names for 'json:{"port": "22", "host": "10.73.224.145", "host_key_check": "no", "driver": "ssh", "path": "/home/nfs/sn_rel.qcow2", "user": "root"}' Could not open backing image to determine size. Actual results: Failed to create overlay Expected results: overlay should be created successfully Additional info: Error output on qemu-kvm-rhev-2.9.0-14.el7 is almost same as above. 1. absolute path # qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_abs.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_abs.qcow2 qemu-img: ssh_sn_abs.qcow2: Could not open backing file: Could not open '/home/nfs/win2016.qcow2': No such file or directory 2. relative path # qemu-img create -f qcow2 -b 'json:{"file.driver":"ssh", "file.host":"10.73.224.145", "file.port":"22", "file.path":"/home/nfs/sn_rel.qcow2", "file.user":"root", "file.host_key_check":"no"}' ssh_sn_rel.qcow2 qemu-img: ssh_sn_rel.qcow2: Cannot use relative backing file names for 'json:{"port": "22", "host": "10.73.224.145", "host_key_check": "no", "driver": "ssh", "path": "/home/nfs/sn_rel.qcow2", "user": "root"}'