Skip to content

Commit

Permalink
Merge pull request #59 from varkoly/SLE-15-SP3
Browse files Browse the repository at this point in the history
Check if HANA DB is running on the nodes
  • Loading branch information
varkoly authored Feb 7, 2025
2 parents f1602c5 + 29aad0e commit d552531
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:

- name: Unit Tests
run: rake test:unit
# enable code coverage reporting
# disable code coverage reporting
env:
COVERAGE: 1
COVERAGE: 0

# send the coverage report to coveralls.io
- name: Coveralls Report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
#- name: Coveralls Report
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}

Package:
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-sap-ha.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Feb 6 08:58:53 UTC 2025 - Peter Varkoly <[email protected]>

- yast sap_ha should check if HDB is running on primary
(bsc#1235773) Build in a check if the DB is running on both nodes.
- 4.3.1

-------------------------------------------------------------------
Mon Aug 7 05:06:22 UTC 2023 - Peter Varkoly <[email protected]>

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


Name: yast2-sap-ha
Version: 4.3.0
Version: 4.3.1
Release: 0

BuildArch: noarch
Expand Down
1 change: 1 addition & 0 deletions src/data/sap_ha/help_prereq_hana_su_co.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ <h3>SAP HANA System Replication Scale Up: Cost-Optimized</h3>
There are two machines with SAP HANA installed.
<br/> Note that the machine you run the wizard on becomes the primary node in the cluster.
</li>
<li>Verify that both databases are up and running.</li>
<li>
You have created one of the following:
<ul type="square">
Expand Down
1 change: 1 addition & 0 deletions src/data/sap_ha/help_prereq_hana_su_co_azure.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h3>SAP HANA System Replication Scale Up: Cost-Optimized in Microsoft&reg; Azure
There are two machines with SAP HANA installed.
<br/> Note that the machine you run the wizard on becomes the primary node in the cluster.
</li>
<li>Verify that both databases are up and running.</li>
<li>
The master node SSH public key is authorized for SSH access to the secondary node. This is needed when SSH password access is disabled, which is the default on Microsoft Azure.
</li>
Expand Down
1 change: 1 addition & 0 deletions src/data/sap_ha/help_prereq_hana_su_mt.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ <h3>SAP HANA System Replication Scale Up: Multi-Tier</h3>
There are two machines with SAP HANA installed.
<br> Note that the machine you run the wizard on becomes the primary node in the cluster.
</li>
<li>Verify that both databases are up and running.</li>
<li>
You have created one of the following:
<ul type="square">
Expand Down
1 change: 1 addition & 0 deletions src/data/sap_ha/help_prereq_hana_su_mt_azure.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h3>SAP HANA System Replication Scale Up: Multi-Tier in Microsoft&reg; Azure&reg
There are two machines with SAP HANA installed.
<br> Note that the machine you run the wizard on becomes the primary node in the cluster.
</li>
<li>Verify that both databases are up and running.</li>
<li>
The master node SSH public key is authorized for SSH access to the secondary node. This is needed when SSH password access is disabled, which is the default on Microsoft Azure.
</li>
Expand Down
1 change: 1 addition & 0 deletions src/data/sap_ha/help_prereq_hana_su_po.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ <h3>SAP HANA System Replication Scale Up: Performance-Optimized</h3>
There are two machines with SAP HANA installed.
<br> Note that the machine you run the wizard on becomes the primary node in the cluster.
</li>
<li>Verify that both databases are up and running.</li>
<li>
You have created one of the following:
<ul type="square">
Expand Down
1 change: 1 addition & 0 deletions src/data/sap_ha/help_prereq_hana_su_po_azure.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h3>SAP HANA System Replication Scale Up: Performance-Optimized in Microsoft&reg
There are two machines with SAP HANA installed.
<br> Note that the machine you run the wizard on becomes the primary node in the cluster.
</li>
<li>Verify that both databases are up and running.</li>
<li>
The master node SSH public key is authorized for SSH access to the secondary node. This is needed when SSH password access is disabled, which is the default on Microsoft Azure.
</li>
Expand Down
7 changes: 7 additions & 0 deletions src/lib/sap_ha/configuration/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ def other_nodes
ips
end

# return all IPs of the first ring
def all_nodes
ips = @nodes.map { |_, n| n[:ip_ring1] }
return [] if ips.any?(&:empty?)
ips
end

def set_host_password(ip, password)
node = @nodes.values.find { |v| v[:ip_ring1] == ip }
if node.nil?
Expand Down
1 change: 1 addition & 0 deletions src/lib/sap_ha/configuration/hana.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def configured?

def validate(verbosity = :verbose)
SemanticChecks.instance.check(verbosity) do |check|
check.hana_is_running(@system_id, @instance, @global_config.cluster.all_nodes)
check.ipv4(@virtual_ip, "Virtual IP")
check.nonneg_integer(@virtual_ip_mask, "Virtual IP mask")
check.integer_in_range(@virtual_ip_mask, 1, 32, "CIDR mask has to be between 1 and 32.",
Expand Down
27 changes: 25 additions & 2 deletions src/lib/sap_ha/semantic_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require "sap_ha/exceptions"
require "yast"
require "erb"
require "sap_ha/system/shell_commands"

Yast.import "IP"
Yast.import "Hostname"
Expand All @@ -31,6 +32,7 @@ module SapHA
class SemanticChecks
include Singleton
include Yast::Logger
include SapHA::System::ShellCommands

attr_accessor :silent
attr_reader :checks_passed
Expand Down Expand Up @@ -264,6 +266,28 @@ def non_empty_string(value, message, field_name, hide_value = false)
report_error(flag, message || "The value must be a non-empty string", field_name, shown_value)
end

def hana_is_running(system_id, instance_number, nodes)
flag = true
message = ''
my_ips = SapHA::System::Network.ip_addresses
procname = "hdb.sap#{system_id.upcase}_HDB#{instance_number}"
if @no_test
nodes.each do |node|
log.debug("node #{node} #{my_ips}")
if my_ips.include?(node)
status = exec_status("pidof", procname)
else
status = exec_status("ssh", "-o", "StrictHostKeyChecking=no", node, "pidof", procname)
end
if status != 0
flag = false
message += "<br>No SAP HANA #{system_id} is running on #{node}"
end
end
end
report_error(flag, message, '', '')
end

# Check if string is a block device
# @param value [String] device path
def block_device(value, field_name)
Expand Down Expand Up @@ -343,11 +367,10 @@ def error_string(field_name, explanation, value = nil)
explanation = explanation[0..-2] if explanation.end_with? "."
explanation = explanation
if field_name.empty?
"Invalid input: #{explanation}"
"Error detected: #{explanation}"
elsif value.nil? || (value.is_a?(::String) && value.empty?)
"Invalid entry for #{field_name}: #{explanation}."
else

"Invalid entry for #{field_name} (\"#{ERB::Util.html_escape(value)}\"): #{explanation}."
end
end
Expand Down

0 comments on commit d552531

Please sign in to comment.