Module: Yast::DrbdLvmConfInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) ConfigureLVMDialog



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File '../../src/include/drbd/lvm_conf.rb', line 168

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
20
21
# 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
  @lvmetad = false

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

- (Object) lvm_conf_GetDialog



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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File '../../src/include/drbd/lvm_conf.rb', line 42

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

  _Tlvmetad = Frame(
    _("Use lvmetad for LVM"),
    Left(
      HSquash(
        VBox(
          VBox(
            Left(
              CheckBox(
                Id(:LVMetad),
                Opt(:notify),
                _("Use LVM metad"),
                @lvmetad
              )
            ),
            Left(Label(
              _(
                "Warning!  Should not use lvmetad for cluster."
              )
            )),
          ),
        )
      )
    )
  )

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

- (Object) lvm_conf_Read



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File '../../src/include/drbd/lvm_conf.rb', line 23

def lvm_conf_Read
  @filter = Ops.get_string( Drbd.lvm_config, "filter", "" )
  lvmetad_str = Ops.get_string( Drbd.lvm_config, "use_lvmetad", "0" )
  if lvmetad_str == "0"
    @lvmetad = false
  else
    @lvmetad = true
  end

  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



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
# File '../../src/include/drbd/lvm_conf.rb', line 126

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

  @lvmetad = UI.QueryWidget(Id(:LVMetad), :Value)
  if @lvmetad
    lvmetad_str = "1"
  else
    lvmetad_str = "0"
  end

  Drbd.auto_lvm_filter = @auto_lvm_filter
  Ops.set(Drbd.lvm_config, "write_cache_state", cache_str)
  Ops.set(Drbd.lvm_config, "use_lvmetad", lvmetad_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



158
159
160
161
162
163
164
165
166
# File '../../src/include/drbd/lvm_conf.rb', line 158

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