Skip to content

Commit

Permalink
Merge pull request #36 from liangxin1300/20230412_drbd_device_name_ma…
Browse files Browse the repository at this point in the history
…ster

Validate DRBD Device name
  • Loading branch information
joseivanlopez committed Apr 13, 2023
2 parents 0cbd313 + 9258914 commit fee7b13
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package/yast2-drbd.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 12 15:40:31 UTC 2023 - Xin Liang <xliang@suse.com>

- Validate DRBD Device name (bsc#1207952)
- 4.6.1

-------------------------------------------------------------------
Fri Mar 03 14:44:07 UTC 2023 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-drbd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

%define _fwdefdir %{_prefix}/lib/firewalld/services
Name: yast2-drbd
Version: 4.6.0
Version: 4.6.1
Release: 0
Summary: YaST2 - DRBD Configuration
License: GPL-2.0-or-later
Expand Down
16 changes: 16 additions & 0 deletions src/include/drbd/resource_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,16 @@ def autoGenerateNodeID(res_config)
deep_copy(res_config)
end

def ValidDeviceName
dev_name = UI.QueryWidget(Id(:n_devc), :Value).to_s
if ! (dev_name =~ /(\/dev\/|)(drbd0|drbd[1-9][0-9]*)$/)
Popup.Warning(_("Valid \"Device\" value should be:\n\
- /dev/drbd0\n- /dev/drbd[1-9][0-9]*\n- drbd0\n- drbd[1-9][0-9]*"))
return false
end
true
end

def ValidIPaddress
addressField = Convert.to_string(UI.QueryWidget(Id(:n_addr), :Value))

Expand Down Expand Up @@ -744,6 +754,12 @@ def ResDialog(resname)
next
end

if ! ValidDeviceName()
invalid = true
ret = nil
next
end

if ret == :ok
if node_list.size < 2
Popup.Warning(_("Please configure at least two nodes."))
Expand Down

0 comments on commit fee7b13

Please sign in to comment.