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.
Bug 1537956 - RFE: qemu-img amend should list the true supported options
Summary: RFE: qemu-img amend should list the true supported options
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Hanna Czenczek
QA Contact: Tingting Mao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-24 07:36 UTC by Ping Li
Modified: 2018-11-01 11:04 UTC (History)
8 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-01 11:04:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ping Li 2018-01-24 07:36:39 UTC
Description of problem:
qemu-img supports to get an overview of the options[1] supported by raw and luks for subcommand amend. However, the specific options cannot be amended with the corresponding image format[2]. 
If we plan to support these options, we should have a bug track it. If we don't intend to support them, we should not show them and give a meaningful error message when try to amend it(such as "Format driver '%s' does not support any options to amend", because all the listed options are not supported).
After check the source code, found qemu-img uses create options for subcommand amend(raw: raw_create_opts, luks: block_crypto_create_opts_luks). The options could be used for create and convert. But we should not use them for amend.

[1] Get supported options
# qemu-img amend -f raw -o ?
Supported options:
size             Virtual disk size

# qemu-img amend -f luks -o ?
Supported options:
size             Virtual disk size
key-secret       ID of the secret that provides the keyslot passphrase
cipher-alg       Name of encryption cipher algorithm
cipher-mode      Name of encryption cipher mode
ivgen-alg        Name of IV generator algorithm
ivgen-hash-alg   Name of IV generator hash algorithm
hash-alg         Name of encryption hash algorithm
iter-time        Time to spend in PBKDF in milliseconds

[2] Try to amend the supported options
1. raw format 
1.1 Option size
# qemu-img create -f raw test.img 1G
# qemu-img amend -f raw -o size=2G test.img 
qemu-img: Error while amending options: Operation not supported

2. luks format
2.1 Options size
# qemu-img create -f luks --object secret,id=sec0,data=test -o key-secret=sec0 test.luks 1G
# qemu-img amend --object secret,id=sec0,data=test --image-opts driver=luks,key-secret=sec0,file.filename=test.luks -o size=2G
qemu-img: Error while amending options: Operation not supported

2.2 Option key-secret
# qemu-img amend --object secret,id=sec0,data=test --object secret,id=sec1,data=new --image-opts driver=luks,key-secret=sec0,file.filename=test.luks -o key-secret=sec1
qemu-img: Error while amending options: Operation not supported

3. qcow2 format
3.1 Option size
# qemu-img create -f qcow2 test.qcow2 1G
Formatting 'test.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16
# qemu-img resize test.qcow2 +1G
Image resized.



Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.10.0-18.el7

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 4 Hanna Czenczek 2018-04-21 17:42:18 UTC
Sent an upstream series:
http://lists.nongnu.org/archive/html/qemu-block/2018-04/msg00456.html

Comment 6 Miroslav Rezanina 2018-07-01 03:16:00 UTC
Fix included in qemu-kvm-rhev-2.12.0-6.el7

Comment 7 Ping Li 2018-07-02 06:25:15 UTC
Based on my testing, encryption, cluster_size, and preallocation couldn't be changed for qcow2 image but it is indeed listed for qemu-img amend. Although I think these options should be removed and some information should be corrected, but I think it still could be accepted according to Max's commit logs.
Set the bug as verified. Thanks Max.

Packages tested:
kernel-3.10.0-916.el7
qemu-kvm-rhev-2.12.0-6.el7

Test steps:
1. Get supported options for qemu-img amend
1) raw format
# qemu-img amend -f raw -o ?
qemu-img: Format driver 'raw' does not support option amendment

2) luks format
# qemu-img amend -f luks -o ?
qemu-img: Format driver 'luks' does not support option amendment

3) qcow2 format
# qemu-img amend -f qcow2 -o ?
Creation options for 'qcow2': ----> This should be Amendment options
size             Virtual disk size
compat           Compatibility level (0.10 or 1.1)
backing_file     File name of a base image
backing_fmt      Image format of the base image
encryption       Encrypt the image with format 'aes'. (Deprecated in favor of encrypt.format=aes)
encrypt.format   Encrypt the image, format choices: 'aes', 'luks'
encrypt.key-secret ID of secret providing qcow AES key or LUKS passphrase
encrypt.cipher-alg Name of encryption cipher algorithm
encrypt.cipher-mode Name of encryption cipher mode
encrypt.ivgen-alg Name of IV generator algorithm
encrypt.ivgen-hash-alg Name of IV generator hash algorithm
encrypt.hash-alg Name of encryption hash algorithm
encrypt.iter-time Time to spend in PBKDF in milliseconds
cluster_size     qcow2 cluster size
preallocation    Preallocation mode (allowed values: off, metadata, falloc, full)
lazy_refcounts   Postpone refcount updates
refcount_bits    Width of a reference count entry in bits

Note that not all of these options may be amendable. ---> this should be useful

2. Changed the options
1) encryption
# qemu-img amend --object secret,id=sec0,data=base -f qcow2 -o encrypt.format=luks,encrypt.key-secret=sec0 base.qcow2 
qemu-img: Changing the encryption format is not supported

2) cluster_size
# qemu-img amend -f qcow2 -o cluster_size=2M base.qcow2
qemu-img: Changing the cluster size is not supported

3) preallocation mode
# qemu-img amend -f qcow2 -o preallocation=full base.qcow2 
qemu-img: Cannot change preallocation mode

Comment 9 errata-xmlrpc 2018-11-01 11:04:08 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://access.redhat.com/errata/RHBA-2018:3443


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