Skip to content

Commit

Permalink
Dev: ui_cluster: replace --qdevice as --qnetd-hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Dec 9, 2019
1 parent 76a6f13 commit 000f2a7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion crmsh/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def check_prereqs(stage):

if stage == "qdevice":
if not _context.qdevice:
error("qdevice related options are missing (--qdevice option is mandatory, find for more information using --help)")
error("qdevice related options are missing (--qnetd-hostname option is mandatory, find for more information using --help)")

if warned:
if not confirm("Do you want to continue anyway?"):
Expand Down
6 changes: 3 additions & 3 deletions crmsh/ui_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ def looks_like_hostnames(lst):
help="Configure corosync with second heartbeat line")
network_group.add_option("-I", "--ipv6", action="store_true", dest="ipv6",
help="Configure corosync use IPv6")
network_group.add_option("--qdevice",
dest="qdevice", metavar="IP",
help="IP or host name of the QNetd server to be used")
network_group.add_option("--qnetd-hostname",
dest="qdevice", metavar="HOST",
help="HOST or IP of the QNetd server to be used")
network_group.add_option("--qdevice-port",
dest="qdevice_port", metavar="PORT", type="int", default=5403,
help="TCP PORT of QNetd server(default:5403)")
Expand Down
8 changes: 4 additions & 4 deletions test/features/qdevice_options.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: corosync qdevice/qnetd options
Scenario: Use "--qdevice-algo" to change qnetd decision algorithm to "lms"
Given Cluster service is "stopped" on "hanode1"
And Service "corosync-qdevice" is "stopped" on "hanode1"
When Run "crm cluster init --qdevice=qnetd-node --qdevice-algo=lms -y --no-overwrite-sshkey" on "hanode1"
When Run "crm cluster init --qnetd-hostname=qnetd-node --qdevice-algo=lms -y --no-overwrite-sshkey" on "hanode1"
Then Cluster service is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode1"
When Run "crm cluster join -c hanode1 -y" on "hanode2"
Expand All @@ -25,7 +25,7 @@ Feature: corosync qdevice/qnetd options
Scenario: Use "--qdevice-tie-breaker" to change qnetd tie_breaker to "highest"
Given Cluster service is "stopped" on "hanode1"
And Service "corosync-qdevice" is "stopped" on "hanode1"
When Run "crm cluster init --qdevice=qnetd-node --qdevice-tie-breaker=highest -y --no-overwrite-sshkey" on "hanode1"
When Run "crm cluster init --qnetd-hostname=qnetd-node --qdevice-tie-breaker=highest -y --no-overwrite-sshkey" on "hanode1"
Then Cluster service is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode1"
And Show corosync qdevice configuration
Expand All @@ -34,7 +34,7 @@ Feature: corosync qdevice/qnetd options
Scenario: Use "--qdevice-tls" to turn off TLS certification
Given Cluster service is "stopped" on "hanode1"
And Service "corosync-qdevice" is "stopped" on "hanode1"
When Run "crm cluster init --qdevice=qnetd-node --qdevice-tls=off -y --no-overwrite-sshkey" on "hanode1"
When Run "crm cluster init --qnetd-hostname=qnetd-node --qdevice-tls=off -y --no-overwrite-sshkey" on "hanode1"
Then Cluster service is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode1"
And Show corosync qdevice configuration
Expand All @@ -43,7 +43,7 @@ Feature: corosync qdevice/qnetd options
Scenario: Use "--qdevice-heuristics" to configure heuristics
Given Cluster service is "stopped" on "hanode1"
And Service "corosync-qdevice" is "stopped" on "hanode1"
When Run "crm cluster init --qdevice=qnetd-node --qdevice-heuristics='/usr/bin/test -f /tmp/file_exists;/usr/bin/which pacemaker' -y --no-overwrite-sshkey" on "hanode1"
When Run "crm cluster init --qnetd-hostname=qnetd-node --qdevice-heuristics='/usr/bin/test -f /tmp/file_exists;/usr/bin/which pacemaker' -y --no-overwrite-sshkey" on "hanode1"
Then Cluster service is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode1"
And Show corosync qdevice configuration
6 changes: 3 additions & 3 deletions test/features/qdevice_setup_remove.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: corosync qdevice/qnetd setup/remove process

@clean
Scenario: Setup qdevice/qnetd during init/join process
When Run "crm cluster init --qdevice=qnetd-node -y --no-overwrite-sshkey" on "hanode1"
When Run "crm cluster init --qnetd-hostname=qnetd-node -y --no-overwrite-sshkey" on "hanode1"
Then Cluster service is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode1"
When Run "crm cluster join -c hanode1 -y" on "hanode2"
Expand All @@ -32,7 +32,7 @@ Feature: corosync qdevice/qnetd setup/remove process
Then Cluster service is "started" on "hanode2"
And Online nodes are "hanode1 hanode2"
And Service "corosync-qdevice" is "stopped" on "hanode2"
When Run "crm cluster init qdevice --qdevice=qnetd-node -y" on "hanode1"
When Run "crm cluster init qdevice --qnetd-hostname=qnetd-node -y" on "hanode1"
Then Service "corosync-qdevice" is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode2"
And Service "corosync-qnetd" is "started" on "qnetd-node"
Expand All @@ -41,7 +41,7 @@ Feature: corosync qdevice/qnetd setup/remove process

@clean
Scenario: Remove qdevice from a two nodes cluster
When Run "crm cluster init --qdevice=qnetd-node -y --no-overwrite-sshkey" on "hanode1"
When Run "crm cluster init --qnetd-hostname=qnetd-node -y --no-overwrite-sshkey" on "hanode1"
Then Cluster service is "started" on "hanode1"
And Service "corosync-qdevice" is "started" on "hanode1"
When Run "crm cluster join -c hanode1 -y" on "hanode2"
Expand Down
34 changes: 17 additions & 17 deletions test/features/qdevice_validate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,70 @@ Feature: corosync qdevice/qnetd options validate
Tag @clean means need to stop cluster service if the service is available

@clean
Scenario: Option "--qdevice" use the same node
When Try "crm cluster init --qdevice=hanode1"
Scenario: Option "--qnetd-hostname" use the same node
When Try "crm cluster init --qnetd-hostname=hanode1"
Then Except "ERROR: cluster.init: host for qnetd must be a remote one"

@clean
Scenario: Option "--qdevice" use hanode1's IP
When Try "crm cluster init --qdevice=10.10.10.2"
Scenario: Option "--qnetd-hostname" use hanode1's IP
When Try "crm cluster init --qnetd-hostname=10.10.10.2"
Then Except "ERROR: cluster.init: host for qnetd must be a remote one"

@clean
Scenario: Option "--qdevice" use unknown hostname
When Try "crm cluster init --qdevice=error-node"
Scenario: Option "--qnetd-hostname" use unknown hostname
When Try "crm cluster init --qnetd-hostname=error-node"
Then Except "ERROR: cluster.init: host "error-node" is unreachable"

@clean
Scenario: Service ssh on qnetd node not available
When Try "crm cluster init --qdevice=node-without-ssh"
When Try "crm cluster init --qnetd-hostname=node-without-ssh"
Then Except "ERROR: cluster.init: ssh service on "node-without-ssh" not available"

@clean
Scenario: Option "--qdevice-port" set wrong port
When Try "crm cluster init --qdevice=qnetd-node --qdevice-port=1"
When Try "crm cluster init --qnetd-hostname=qnetd-node --qdevice-port=1"
Then Except "ERROR: cluster.init: invalid qdevice port range(1024 - 65535)"

@clean
Scenario: Option "--qdevice-algo" set wrong value
When Try "crm cluster init --qdevice=qnetd-node --qdevice-algo=wrongalgo"
When Try "crm cluster init --qnetd-hostname=qnetd-node --qdevice-algo=wrongalgo"
Then Except "ERROR: cluster.init: invalid qdevice algorithm(ffsplit/lms)"

@clean
Scenario: Option "--qdevice-tie-breaker" set wrong value
When Try "crm cluster init --qdevice=qnetd-node --qdevice-tie-breaker=wrongtiebreaker"
When Try "crm cluster init --qnetd-hostname=qnetd-node --qdevice-tie-breaker=wrongtiebreaker"
Then Except "ERROR: cluster.init: invalid qdevice tie_breaker(lowest/highest/valid_node_id)"

@clean
Scenario: Option "--qdevice-tls" set wrong value
When Try "crm cluster init --qdevice=qnetd-node --qdevice-tls=wrong"
When Try "crm cluster init --qnetd-hostname=qnetd-node --qdevice-tls=wrong"
Then Except "ERROR: cluster.init: invalid qdevice tls(on/off/required)"

@clean
Scenario: Option "--qdevice-heuristics" set wrong value
When Try "crm cluster init --qdevice=qnetd-node --qdevice-heuristics='ls /opt'"
When Try "crm cluster init --qnetd-hostname=qnetd-node --qdevice-heuristics='ls /opt'"
Then Except "ERROR: cluster.init: commands for heuristics should be absolute path"
When Try "crm cluster init --qdevice=qnetd-node --qdevice-heuristics='/bin/not_exists_cmd /opt'"
When Try "crm cluster init --qnetd-hostname=qnetd-node --qdevice-heuristics='/bin/not_exists_cmd /opt'"
Then Except "ERROR: cluster.init: command /bin/not_exists_cmd not exists"

@clean
Scenario: Node for qnetd is a cluster node
Given Cluster service is "stopped" on "hanode2"
When Run "crm cluster init -y --no-overwrite-sshkey" on "hanode2"
Then Cluster service is "started" on "hanode2"
When Try "crm cluster init --qdevice=hanode2 -y --no-overwrite-sshkey"
When Try "crm cluster init --qnetd-hostname=hanode2 -y --no-overwrite-sshkey"
Then Except "ERROR: cluster.init: host for qnetd must be a non-cluster node"

@clean
Scenario: Run qdevice stage on inactive cluster node
Given Cluster service is "stopped" on "hanode1"
When Try "crm cluster init qdevice --qdevice=qnetd-node"
When Try "crm cluster init qdevice --qnetd-hostname=qnetd-node"
Then Except "ERROR: cluster.init: Cluster is inactive - can't run qdevice stage"

@clean
Scenario: Run qdevice stage but miss "--qdevice" option
Scenario: Run qdevice stage but miss "--qnetd-hostname" option
Given Cluster service is "stopped" on "hanode1"
When Run "crm cluster init -y --no-overwrite-sshkey" on "hanode1"
Then Cluster service is "started" on "hanode1"
When Try "crm cluster init qdevice"
Then Except "ERROR: cluster.init: qdevice related options are missing (--qdevice option is mandatory, find for more information using --help)"
Then Except "ERROR: cluster.init: qdevice related options are missing (--qnetd-hostname option is mandatory, find for more information using --help)"

0 comments on commit 000f2a7

Please sign in to comment.