Class: Yast::NetworkStorageClass

Inherits:
Module
  • Object
show all
Defined in:
../../src/modules/NetworkStorage.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) getDevice(mount_point)

Ask /proc/mounts what device a mount point is using.

Returns:

  • e.g. /dev/sda2 (or just “nfs”)



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File '../../src/modules/NetworkStorage.rb', line 41

def getDevice(mount_point)
  cmd = Builtins.sformat(
    "grep ' %1 ' /proc/mounts|grep -v rootfs|tr -d '\n'",
    mount_point
  )
  out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd))
  Builtins.y2milestone("mountpoint found %1", out)
  fields = Builtins.splitstring(Ops.get_string(out, "stdout", ""), " ")
  vfstype = Ops.get(fields, 2, "")
  device = if vfstype == "nfs" || vfstype == "nfs4"
             "nfs"
           else
             Ops.get(fields, 0, "")
           end
  Builtins.y2milestone("%1 is on device: %2", mount_point, device)
  device
end

- (Object) main



35
36
37
# File '../../src/modules/NetworkStorage.rb', line 35

def main
  Yast.import "Storage"
end