Skip to content

Commit

Permalink
Merge pull request #28 from dell/hotfix-lsblk-mountpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
boyamurthy authored Aug 28, 2023
2 parents 6df3480 + f415b11 commit f7f26c1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gofsutil_mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (fs *FS) getMountInfoFromDevice(
}
//check if devID has powerpath devices
/* #nosec G204 */
checkCmd := "lsblk -P | awk '/emcpower.+" + devID + "/ {print $0}'"
checkCmd := "lsblk --pairs --output NAME,MAJ:MIN,RM,SIZE,RO,TYPE,MOUNTPOINT | awk '/emcpower.+" + devID + "/ {print $0}'"
log.Debugf("ppath checkcommand values is %s", checkCmd)
/* #nosec G204 */
buf, err := exec.Command("bash", "-c", checkCmd).Output()
Expand All @@ -417,7 +417,7 @@ func (fs *FS) getMountInfoFromDevice(
// output is nil, powerpath device not found, continuing for multipath or single device
log.Info("powerpath command output is nil, continuing for multipath or single device")
/* #nosec G204 */
checkCmd = "lsblk -P | awk '/mpath.+" + devID + "/ {print $0}'"
checkCmd = "lsblk --pairs --output NAME,MAJ:MIN,RM,SIZE,RO,TYPE,MOUNTPOINT | awk '/mpath.+" + devID + "/ {print $0}'"
log.Debugf("mpath checkcommand values is %s", checkCmd)

/* #nosec G204 */
Expand All @@ -429,14 +429,14 @@ func (fs *FS) getMountInfoFromDevice(
log.Debugf("multipath exec command output is : %+v", output)
if output != "" {
if lsblkNew {
cmd = "lsblk -Px MODE | awk '/" + devID + "/{if (a && a !~ /" + devID + "/) print a; print} {a=$0}'"
cmd = "lsblk --pairs --sort MODE --output NAME,MAJ:MIN,RM,SIZE,RO,TYPE,MOUNTPOINT | awk '/" + devID + "/{if (a && a !~ /" + devID + "/) print a; print} {a=$0}'"
} else {
cmd = "lsblk -P | awk '/" + devID + "/{if (a && a !~ /" + devID + "/) print a; print} {a=$0}'"
cmd = "lsblk --pairs --output NAME,MAJ:MIN,RM,SIZE,RO,TYPE,MOUNTPOINT | awk '/" + devID + "/{if (a && a !~ /" + devID + "/) print a; print} {a=$0}'"
}
} else {
// multipath device not found, continue as single device
/* #nosec G204 */
cmd = "lsblk -P | awk '/" + devID + "/ {print $0}'"
cmd = "lsblk --pairs --output NAME,MAJ:MIN,RM,SIZE,RO,TYPE,MOUNTPOINT | awk '/" + devID + "/ {print $0}'"
}
log.Debugf("command value is %s", cmd)
/* #nosec G204 */
Expand Down

0 comments on commit f7f26c1

Please sign in to comment.