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”)



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

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 = vfstype == "nfs" || vfstype == "nfs4" ?
    "nfs" :
    Ops.get(fields, 0, "")
  Builtins.y2milestone("%1 is on device: %2", mount_point, device)
  device
end

- (Object) getiBFTDevices



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File '../../src/modules/NetworkStorage.rb', line 65

def getiBFTDevices
  if SCR.Execute(path(".target.bash"), "ls /sys/firmware/ibft") == 0
    output = Convert.convert(
      SCR.Execute(
        path(".target.bash_output"),
        "ls /sys/firmware/ibft/ethernet*/device/net/"
      ),
      :from => "any",
      :to   => "map <string, any>"
    )
    ifaces = Builtins.filter(
      Builtins.splitstring(Ops.get_string(output, "stdout", ""), "\n")
    ) { |row| Ops.greater_than(Builtins.size(row), 0) }
    return deep_copy(ifaces)
  else
    return []
  end
end

- (Object) isDiskOnNetwork(device)

If the disk is on a networked device (NFS, ISCSI), the main NIC needs STARTMODE nfsroot instead of auto.

Returns:

  • root dev over network: noiscsi nfsfcoe



61
62
63
# File '../../src/modules/NetworkStorage.rb', line 61

def isDiskOnNetwork(device)
  Storage.IsDeviceOnNetwork(device)
end

- (Object) main



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

def main

  Yast.import "Storage"
end