[Bug 1425153] Re: Do not list block-devices/partitions that are part of multipath devices for partitioning

Mauricio Faria de Oliveira mauricfo at linux.vnet.ibm.com
Tue Mar 10 15:19:11 UTC 2015


*** This bug is a duplicate of bug 1430074 ***
    https://bugs.launchpad.net/bugs/1430074

** This bug has been marked a duplicate of bug 1430074
   d-i multipath disk-partition separator overhaul

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1425153

Title:
  Do not list block-devices/partitions that are part of multipath
  devices for partitioning

Status in partman-base package in Ubuntu:
  New

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/formatted individually)

  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'):

    ┌────────────────────────┤ [!!] Partition disks ├─────────────────────────┐
    │                                                                         │
    │ 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>                                                           │
    │                                                                         │
    └─────────────────────────────────────────────────────────────────────────┘

    ┌────────────────────────┤ [!!] Partition disks ├─────────────────────────┐
    │                                                                         │
    │ 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

    ┌────────────────────────┤ [!!] Partition disks ├─────────────────────────┐
    │                                                                         │
    │ 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_multipath()' at the '/lib/partman/init.d/30parted' file.
  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 | \
                         grep '_ \([#0-9]\+:\)\{3\}[#0-9]\+ [hs]d[a-z]\+ [0-9]\+:[0-9]\+' | \
                         cut -f4 -d' '); do

  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]\+:\)\{3\}[#0-9]\+ [hs]d[a-z]\+ [0-9]\+:[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-9]\+:\)\{3\}[#0-9]\+ [hs]d[a-z]\+ [0-9]\+:[0-9]\+'
  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-9]\+:\)\{3\}[#0-9]\+ [hs]d[a-z]\+ [0-9]\+:[0-9]\+' | cut -d " " -f2
  sda
  sdb

  With the patch (attached) applied, the block devices part of the multipath device
  are not listed anymore:

    ┌────────────────────────┤ [!!] Partition disks ├─────────────────────────┐
    │                                                                         │
    │ 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>                                                           │
    │                                                                         │
    └─────────────────────────────────────────────────────────────────────────┘

    ┌────────────────────────┤ [!!] Partition disks ├─────────────────────────┐
    │                                                                         │
    │ 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/lib/base.sh) 
  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-separators in that function.
  The patch adds that too. 
  And now the non-existent LVM VGs/LVs are no longer listed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/partman-base/+bug/1425153/+subscriptions



More information about the Ubuntu-sponsors mailing list