Skip to content

Commit

Permalink
growLVForMicroshift: use root partition as devices option for pvs/lvs…
Browse files Browse the repository at this point in the history
… command

This PR make sure we are using correct device partition for all pvs/lvs and
lvextend command and this will help us fix issue with windows when lvm
system device file exist in the bundle with `/dev/vda3` as device name
and device id.

fixes: #3718
  • Loading branch information
praveenkumar committed Jun 26, 2023
1 parent 63c4e7b commit 0db57db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/crc/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ func runGrowpart(sshRunner *crcssh.Runner, rootPart string) error {
}

func growLVForMicroshift(sshRunner *crcssh.Runner, lvFullName string, rootPart string) error {
if _, _, err := sshRunner.RunPrivileged("Resizing the physical volume(PV)", "/usr/sbin/pvresize", rootPart); err != nil {
if _, _, err := sshRunner.RunPrivileged("Resizing the physical volume(PV)", "/usr/sbin/pvresize", "--devices", rootPart, rootPart); err != nil {
return err
}

// Get the size of volume group
sizeVG, _, err := sshRunner.RunPrivileged("Get the volume group size", "/usr/sbin/vgs", "--noheadings", "--nosuffix", "--units", "b", "-o", "vg_size")
sizeVG, _, err := sshRunner.RunPrivileged("Get the volume group size", "/usr/sbin/vgs", "--noheadings", "--nosuffix", "--units", "b", "-o", "vg_size", "--devices", rootPart)
if err != nil {
return err
}
Expand All @@ -191,7 +191,7 @@ func growLVForMicroshift(sshRunner *crcssh.Runner, lvFullName string, rootPart s
}

// Get the size of root lv
sizeLV, _, err := sshRunner.RunPrivileged("Get the size of root logical volume", "/usr/sbin/lvs", "-S", fmt.Sprintf("lv_full_name=%s", lvFullName), "--noheadings", "--nosuffix", "--units", "b", "-o", "lv_size")
sizeLV, _, err := sshRunner.RunPrivileged("Get the size of root logical volume", "/usr/sbin/lvs", "-S", fmt.Sprintf("lv_full_name=%s", lvFullName), "--noheadings", "--nosuffix", "--units", "b", "-o", "lv_size", "--devices", rootPart)
if err != nil {
return err
}
Expand All @@ -207,7 +207,7 @@ func growLVForMicroshift(sshRunner *crcssh.Runner, lvFullName string, rootPart s
lvPath := fmt.Sprintf("/dev/%s", lvFullName)
if sizeToIncrease > 1 {
logging.Info("Extending and resizing '/dev/rhel/root' logical volume")
if _, _, err := sshRunner.RunPrivileged("Extending and resizing the logical volume(LV)", "/usr/sbin/lvextend", "-L", fmt.Sprintf("+%db", sizeToIncrease), lvPath); err != nil {
if _, _, err := sshRunner.RunPrivileged("Extending and resizing the logical volume(LV)", "/usr/sbin/lvextend", "-L", fmt.Sprintf("+%db", sizeToIncrease), lvPath, "--devices", rootPart); err != nil {
return err
}
}
Expand Down

0 comments on commit 0db57db

Please sign in to comment.