Do not list block-devices/partitions that are part of multipath devices for partitioning
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
partman-base (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Problem:
-------
The block devices/partitions that are part of a multipath device should not be listed on partitioning dialogs.
(they are locked by the device-mapper, and are not allowed to be partitioned/
There's already code to do this, but it's currently not working.
The attached patch fixes it. More details/description below.
Impact:
------
The block devices/partitions that are part of a multipath device are being listed.
On 'Partition disks' manual dialog ('overview of your currently configured partitions'),
or the 'Guided partitioning -> Guided - use entire disk' dialog ('select disk to partition'):
┌────
│ │
│ Note that all data on the disk you select will be erased, but not │
│ before you have confirmed that you really want to make the changes. │
│ │
│ Select disk to partition: │
│ │
│ Multipath mpath0 (WWID mpath0)Multipath (0QEMU (WWID QEMU)Multipa │
│ SCSI1 (0,0,0) (sda) - 137.4 GB QEMU QEMU HARDDISK │
│ SCSI1 (0,1,0) (sdb) - 137.4 GB QEMU QEMU HARDDISK │
│ │
│ <Go Back> │
│ │
└────
┌────
│ │
│ This is an overview of your currently configured partitions and mount │
│ points. Select a partition to modify its settings (file system, mount │
│ point, etc.), a free space to create partitions, or a device to │
│ initialize its partition table. │
│ │
│ Multipath mpath0 (WWID mpath0)Multipath (0QEMU (WWID QEMU)Multipa │
│ > 1.0 MB FREE SPACE ▒ │
│ > #1 7.3 MB K │
│ > #2 131.8 GB F ext4 / ▒ │
│ > #3 5.6 GB F swap swap ▒ │
│ > 1.0 MB FREE SPACE ▒ │
│ SCSI1 (0,0,0) (sda) - 137.4 GB QEMU QEMU HARDDISK ▒ │
│ > 1.0 MB FREE SPACE ▒ │
│ > #1 7.3 MB ▒ │
│ > #2 131.8 GB │
│ │
│ <Go Back> │
│ │
└────
And after the multipath device is partitioned, you'll also see LVM VGs for them.
Even though there are /none/:
~ # pvdisplay
~ # vgdisplay
No volume groups found
~ # lvdisplay
No volume groups found
┌────
│ │
│ This is an overview of your currently configured partitions and mount │
│ points. Select a partition to modify its settings (file system, mount │
│ point, etc.), a free space to create partitions, or a device to │
│ initialize its partition table. │
│ │
│ LVM VG mpath0p1, LV mpath0p1 - 7.3 MB Linux device-mapper (linear │
│ LVM VG mpath0p2, LV mpath0p2 - 131.8 GB Linux device-mapper (line ▒ │
│ > #1 131.8 GB ▒ │
│ LVM VG mpath0p3, LV mpath0p3 - 5.6 GB Linux device-mapper (linear ▒ │
│ > #1 5.6 GB ▒ │
│ SCSI1 (0,0,0) (sda) - 137.4 GB QEMU QEMU HARDDISK │
│ > 1.0 MB FREE SPACE ▒ │
│ > #1 7.3 MB K ▒ │
│ > #2 131.8 GB ▒ │
│ > #3 5.6 GB │
│ │
│ <Go Back> │
│ │
└────
Solution proposal:
-----------------
Part 1) The block devices (sda, sdb, etc..)
It's in function 'part_of_
The grep expression is wrong/out of date as the 'multipath' command output changed over time.
Currently:
# The block devices that make up the multipath:
# Output looks like \_ 4:0:0:1 sdc 8:32 ...
for mpdev in $(multipath -l | \
But this is the output of 'multipath -l', which has no matches with that expression:
~ # multipath -l
mpath0 (0QEMU QEMU HARDDISK abcdef) dm-0 QEMU,QEMU HARDDISK
size=128G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=-1 status=active
| `- 0:0:0:0 sda 8:0 active undef running
`-+- policy='round-robin 0' prio=-1 status=enabled
`- 0:0:1:0 sdb 8:16 active undef running
~ # multipath -l | grep '_ \([#0-9]
~ #
Notice that the 'decoration symbols/line prefixes' changed (no longer '\_' as in that comment).
Also, it's not always identical -- there's an extra pipe '|' and space in the sda line,
but not in the sdb line (a problem for using 'cut -f " "' later).
So it seems a good idea not to match those symbols (subject to change again, and not identical on all lines),
but to match starting with the SCSI numbers, which seem less likely to change formats later.
Changes:
- grep options: use '-o' option
- grep expression: remove the heading string '_ ', starting on the SCSI numbers.
~ # multipath -l | grep -o '\([#0-
0:0:0:0 sda 8:0
0:0:1:0 sdb 8:16
Now it's OK to use 'cut'; with correct results:
~ # multipath -l | grep -o '\([#0-
sda
sdb
With the patch (attached) applied, the block devices part of the multipath device
are not listed anymore:
┌────
│ │
│ Note that all data on the disk you select will be erased, but not │
│ before you have confirmed that you really want to make the changes. │
│ │
│ Select disk to partition: │
│ │
│ Multipath mpath0 (WWID mpath0)Multipath (0QEMU (WWID QEMU)Multipa │
│ │
│ <Go Back> │
│ │
└────
┌────
│ │
│ This is an overview of your currently configured partitions and mount │
│ points. Select a partition to modify its settings (file system, mount │
│ point, etc.), a free space to create partitions, or a device to │
│ initialize its partition table. │
│ │
│ │
│ Multipath mpath0 (WWID mpath0)Multipath (0QEMU (WWID QEMU)Multipa ▒ │
│ > 1.0 MB FREE SPACE ▒ │
│ > #1 7.3 MB K ▒ │
│ > #2 131.8 GB F ext4 / ▒ │
│ > #3 5.6 GB F swap swap ▒ │
│ > 1.0 MB FREE SPACE ▒ │
│ ▒ │
│ Undo changes to partitions │
│ Finish partitioning and write changes to disk │
│ │
│ <Go Back> │
│ │
└────
Part 2) The LVM VGs/LVs (LVM VG mpath0p1, LV mpath0p1, etc)
The part_of_multipath() function first checks is_multipath_part() (lib/partman/
to verify whether a partition is part of a multipath disk.
That is currently not working because of something related to bug 1424734 (different disk-partition
separators used by parted and that code / 'p' vs. '-part'). This is currently open/ongoing discussion.
It's possible to add code to handle both cases/disk-
The patch adds that too.
And now the non-existent LVM VGs/LVs are no longer listed.
The attachment "partman- base_multipath_ part_listing. debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]