Misspelled encryption field in QemuImgInfo

Bug #1257829 reported by Peter Hamilton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Zhongyue Luo
OpenStack Compute (nova)
Fix Released
Undecided
Peter Hamilton
oslo-incubator
Fix Released
Undecided
Peter Hamilton

Bug Description

Location: openstack.common.imageutils.QemuImgInfo
Method: __init__
Error: line 45, self.encryption = details.get('encryption')

The parsing of the encryption field for qemu-img commands does not work. The key used to index the details dictionary for encryption information, 'encryption', does not match the key generated by qemu-img, 'encrypted.' As a result, the encryption field is always 'None', regardless of the image's encryption status.

Example call to 'qemu-img info':
$ qemu-img info encrypted_disk.qcow2
Disk image 'encrypted_disk.qcow2' is encrypted.
password:
image: encrypted_disk.qcow2
file format: qcow2
virtual size: 16G (17179869184 bytes)
disk size: 136K
encrypted: yes
cluster_size: 65536
backing file: debian_squeeze_i386_standard.qcow2 (actual path: debian_squeeze_i386_standard.qcow2)

Proposed Fix:
Simply change the key used to index the encryption information.

self.encrypted = details.get('encrypted')

Since the fields in __init__ seem to be named to match the keys used to index the corresponding information, I would also propose changing the attribute from self.encryption to self.encrypted, and updating any references to it wherever appropriate.

affects: nova → cinder
affects: cinder → nova
Gary Kotton (garyk)
tags: added: libvirt
Changed in nova:
assignee: nobody → Peter Hamilton (peter-hamilton)
Changed in nova:
status: New → In Progress
ling-yun (zengyunling)
Changed in cinder:
assignee: nobody → ling-yun (zengyunling)
ling-yun (zengyunling)
Changed in cinder:
status: New → In Progress
Revision history for this message
Peter Hamilton (peter-hamilton) wrote :

For some reason (perhaps because this bug spans projects) the bug patch I've submitted for this has not been linked.

https://review.openstack.org/#/c/60500/

I'm not sure what the process is for cross-project bug fixes, but once the nova patch is approved I plan on submitting the same for cinder. I tagged oslo in this bug report since the bug affects openstack.common, but I don't know if anything different needs to be done to account for an oslo bug fix.

Changed in oslo:
assignee: nobody → Peter Hamilton (peter-hamilton)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/61877

Changed in oslo:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/61877
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=aad179d4f98bfde4d1816ad9321fecf28d993dbe
Submitter: Jenkins
Branch: master

commit aad179d4f98bfde4d1816ad9321fecf28d993dbe
Author: Peter Hamilton <email address hidden>
Date: Thu Dec 12 16:30:01 2013 -0500

    Fixing misspelled encryption key in QemuImgInfo

    This modification fixes Bug #1257829, specifically addressing the use
    of a misspelled 'encryption' key to retrieve image encryption
    information returned by calls to the 'qemu-img' command. In addition
    to fixing the key ('encryption' -> 'encrypted'), the QemuImgInfo class
    attribute has been renamed to reflect the change and the encryption
    information added to the string representation of the class. Test
    cases verifying the parsing of the encryption information are also
    included.

    Change-Id: Ice087d95c52506dec735921c6e9477caf082bf7e
    Closes-Bug: #1257829

Changed in oslo:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/62071

Changed in cinder:
assignee: ling-yun (zengyunling) → Peter Hamilton (peter-hamilton)
Changed in oslo:
milestone: none → icehouse-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/66246

Changed in cinder:
assignee: Peter Hamilton (peter-hamilton) → Zhongyue Luo (zyluo)
Thierry Carrez (ttx)
Changed in oslo:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (master)

Reviewed: https://review.openstack.org/66246
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=9a8d41e0132d4676b611f940de552dd450b7cac7
Submitter: Jenkins
Branch: master

commit 9a8d41e0132d4676b611f940de552dd450b7cac7
Author: Zhongyue Luo <email address hidden>
Date: Mon Jan 13 09:44:56 2014 +0800

    Sync oslo imageutils, strutils to cinder

    Changes in imageutils:
    ===============================
    bec3a5e Implements SI/IEC unit system conversion to bytes
    8b2b0b7 Use hacking import_exceptions for gettextutils._
    aad179d Fixing misspelled encryption key in QemuImgInfo
    12bcdb7 Remove vim header
    2bd46eb Refactors byte size extraction logic

    Changes in strutils:
    ====================
    bec3a5e Implements SI/IEC unit system conversion to bytes
    e53fe85 strutils bool_from_string, allow specified default
    8b2b0b7 Use hacking import_exceptions for gettextutils._
    84d461e Fix a bug in safe_encode where it returns a bytes object in py3
    12bcdb7 Remove vim header
    3970d46 Fix typos in oslo
    1a2df89 Enable H302 hacking check
    67bd769 python3: Fix traceback while running python3.
    b0c51ec Refactors to_bytes

    Change-Id: I765bcd40f959162874bfda412b69e673c6e5f732
    Related-bug: #1189635
    Related-bug: #1193765
    Related-Bug: #1257829

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nova (master)

Reviewed: https://review.openstack.org/66242
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4f91f1d116a2bd68cca388aee8138b754c9cd55d
Submitter: Jenkins
Branch: master

commit 4f91f1d116a2bd68cca388aee8138b754c9cd55d
Author: Zhongyue Luo <email address hidden>
Date: Mon Jan 13 09:18:52 2014 +0800

    Sync oslo imageutils, strutils to Nova

    Changes in imageutils:
    ===============================
    b455fac Enable decimal value input in imageutils.QemuImgInfo
    bec3a5e Implements SI/IEC unit system conversion to bytes
    8b2b0b7 Use hacking import_exceptions for gettextutils._
    aad179d Fixing misspelled encryption key in QemuImgInfo
    12bcdb7 Remove vim header
    2bd46eb Refactors byte size extraction logic

    Changes in strutils:
    ====================
    bec3a5e Implements SI/IEC unit system conversion to bytes
    e53fe85 strutils bool_from_string, allow specified default
    8b2b0b7 Use hacking import_exceptions for gettextutils._
    84d461e Fix a bug in safe_encode where it returns a bytes object in py3
    12bcdb7 Remove vim header
    3970d46 Fix typos in oslo
    1a2df89 Enable H302 hacking check
    67bd769 python3: Fix traceback while running python3.
    b0c51ec Refactors to_bytes

    Change-Id: I3e887756af37823dc6486d1496222825ddc20f0c
    Related-bug: #1189635
    Related-bug: #1193765
    Related-Bug: #1257829

Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-2 → 2014.1
Zhongyue Luo (zyluo)
Changed in cinder:
status: In Progress → Fix Released
Changed in nova:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.