SIZE_RE regex is incorrect for returned string

Bug #1285764 reported by Andrew Kerr on 2014-02-27
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Cinder
Undecided
Andrew Kerr
oslo-incubator
Undecided
Andrew Kerr

Bug Description

imageutils.py line 32 has an incorrect regex:

SIZE_RE = re.compile(r"(\d+)(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?", re.I)

This will not properly parse the result of 'qemu-img info' line:

virtual size: 2.0G (2147483648 bytes)

This results in the returned size of the image not being in Bytes. The correct regex should be:

SIZE_RE = re.compile(r"(\d+\.?\d*)(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?", re.I)

Tags: nfs Edit Tag help
Changed in oslo:
assignee: nobody → Andrew Kerr (andrew-kerr)
status: New → In Progress
description: updated
tags: added: nfs
description: updated
Eric Harney (eharney) on 2014-03-05
Changed in cinder:
milestone: none → icehouse-rc1

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

Changed in cinder:
assignee: nobody → Daniel Gollub (d-gollub)
status: New → In Progress
Changed in oslo:
status: In Progress → Fix Committed
Changed in cinder:
assignee: Daniel Gollub (d-gollub) → Andrew Kerr (andrew-kerr)

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

commit dcfeac2b1e57a4f185c881201fccfca27c5eb723
Author: Andrew Kerr <email address hidden>
Date: Thu Mar 13 15:01:27 2014 -0400

    Sync latest Oslo code for imageutils

    This sync pulls the latest Oslo imageutils code over to cinder
    to fix QemuImgInfo parsing needed by NFS drivers.

    -> b455fac Enable decimal value input in imageutils.QemuImgInfo
    --> cinder/openstack/common/imageutils.py

    Oslo version:
    -> 0e98afd Re-raise exception of unloadable library
    -> Date: Tue Mar 4 17:26:40 2014 +0100

    Change-Id: I770b0f534c6949c2ff6995a03923a21ed26e04da
    Closes-Bug: 1285764

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2014-03-27
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2014-04-04
Changed in oslo:
milestone: none → icehouse-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2014-04-17
Changed in oslo:
milestone: icehouse-rc1 → 2014.1
Thierry Carrez (ttx) on 2014-04-17
Changed in cinder:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers