Bug 1181494

Summary: Do not crash when creating small partitions
Product: Red Hat Enterprise Linux 7 Reporter: Jan Stodola <jstodola>
Component: python-blivetAssignee: David Lehman <dlehman>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-blivet-0.61.15.9-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1077250 Environment:
Last Closed: 2015-11-19 08:46:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
parted log
none
reproducer none

Description Jan Stodola 2015-01-13 10:09:23 UTC
+++ This bug was initially created as a clone of Bug #1077250 +++

Retested with python-blivet-0.61.0.20-1.el7 and I got following traceback:

Traceback (most recent call last):
  File "create_extended.py", line 36, in <module>
    blivet.partitioning.doPartitioning(storage=b)
  File "/usr/lib/python2.7/site-packages/blivet/partitioning.py", line 929, in doPartitioning
    allocatePartitions(storage, disks, partitions, free)
  File "/usr/lib/python2.7/site-packages/blivet/partitioning.py", line 1249, in allocatePartitions
    _part.req_start_sector, _part.req_end_sector)
  File "/usr/lib/python2.7/site-packages/blivet/partitioning.py", line 792, in addPartition
    end=end)
  File "/usr/lib64/python2.7/site-packages/parted/decorators.py", line 41, in new
    ret = fn(*args, **kwds)
  File "/usr/lib64/python2.7/site-packages/parted/geometry.py", line 63, in __init__
    raise parted.GeometryException, "must specify PedGeometry or (device, start, length) or (device, start, end) or (device, start, length, end)"
_ped.GeometryException: must specify PedGeometry or (device, start, length) or (device, start, end) or (device, start, length, end)

Whole log will be attached.
Moving to ASSIGNED.


--- Additional comment from David Lehman on 2015-01-12 18:22:35 CET ---

The reproducer needs to be updated to request a partition with size Size("128 MiB") instead of 128. The 128 is being interpreted as 128 bytes, which is not what you want.

You could open a new bug since we should probably handle a size of 128 bytes by allocating a partition the size of the optimal io size (probably 1MiB) instead of crashing.

Comment 1 Jan Stodola 2015-01-13 10:09:54 UTC
Created attachment 979530 [details]
parted log

Comment 2 Jan Stodola 2015-01-13 10:11:01 UTC
Created attachment 979532 [details]
reproducer

Comment 4 Jan Stodola 2015-08-17 11:41:15 UTC
Retested with python-blivet-0.61.15.15-1.el7 using script from comment 2, one small partition was created successfully:

[root@localhost ~]# parted /dev/vdb print
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2097kB  1049kB  primary

[root@localhost ~]#

Moving to VERIFIED.

Comment 5 errata-xmlrpc 2015-11-19 08:46:57 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/RHBA-2015-2232.html