Merge pull request #10230 from leseb/fix-9470
core: append filesystem property on disk
This commit is contained in:
3 files changed
+17
-1
No files matched your search
@@ -168,6 +168,12 @@ func PopulateDeviceInfo(d string, executor exec.Executor) (*sys.LocalDisk, error
|
||||
if val, ok := diskProps["KNAME"]; ok {
|
||||
disk.KernelName = path.Base(val)
|
||||
}
|
||||
if val, ok := diskProps["FSTYPE"]; ok && val != "" {
|
||||
disk.Filesystem = path.Base(val)
|
||||
}
|
||||
if val, ok := diskProps["MOUNTPOINT"]; ok && val != "" {
|
||||
disk.Mountpoint = path.Base(val)
|
||||
}
|
||||
|
||||
return disk, nil
|
||||
}
|
||||
|
||||
@@ -296,6 +296,12 @@ func getAvailableDevices(context *clusterd.Context, agent *OsdAgent) (*DeviceOsd
|
||||
continue
|
||||
}
|
||||
|
||||
// Add detection for mounted device and skip if mounted
|
||||
if device.Mountpoint != "" {
|
||||
logger.Infof("skipping device %q with mountpoint %q", device.Name, device.Mountpoint)
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore device with filesystem signature since c-v inventory
|
||||
// cannot detect that correctly
|
||||
// see: https://tracker.ceph.com/issues/43585
|
||||
|
||||
@@ -97,6 +97,8 @@ type LocalDisk struct {
|
||||
Partitions []Partition
|
||||
// Filesystem is the filesystem currently on the device
|
||||
Filesystem string `json:"filesystem"`
|
||||
// Mountpoint is the mountpoint of the filesystem's on the device
|
||||
Mountpoint string `json:"mountpoint"`
|
||||
// Vendor is the device vendor
|
||||
Vendor string `json:"vendor"`
|
||||
// Model is the device model
|
||||
@@ -208,11 +210,12 @@ func GetDeviceProperties(device string, executor exec.Executor) (map[string]stri
|
||||
// GetDevicePropertiesFromPath gets a device property from a path
|
||||
func GetDevicePropertiesFromPath(devicePath string, executor exec.Executor) (map[string]string, error) {
|
||||
output, err := executor.ExecuteCommandWithOutput("lsblk", devicePath,
|
||||
"--bytes", "--nodeps", "--pairs", "--paths", "--output", "SIZE,ROTA,RO,TYPE,PKNAME,NAME,KNAME")
|
||||
"--bytes", "--nodeps", "--pairs", "--paths", "--output", "SIZE,ROTA,RO,TYPE,PKNAME,NAME,KNAME,MOUNTPOINT,FSTYPE")
|
||||
if err != nil {
|
||||
logger.Errorf("failed to execute lsblk. output: %s", output)
|
||||
return nil, err
|
||||
}
|
||||
logger.Debugf("lsblk output: %q", output)
|
||||
|
||||
return parseKeyValuePairString(output), nil
|
||||
}
|
||||
@@ -236,6 +239,7 @@ func GetUdevInfo(device string, executor exec.Executor) (map[string]string, erro
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logger.Debugf("udevadm info output: %q", output)
|
||||
|
||||
return parseUdevInfo(output), nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user