Skip to content

Commit d800533

Browse files
anjannathcfergeau
authored andcommitted
Issue #434 Remove hardcoded block device name when getting disk usage
Get the usage details by using the mount point /sysroot as depending on the hypervisor being used, the device name may not be /dev/vda3
1 parent c3fe42d commit d800533

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pkg/crc/cluster/cluster.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ func CheckCertsValidity(driver drivers.Driver) error {
4040
}
4141

4242
// Return size of disk, used space in bytes and the mountpoint
43-
func GetDiskUsage(driver drivers.Driver, device string) (int64, int64, error) {
44-
cmd := fmt.Sprintf(
45-
"df -B1 --output=size,used,target %s | tail -1",
46-
device)
43+
func GetRootPartitionUsage(driver drivers.Driver) (int64, int64, error) {
44+
cmd := "df -B1 --output=size,used,target /sysroot | tail -1"
4745

4846
out, err := drivers.RunSSHCommandFromDriver(driver, cmd)
4947

pkg/crc/machine/machine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ func Status(statusConfig ClusterStatusConfig) (ClusterStatusResult, error) {
424424
// TODO:get openshift version as well and add to status
425425
openshiftStatus = fmt.Sprintf("Running (v4.x)")
426426
}
427-
diskSize, diskUse, err = cluster.GetDiskUsage(host.Driver, "/dev/vda3")
427+
diskSize, diskUse, err = cluster.GetRootPartitionUsage(host.Driver)
428428
if err != nil {
429429
result.Success = false
430430
result.Error = err.Error()

0 commit comments

Comments
 (0)