Module: Yast::DrbdLvmConfInclude

Defined in:
../../src/include/drbd/lvm_conf.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) ConfigureLVMDialog



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File '../../src/include/drbd/lvm_conf.rb', line 126

def ConfigureLVMDialog
  lvm_conf_Read

  my_SetContents("lvm_conf", lvm_conf_GetDialog)
  status_switch

  ret = nil
  while true
    Wizard.SelectTreeItem("lvm_conf")
    status_switch

    ret = UI.UserInput

    if ret == :help
      #myHelp("lvm_conf")
      next
    end

    if ret == :wizardTree
      ret = Convert.to_string(UI.QueryWidget(Id(:wizardTree), :CurrentItem))
    end

    if ret == :Filter || ret == :LVMCache || ret == :AutoFilter
      Drbd.modified = true
      next
    end

    if ret == :abort || ret == :cancel
      if ReallyAbort()
        return deep_copy(ret)
      else
        next
      end
    end

    if ret == :next || ret == :back ||
        Builtins.contains(@DIALOG, Builtins.tostring(ret))
      next if !lvm_conf_Write

      if ret != :next && ret != :back
        ret = Builtins.symbolof(Builtins.toterm(ret))
      end

      break
    end
  end
  deep_copy(ret)
end

- (Object) initialize_drbd_lvm_conf(include_target)



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File '../../src/include/drbd/lvm_conf.rb', line 5

def initialize_drbd_lvm_conf(include_target)
  textdomain "drbd"

  Yast.import "Label"
  Yast.import "Wizard"
  Yast.import "Drbd"

  Yast.include include_target, "drbd/helps.rb"
  Yast.include include_target, "drbd/common.rb"

  @filter = ""
  @cache = true
  # Default is always true (auto)
  @auto_lvm_filter = true
end

- (Object) lvm_conf_GetDialog



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File '../../src/include/drbd/lvm_conf.rb', line 34

def lvm_conf_GetDialog
  _Tfilter = Frame(
    _("LVM Filter Configuration of DRBD"),
    Left(
      VBox(
        VBox(
          Left(
            CheckBox(
              Id(:AutoFilter),
              Opt(:notify),
              _("Modify LVM Device filter Automatically"),
              @auto_lvm_filter
            )
          )
        ),
        VBox(
          Left(
            InputField(
              Id(:Filter),
              Opt(:hstretch),
              _("Device Filter"),
              @filter
            )
          )
        ),
      )
    )
  )

  _Tcache = Frame(
    _("Writing the LVM cache"),
    Left(
      HSquash(
        VBox(
          VBox(
            Left(
              CheckBox(
                Id(:LVMCache),
                Opt(:notify),
                _("Enable LVM Cache"),
                @cache
              )
            )
          ),
        )
      )
    )
  )

  VBox(
    _Tfilter,
    VSpacing(1),
    _Tcache,
    VStretch()
  )
end

- (Object) lvm_conf_Read



21
22
23
24
25
26
27
28
29
30
31
32
# File '../../src/include/drbd/lvm_conf.rb', line 21

def lvm_conf_Read
  @filter = Ops.get_string( Drbd.lvm_config, "filter", "" )
  cache_str = Ops.get_string( Drbd.lvm_config, "write_cache_state", "1" )

  if cache_str == "0"
    @cache = false
  else
    @cache = true
  end

  nil
end

- (Object) lvm_conf_Write



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File '../../src/include/drbd/lvm_conf.rb', line 91

def lvm_conf_Write
  @filter = UI.QueryWidget(Id(:Filter), :Value).to_s
  @auto_lvm_filter = UI.QueryWidget(Id(:AutoFilter), :Value)

  @cache = UI.QueryWidget(Id(:LVMCache), :Value)

  if @cache
    cache_str = "1"
  else
    cache_str = "0"
  end

  Drbd.auto_lvm_filter = @auto_lvm_filter
  Ops.set(Drbd.lvm_config, "write_cache_state", cache_str)

  if !@auto_lvm_filter
    Ops.set(Drbd.lvm_config, "filter", @filter)
    Builtins.y2debug("Change Device Filter manually.")
  end

  Drbd.modified = true

  true
end

- (Object) status_switch



116
117
118
119
120
121
122
123
124
# File '../../src/include/drbd/lvm_conf.rb', line 116

def status_switch
  if UI.QueryWidget(Id(:AutoFilter), :Value)
    UI.ChangeWidget(Id(:Filter), :Enabled, false)
  else
    UI.ChangeWidget(Id(:Filter), :Enabled, true)
  end

  nil
end