We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4ec1858 + 14b3d6f commit fabc9c1Copy full SHA for fabc9c1
pkg/services/provision/pool/block_devices.go
@@ -8,15 +8,10 @@ package pool
8
import (
9
"encoding/json"
10
"os/exec"
11
- "strconv"
12
13
"github.com/pkg/errors"
14
)
15
16
-var fsTypeToString = map[string]string{
17
- "ef53": ext4,
18
- "2fc12fc1": ZFS,
19
-}
20
21
type blockDeviceList struct {
22
BlockDevices []blockDevice `json:"blockdevices"`
@@ -27,11 +22,6 @@ type blockDevice struct {
27
MountPoint string `json:"mountpoint"`
28
23
}
29
24
30
-// detectFSType detects the filesystem type of the underlying mounted filesystem.
31
-func detectFSType(fsType int64) string {
32
- return fsTypeToString[strconv.FormatInt(fsType, 16)]
33
34
-
35
25
// getBlockDeviceTypes returns a filesystem type list of mounted block devices.
36
26
func getBlockDeviceTypes() (map[string]string, error) {
37
output, err := exec.Command("lsblk", "--json", "--output", "type,mountpoint").Output()
pkg/services/provision/pool/fstype_bsd.go
@@ -0,0 +1,38 @@
1
+// +build darwin freebsd dragonfly openbsd solaris
2
+
3
+/*
4
+2020 © Postgres.ai
5
+*/
6
7
+// Package pool provides components to work with storage pools.
+package pool
+import (
+ "syscall"
+)
+func (pm *Manager) getFSInfo(path string) (string, error) {
+ fs := syscall.Statfs_t{}
+ if err := syscall.Statfs(path, &fs); err != nil {
+ return "", err
+ }
+ fsType := detectFSType(fs.Fstypename[:])
+ if fsType == ext4 {
+ // cannot detect LVM checking the blockDeviceTypes map.
+ return LVM, nil
+ return fsType, nil
+}
+// detectFSType detects the filesystem type of the underlying mounted filesystem.
+func detectFSType(fsType []int8) string {
+ fsTypeBytes := make([]byte, 0, len(fsType))
+ for _, v := range fsType {
+ fsTypeBytes = append(fsTypeBytes, byte(v))
+ return string(fsTypeBytes)
38
pkg/services/provision/pool/fstype_linux.go
+// +build linux,!s390x,!arm,!386
+ "strconv"
+var fsTypeToString = map[string]string{
+ "ef53": ext4,
+ "2fc12fc1": ZFS,
+ fsType := detectFSType(fs.Type)
+func detectFSType(fsType int64) string {
+ return fsTypeToString[strconv.FormatInt(fsType, 16)]
pkg/services/provision/pool/fstype_windows.go
@@ -0,0 +1,13 @@
+// +build windows
+ // Not supported for windows.
+ return "", nil
pkg/services/provision/pool/pool_manager.go
@@ -10,7 +10,6 @@ import (
"os"
"path"
"sync"
- "syscall"
"time"
@@ -284,21 +283,6 @@ func extractDataStateAt(dataPath string) (*time.Time, error) {
284
283
return &dsa, nil
285
286
287
-func (pm *Manager) getFSInfo(path string) (string, error) {
288
- fs := syscall.Statfs_t{}
289
- if err := syscall.Statfs(path, &fs); err != nil {
290
- return "", err
291
- }
292
293
- fsType := detectFSType(fs.Type)
294
- if fsType == ext4 {
295
- // cannot detect LVM checking the blockDeviceTypes map.
296
- return LVM, nil
297
298
299
- return fsType, nil
300
301
302
func (pm *Manager) describeAvailablePools() []string {
303
availablePools := []string{}
304
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments