Bug 1077250

Summary: Extended partition consumes whole device
Product: Red Hat Enterprise Linux 7 Reporter: Jan Safranek <jsafrane>
Component: python-blivetAssignee: David Lehman <dlehman>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: jstodola
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-blivet-0.61.0.6-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1181494 (view as bug list) Environment:
Last Closed: 2015-03-05 14:06:26 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
reproducer
none
blivet log
none
python-blivet-0.61.0.20-1.el7 log none

Description Jan Safranek 2014-03-17 15:06:28 UTC
Created attachment 875520 [details]
reproducer

When I create an extended partition of fixed size, blivet ignores the size and creates the largest possible extended partition.

Version-Release number of selected component (if applicable):
python-blivet-0.18.32-1.el7.noarch
(also python-blivet-0.44-1.fc21.noarch)

How reproducible:
always

Steps to Reproduce:
1. create empty partition table on sdb:
   $ parted /dev/sdb mklabel msdos
2. create a 128MiB partition using blivet (see attachment)
   $ python create_extended.py
3. look at created partition
   $ parted /dev/sdb print

Actual results:
Number  Start   End     Size    Type      File system  Flags
 1      1049kB  1074MB  1073MB  extended

-> created parition has 1GiB (=size of my test disk)

Expected results:
-> created parition has 128 MiB

Comment 1 Jan Safranek 2014-03-17 15:07:32 UTC
Created attachment 875521 [details]
blivet log

Comment 3 Alexander Todorov 2014-08-11 09:21:11 UTC
qa_ack+

we should be able to make this into a test case using the provided Python script.

Comment 5 Jan Stodola 2015-01-12 16:20:13 UTC
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.

Comment 6 Jan Stodola 2015-01-12 16:20:57 UTC
Created attachment 979225 [details]
python-blivet-0.61.0.20-1.el7 log

Comment 7 David Lehman 2015-01-12 17:22:35 UTC
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 8 Jan Stodola 2015-01-13 10:16:36 UTC
The issue from comment 5 reported as bug 1181494.

OK, it works fine with the suggested modification:
size = blivet.Size("128 MiB")

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

Number  Start   End    Size   Type      File system  Flags
 1      1049kB  135MB  134MB  extended

[root@localhost ~]# rpm -q python-blivet
python-blivet-0.61.0.20-1.el7.noarch
[root@localhost ~]#

Moving to VERIFIED.

Comment 10 errata-xmlrpc 2015-03-05 14:06:26 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-0313.html