commit b0eb83f6acab94335648b48e496278eb85fbaac7
Author: Felipe Sanches Zanoni <email address hidden>
Date: Tue Feb 14 11:39:14 2023 -0500
Adjust function to report correctly free space for multipath disks
The command host-disk-list was reporting free space wrongly for
multipath disks that have partitions added to nova-local
logical volume.
This happens when the device node path has a dash in it like in
'/dev/mapper/mpathc-part1'. A 'grep -w' command was used to verify
if the device node is a physical volume. The command 'grep -w'
searchs for whole word, but the dash is considered a word separator,
causing the device node '/dev/mapper/mpathc' to be matched with
'/dev/mapper/mpathc-part1', once 'grep -w' detects the word
'/dev/mapper/mpathc'.
To fix this, the command is changed to detect the device node as
a string with an extra space at the end, for instance,
'/dev/mapper/mpathc '.
As an example consider device_node='/dev/mapper/mpathc' and
the output of 'pvs' command below:
PV VG Fmt Attr PSize PFree
/dev/mapper/mpatha-part5 cgts-vg lvm2 a-- <488.41g 251.59g
/dev/mapper/mpathb cgts-vg lvm2 a-- <20.00g <20.00g
/dev/mapper/mpathc-part1 cgts-vg lvm2 a-- <15.00g <15.00g
The 'pvs | grep -w /dev/mapper/mpathc' will match the string
'/dev/mapper/mpathc-part1', but it should not.
The 'pvs | grep "/dev/mapper/mpathc "' will not match any
string in that output.
Test Plan:
PASS: Install AIO-SX with multipath disks, add a new partition
to a spare multipath disk using half of its capacity.
Add this partition to nova-local logical volume group and
run 'system host-disk-list controller-0'. The available_gib column should report the expected free space correctly.
PASS: Install AIO-SX without multipath disks, add a new partition
to a spare disk using half of its capacity.
Add this partition to nova-local logical volume group and
run 'system host-disk-list controller-0'. The available_gib column should report the expected free space correctly.
Reviewed: https:/ /review. opendev. org/c/starlingx /config/ +/874087 /opendev. org/starlingx/ config/ commit/ b0eb83f6acab943 35648b48e496278 eb85fbaac7
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit b0eb83f6acab943 35648b48e496278 eb85fbaac7
Author: Felipe Sanches Zanoni <email address hidden>
Date: Tue Feb 14 11:39:14 2023 -0500
Adjust function to report correctly free space for multipath disks
The command host-disk-list was reporting free space wrongly for
multipath disks that have partitions added to nova-local
logical volume.
This happens when the device node path has a dash in it like in mapper/ mpathc- part1'. A 'grep -w' command was used to verify mpathc' to be matched with mapper/ mpathc- part1', once 'grep -w' detects the word mapper/ mpathc' .
'/dev/
if the device node is a physical volume. The command 'grep -w'
searchs for whole word, but the dash is considered a word separator,
causing the device node '/dev/mapper/
'/dev/
'/dev/
To fix this, the command is changed to detect the device node as mapper/ mpathc '.
a string with an extra space at the end, for instance,
'/dev/
As an example consider device_ node='/ dev/mapper/ mpathc' and dev/mapper/ mpatha- part5 cgts-vg lvm2 a-- <488.41g 251.59g dev/mapper/ mpathb cgts-vg lvm2 a-- <20.00g <20.00g dev/mapper/ mpathc- part1 cgts-vg lvm2 a-- <15.00g <15.00g
the output of 'pvs' command below:
PV VG Fmt Attr PSize PFree
/
/
/
The 'pvs | grep -w /dev/mapper/mpathc' will match the string mapper/ mpathc- part1', but it should not.
'/dev/
The 'pvs | grep "/dev/mapper/mpathc "' will not match any
string in that output.
Test Plan:
column should report the expected free space correctly.
column should report the expected free space correctly.
PASS: Install AIO-SX with multipath disks, add a new partition
to a spare multipath disk using half of its capacity.
Add this partition to nova-local logical volume group and
run 'system host-disk-list controller-0'. The available_gib
PASS: Install AIO-SX without multipath disks, add a new partition
to a spare disk using half of its capacity.
Add this partition to nova-local logical volume group and
run 'system host-disk-list controller-0'. The available_gib
Closes-bug: 2007309 0858623d7ada8a3 91fd783ca32
Signed-off-by: Felipe Sanches Zanoni <email address hidden>
Change-Id: If7636f39c0ff3d