Hello community,
here is the log from the commit of package saphanabootstrap-formula for openSUSE:Factory checked in at 2019-07-04 15:43:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/saphanabootstrap-formula (Old)
and /work/SRC/openSUSE:Factory/.saphanabootstrap-formula.new.4615 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "saphanabootstrap-formula"
Thu Jul 4 15:43:19 2019 rev:2 rq:713172 version:0.2.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/saphanabootstrap-formula/saphanabootstrap-formula.changes 2019-05-08 15:16:46.993030927 +0200
+++ /work/SRC/openSUSE:Factory/.saphanabootstrap-formula.new.4615/saphanabootstrap-formula.changes 2019-07-04 15:43:21.870117930 +0200
@@ -1,0 +2,48 @@
+Tue Jul 2 11:14:50 UTC 2019 - Diego Vinicius Akechi
+
+- Version bump 0.2.4
+ * Change the salt-formula directories permissions to 0750 to avoid
+ conflicts with the package salt-standalone-formulas-configuration.
+
+ * Correct the required package name to
+ salt-standalone-formulas-configuration
+
+-------------------------------------------------------------------
+Mon Jul 1 11:27:50 UTC 2019 - Xabier Arbulu Insausti
+
+- Create package version 0.2.3 supporting hanadb_exporter logging system
+
+-------------------------------------------------------------------
+Wed Jun 19 14:23:59 UTC 2019 - Xabier Arbulu Insausti
+
+- Create package version 0.2.2 adding hanadb_exporter deployment
+
+-------------------------------------------------------------------
+Tue Jun 11 11:42:31 UTC 2019 - Xabier Arbulu Insausti
+
+- Create package version 0.2.1 with fixed spec files. Now the package
+ is available in all SLE12 and SLE15 versions (boo#1137989, jsc#SLE-4143)
+
+-------------------------------------------------------------------
+Thu Jun 6 07:28:43 UTC 2019 - Xabier Arbulu Insausti
+
+- Fix how qas instance number is created in scale_up_resources template
+
+-------------------------------------------------------------------
+Fri May 21 12:37:43 UTC 2019 - Diego Vinicius Akechi
+
+- Version bump 0.2.0
+ * Include the salt-formulas-configuration dependency on
+ SLE/Leap 15-SP1 and higher. This package configures the shared salt
+ formulas location (/usr/share/salt-formulas) to be used by SUMA 4.0
+ or salt in standalone mode.
+ * Drops the saphanabootstrap-formula-suma package, as the forms metadata
+ will be available only on SUMA 4.0 using the shared location.
+
+-------------------------------------------------------------------
+Thu May 16 08:52:06 UTC 2019 - Xabier Arbulu Insausti
+
+- Update formula to work with the latest shaptools code. In this version
+ the secondary node registration is managed completely in shaptools
+
+-------------------------------------------------------------------
Old:
----
saphanabootstrap-formula-0.1.0.tar.gz
New:
----
saphanabootstrap-formula-0.2.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ saphanabootstrap-formula.spec ++++++
--- /var/tmp/diff_new_pack.jR0NAW/_old 2019-07-04 15:43:22.562119012 +0200
+++ /var/tmp/diff_new_pack.jR0NAW/_new 2019-07-04 15:43:22.566119018 +0200
@@ -1,7 +1,7 @@
#
# spec file for package saphanabootstrap-formula
#
-# Copyright (c) 2018 SUSE LLC, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,40 +12,39 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# See also http://en.opensuse.org/openSUSE:Specfile_guidelines
Name: saphanabootstrap-formula
-Version: 0.1.0
-Release: 1
+Version: 0.2.4
+Release: 0
Summary: SAP HANA platform deployment formula
-
License: Apache-2.0
+
Url: https://github.com/SUSE/%{name}
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
-Requires: salt-shaptools
Requires: habootstrap-formula
+Requires: salt-shaptools
+
+# On SLE/Leap 15-SP1 and TW requires the new salt-formula configuration location.
+%if ! (0%{?sle_version:1} && 0%{?sle_version} < 150100)
+Requires: salt-standalone-formulas-configuration
+%endif
%define fname hana
-%define fdir %{_datadir}/susemanager/formulas
+%define fdir %{_datadir}/salt-formulas
%define ftemplates templates
%description
-SAP HANA deployment salt formula
-
-# package to deploy on SUMA specific path.
-%package suma
-Summary: SAP HANA platform deployment formula (SUMA specific)
-Requires: salt-shaptools
-Requires: habootstrap-formula-suma
-
-%description suma
-SAP HANA deployment salt formula (SUMA specific)
+SAP HANA deployment salt formula. This formula is capable to install
+SAP HANA nodes, enable system replication and configure SLE-HA cluster
+with the SAPHanaSR resource agent, using standalone salt or via SUSE Manager
+formulas with forms, available on SUSE Manager 4.0.
%prep
%setup -q
@@ -53,12 +52,17 @@
%build
%install
-pwd
+
+# before SUMA 4.0/15-SP1, install on the standard Salt Location.
+%if 0%{?sle_version:1} && 0%{?sle_version} < 150100
+
mkdir -p %{buildroot}/srv/salt/
cp -R %{fname} %{buildroot}/srv/salt/
cp -R %{ftemplates} %{buildroot}/srv/salt/%{fname}/
-# SUMA Specific
+%else
+
+# On SUMA 4.0/15-SP1, a single shared directory will be used.
mkdir -p %{buildroot}%{fdir}/states/%{fname}
mkdir -p %{buildroot}%{fdir}/metadata/%{fname}
cp -R %{fname} %{buildroot}%{fdir}/states
@@ -69,21 +73,28 @@
cp -R metadata.yml %{buildroot}%{fdir}/metadata/%{fname}
fi
+%endif
+%if 0%{?sle_version:1} && 0%{?sle_version} < 150100
%files
%defattr(-,root,root,-)
-%license LICENSE
+%if 0%{?sle_version} < 120300
+%doc README.md LICENSE
+%else
%doc README.md
+%license LICENSE
+%endif
/srv/salt/%{fname}
/srv/salt/%{fname}/%{ftemplates}
%dir %attr(0755, root, salt) /srv/salt
-%files suma
+%else
+
+%files
%defattr(-,root,root,-)
-%license LICENSE
%doc README.md
-%dir %{_datadir}/susemanager
+%license LICENSE
%dir %{fdir}
%dir %{fdir}/states
%dir %{fdir}/metadata
@@ -91,9 +102,10 @@
%{fdir}/states/%{fname}/%{ftemplates}
%{fdir}/metadata/%{fname}
-%dir %attr(0755, root, salt) %{_datadir}/susemanager
-%dir %attr(0755, root, salt) %{fdir}
-%dir %attr(0755, root, salt) %{fdir}/states
-%dir %attr(0755, root, salt) %{fdir}/metadata
+%dir %attr(0750, root, salt) %{fdir}
+%dir %attr(0750, root, salt) %{fdir}/states
+%dir %attr(0750, root, salt) %{fdir}/metadata
+
+%endif
%changelog
++++++ saphanabootstrap-formula-0.1.0.tar.gz -> saphanabootstrap-formula-0.2.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/README.md new/saphanabootstrap-formula-0.2.4/README.md
--- old/saphanabootstrap-formula-0.1.0/README.md 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/README.md 2019-07-03 10:00:51.613343765 +0200
@@ -37,7 +37,7 @@
is used in the example):
```bash
-sudo zypper addrepo zypper addrepo https://download.opensuse.org/repositories/network:ha-clustering:Factory/ope...
+sudo zypper addrepo https://download.opensuse.org/repositories/network:ha-clustering:Factory/ope...
sudo zypper ref
sudo zypper in saphanabootstrap-formula
```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/form.yml new/saphanabootstrap-formula-0.2.4/form.yml
--- old/saphanabootstrap-formula-0.1.0/form.yml 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/form.yml 2019-07-03 10:00:51.613343765 +0200
@@ -179,3 +179,31 @@
$name: Operation mode
$type: select
$values: [logreplay, delta_datashipping]
+ timeout:
+ $name: Timeout to wait until the primary node is enabled
+ $type: text
+ $optional: true
+
+ add_exporter:
+ $name: Add SAP HANA database metrics exporter
+ $type: boolean
+ $default: false
+ $help: Mark if you want add the SAP HANA database metrics exporter
+ exporter:
+ $name: SAP HANA database metrics exporter
+ $optional: true
+ $visibleIf: .add_exporter == true
+ $type: group
+ exposition_port:
+ $name: SAP HANA exposter exposition port
+ $type: text
+ $optional: true
+ user:
+ $name: SAP HANA user
+ $type: text
+ $default: SYSTEM
+ $optional: false
+ password:
+ $name: SAP HANA password
+ $type: password
+ $optional: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/copy_ssfs.sls new/saphanabootstrap-formula-0.2.4/hana/copy_ssfs.sls
--- old/saphanabootstrap-formula-0.1.0/hana/copy_ssfs.sls 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/copy_ssfs.sls 1970-01-01 01:00:00.000000000 +0100
@@ -1,51 +0,0 @@
-{%- from "hana/map.jinja" import hana with context -%}
-
-{% set host = grains['host'] %}
-
-{% for node in hana.nodes %}
-{% if node.host == host and node.secondary is defined %}
-
-add-network-repo:
- pkgrepo.managed:
- - name: network
- - baseurl: https://download.opensuse.org/repositories/network/SLE_12_SP3
- - gpgautoimport: True
-
-install-sshpass:
- pkg.installed:
- - name: sshpass
- - refresh: False
- - fromrepo: network
- - require:
- - add-network-repo
-
-{% for prim_node in hana.nodes %}
-{% if node.secondary.remote_host == prim_node.host and prim_node.primary is defined %}
-{% set primary_pass = prim_node.password %}
-
-copy-ssfs-data:
- cmd.run:
- - name: sshpass -p '{{ primary_pass }}' scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
- {{ node.sid.lower() }}adm@{{ node.secondary.remote_host }}:/usr/sap/{{ node.sid.upper() }}/SYS/global/security/rsecssfs/data/SSFS_{{ node.sid.upper() }}.DAT
- /usr/sap/{{ node.sid.upper() }}/SYS/global/security/rsecssfs/data/SSFS_{{ node.sid.upper() }}.DAT
- - runas: {{ node.sid.lower() }}adm
- - password: {{ node.password }}
- - require:
- - primary-available
- - install-sshpass
-
-copy-ssfs-key:
- cmd.run:
- - name: sshpass -p '{{ primary_pass }}' scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
- {{ node.sid.lower() }}adm@{{ node.secondary.remote_host }}:/usr/sap/{{ node.sid.upper() }}/SYS/global/security/rsecssfs/key/SSFS_{{ node.sid.upper() }}.KEY
- /usr/sap/{{ node.sid.upper() }}/SYS/global/security/rsecssfs/key/SSFS_{{ node.sid.upper() }}.KEY
- - runas: {{ node.sid.lower() }}adm
- - password: {{ node.password }}
- - require:
- - primary-available
- - install-sshpass
-
-{% endif %}
-{% endfor %}
-{% endif %}
-{% endfor %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/defaults.yaml new/saphanabootstrap-formula-0.2.4/hana/defaults.yaml
--- old/saphanabootstrap-formula-0.1.0/hana/defaults.yaml 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/defaults.yaml 2019-07-03 10:00:51.613343765 +0200
@@ -41,3 +41,4 @@
remote_instance: '00'
replication_mode: 'sync'
operation_mode: 'logreplay'
+ timeout: 600
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/enable_cost_optimized.sls new/saphanabootstrap-formula-0.2.4/hana/enable_cost_optimized.sls
--- old/saphanabootstrap-formula-0.1.0/hana/enable_cost_optimized.sls 1970-01-01 01:00:00.000000000 +0100
+++ new/saphanabootstrap-formula-0.2.4/hana/enable_cost_optimized.sls 2019-07-03 10:00:51.613343765 +0200
@@ -0,0 +1,55 @@
+{%- from "hana/map.jinja" import hana with context -%}
+{% set host = grains['host'] %}
+
+{% for node in hana.nodes %}
+{% if node.host == host and node.scenario_type is defined and node.scenario_type.lower() == 'cost-optimized' and node.cost_optimized_parameters is defined%}
+
+reduce_memory_resources_{{ node.host+node.sid }}:
+ hana.memory_resources_updated:
+ - name: {{ node.host }}
+ - global_allocation_limit: {{ node.cost_optimized_parameters.global_allocation_limit }}
+ - preload_column_tables: {{ node.cost_optimized_parameters.preload_column_tables }}
+ - user_name: SYSTEM
+ {% if node.install.system_user_password is defined %}
+ - user_password: {{ node.install.system_user_password }}
+ {% endif %}
+ - sid: {{ node.sid }}
+ - inst: {{ node.instance }}
+ - password: {{ node.password }}
+ - require:
+ - hana_install_{{ node.host+node.sid }}
+
+{% if node.host == host and node.secondary is defined %}
+
+setup_srHook_directory:
+ file.directory:
+ - name: /hana/shared/srHook
+ - user: {{ node.sid.lower() }}adm
+ - group: sapsys
+ - mode: 755
+ - makedirs: True
+
+install_srTakeover_hook:
+ file.managed:
+ - source: salt://hana/templates/srTakeover_hook.j2
+ - name: /hana/shared/srHook/sr-Takeover.py
+ - user: {{ node.sid.lower() }}adm
+ - group: sapsys
+ - template: jinja
+ - require:
+ - reduce_memory_resources_{{ node.host+node.sid }}
+ - setup_srHook_directory
+
+install_hana_python_packages:
+ archive.extracted:
+ - name: /hana/shared/srHook
+ - user: {{ node.sid.lower() }}adm
+ - group: sapsys
+ - enforce_toplevel: False
+ - source: {{ grains['hana_inst_folder']~'/DATA_UNITS/HDB_CLIENT_LINUX_X86_64/client/PYDBAPI.TGZ' }}
+ - require:
+ - reduce_memory_resources_{{ node.host+node.sid }}
+ - setup_srHook_directory
+{% endif %}
+{% endif %}
+{% endfor %}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/enable_secondary.sls new/saphanabootstrap-formula-0.2.4/hana/enable_secondary.sls
--- old/saphanabootstrap-formula-0.1.0/hana/enable_secondary.sls 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/enable_secondary.sls 2019-07-03 10:00:51.613343765 +0200
@@ -3,9 +3,10 @@
{% for node in hana.nodes %}
{% if node.host == host and node.secondary is defined %}
-include:
- - .primary_available
- - .copy_ssfs
+
+{% for prim_node in hana.nodes %}
+{% if node.secondary.remote_host == prim_node.host and prim_node.primary is defined %}
+{% set primary_pass = prim_node.password %}
{{ node.secondary.name }}:
hana.sr_secondary_registered:
@@ -16,8 +17,11 @@
- remote_instance: {{ node.secondary.remote_instance }}
- replication_mode: {{ node.secondary.replication_mode }}
- operation_mode: {{ node.secondary.operation_mode }}
- - require:
- - primary-available
+ - timeout: {{ node.secondary.primary_timeout|default(100) }}
+ - interval: {{ node.secondary.interval|default(10) }}
+ - primary_pass: {{ primary_pass }}
{% endif %}
{% endfor %}
+{% endif %}
+{% endfor %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/exporter.sls new/saphanabootstrap-formula-0.2.4/hana/exporter.sls
--- old/saphanabootstrap-formula-0.1.0/hana/exporter.sls 1970-01-01 01:00:00.000000000 +0100
+++ new/saphanabootstrap-formula-0.2.4/hana/exporter.sls 2019-07-03 10:00:51.613343765 +0200
@@ -0,0 +1,38 @@
+{%- from "hana/map.jinja" import hana with context -%}
+{% set host = grains['host'] %}
+
+{% for node in hana.nodes %}
+{% if node.host == host and node.exporter is defined %}
+
+{% set instance = '{:0>2}'.format(node.instance) %}
+{% set config_file = '/etc/hanadb_exporter/config_{}_{}.json'.format(node.sid, instance) %}
+
+hanadb_exporter:
+ pkg.installed
+
+python3-PyHDB:
+ pkg.installed
+
+configure_exporter:
+ file.managed:
+ - source: salt://hana/templates/hanadb_exporter.j2
+ - name: {{ config_file }}
+ - template: jinja
+ - require:
+ - hanadb_exporter
+ - python3-PyHDB
+
+stop_exporter:
+ process.absent:
+ - name: hanadb_exporter -c {{ config_file }} -m /etc/hanadb_exporter/metrics.json
+ - require:
+ - configure_exporter
+
+start_exporter:
+ cmd.run:
+ - name: nohup hanadb_exporter -c {{ config_file }} -m /etc/hanadb_exporter/metrics.json &>/dev/null &
+ - require:
+ - configure_exporter
+
+{% endif %}
+{% endfor %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/init.sls new/saphanabootstrap-formula-0.2.4/hana/init.sls
--- old/saphanabootstrap-formula-0.1.0/hana/init.sls 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/init.sls 2019-07-03 10:00:51.613343765 +0200
@@ -8,3 +8,4 @@
- hana.install
- hana.enable_primary
- hana.enable_secondary
+ - hana.exporter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/install.sls new/saphanabootstrap-formula-0.2.4/hana/install.sls
--- old/saphanabootstrap-formula-0.1.0/hana/install.sls 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/install.sls 2019-07-03 10:00:51.613343765 +0200
@@ -1,6 +1,9 @@
{%- from "hana/map.jinja" import hana with context -%}
{% set host = grains['host'] %}
+include:
+ - .enable_cost_optimized
+
{% for node in hana.nodes %}
{% if node.host == host and node.install is defined %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/packages.sls new/saphanabootstrap-formula-0.2.4/hana/packages.sls
--- old/saphanabootstrap-formula-0.1.0/hana/packages.sls 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/packages.sls 2019-07-03 10:00:51.613343765 +0200
@@ -10,6 +10,9 @@
patterns-sap-hana:
pkg.installed:
- fromrepo: {{ repo }}
+ - retry:
+ attempts: 3
+ interval: 15
{% else %}
install_required_packages:
@@ -21,15 +24,10 @@
{% endif %}
# Install shaptools depending on the os and python version
-{% if (grains['os_family'] == 'Suse') and (grains['osmajorrelease'] == 12) %}
-{% set python2_prefix = 'python' %}
-{% else %}
-{% set python2_prefix = 'python2' %}
-{% endif %}
-
{% if grains['pythonversion'][0] == 2 %}
-{{ python2_prefix }}-shaptools:
+python-shaptools:
{% else %}
python3-shaptools:
{% endif %}
- pkg.installed
+ pkg.installed:
+ - resolve_capabilities: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/pre_validation.sls new/saphanabootstrap-formula-0.2.4/hana/pre_validation.sls
--- old/saphanabootstrap-formula-0.1.0/hana/pre_validation.sls 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/pre_validation.sls 2019-07-03 10:00:51.613343765 +0200
@@ -44,6 +44,11 @@
{% endif %}
{% endif %}
{# Check HANA Systen replication mode finish #}
+ {# Check HANA exporter #}
+ {% if node.add_exporter is defined and node.add_exporter == false%}
+ {% do node.pop('exporter') %}
+ {% endif %}
+ {# Check HANA exporter finish #}
{% endif %}
{% endfor %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/hana/primary_available.sls new/saphanabootstrap-formula-0.2.4/hana/primary_available.sls
--- old/saphanabootstrap-formula-0.1.0/hana/primary_available.sls 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/hana/primary_available.sls 1970-01-01 01:00:00.000000000 +0100
@@ -1,17 +0,0 @@
-{%- from "hana/map.jinja" import hana with context -%}
-{% set host = grains['host'] %}
-
-{% for node in hana.nodes %}
-{% if node.host == host and node.secondary is defined %}
-netcat-openbsd:
- pkg.installed
-
-primary-available:
- cmd.run:
- - name: until nc -z {{ node.secondary.remote_host }} 4{{ '{:0>2}'.format(node.instance) }}02; do sleep 1; done
- - timeout: {{ node.secondary.primary_timeout|default(100) }}
- - require:
- - netcat-openbsd
-
-{% endif %}
-{% endfor %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/pillar.example new/saphanabootstrap-formula-0.2.4/pillar.example
--- old/saphanabootstrap-formula-0.1.0/pillar.example 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/pillar.example 2019-07-03 10:00:51.613343765 +0200
@@ -30,6 +30,12 @@
user_password: 'Qwerty1234'
database: 'SYSTEMDB'
file: 'backup'
+ # Optional: Add hanadb_exporter to the instance
+ exporter:
+ exposition_port: 8001 # Optional, 8001 by default
+ user: 'SYSTEM'
+ password: 'Qwerty1234'
+
- host: 'hana02'
sid: 'prd'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/saphanabootstrap-formula.changes new/saphanabootstrap-formula-0.2.4/saphanabootstrap-formula.changes
--- old/saphanabootstrap-formula-0.1.0/saphanabootstrap-formula.changes 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/saphanabootstrap-formula.changes 2019-07-03 10:00:51.613343765 +0200
@@ -1,4 +1,52 @@
-------------------------------------------------------------------
+Tue Jul 2 11:14:50 UTC 2019 - Diego Vinicius Akechi
+
+- Version bump 0.2.4
+ * Change the salt-formula directories permissions to 0750 to avoid
+ conflicts with the package salt-standalone-formulas-configuration.
+
+ * Correct the required package name to
+ salt-standalone-formulas-configuration
+
+-------------------------------------------------------------------
+Mon Jul 1 11:27:50 UTC 2019 - Xabier Arbulu Insausti
+
+- Create package version 0.2.3 supporting hanadb_exporter logging system
+
+-------------------------------------------------------------------
+Wed Jun 19 14:23:59 UTC 2019 - Xabier Arbulu Insausti
+
+- Create package version 0.2.2 adding hanadb_exporter deployment
+
+-------------------------------------------------------------------
+Tue Jun 11 11:42:31 UTC 2019 - Xabier Arbulu Insausti
+
+- Create package version 0.2.1 with fixed spec files. Now the package
+ is available in all SLE12 and SLE15 versions (boo#1137989, jsc#SLE-4143)
+
+-------------------------------------------------------------------
+Thu Jun 6 07:28:43 UTC 2019 - Xabier Arbulu Insausti
+
+- Fix how qas instance number is created in scale_up_resources template
+
+-------------------------------------------------------------------
+Fri May 21 12:37:43 UTC 2019 - Diego Vinicius Akechi
+
+- Version bump 0.2.0
+ * Include the salt-formulas-configuration dependency on
+ SLE/Leap 15-SP1 and higher. This package configures the shared salt
+ formulas location (/usr/share/salt-formulas) to be used by SUMA 4.0
+ or salt in standalone mode.
+ * Drops the saphanabootstrap-formula-suma package, as the forms metadata
+ will be available only on SUMA 4.0 using the shared location.
+
+-------------------------------------------------------------------
+Thu May 16 08:52:06 UTC 2019 - Xabier Arbulu Insausti
+
+- Update formula to work with the latest shaptools code. In this version
+ the secondary node registration is managed completely in shaptools
+
+-------------------------------------------------------------------
Thu Apr 25 12:06:43 UTC 2019 - Diego Vinicius Akechi
- Changed requires from salt-saphana to salt-shaptools.
@@ -7,26 +55,26 @@
Mon Mar 18 08:50:43 UTC 2019 - Xabier Arbulu Insausti
- Update primary available checking to execute this action before
- trying to copy the SSFS files from primary node
+ trying to copy the SSFS files from primary node
- Add configurable timeout to wait to the primary node
-------------------------------------------------------------------
Tue Mar 12 07:52:37 UTC 2019 - Xabier Arbulu Insausti
- Fix OS release comparison to use integer type in order to choose
- installable python version
+ installable python version
-------------------------------------------------------------------
Fri Mar 8 13:47:41 UTC 2019 - Xabier Arbulu Insausti
-- Improve shaptools installation python version management
+- Improve shaptools installation python version management
-------------------------------------------------------------------
Mon Mar 4 15:30:24 UTC 2019 - xarbulu@suse.com
- Improved the use of keystore access. When the key_name is informed,
the user_name/user_password is not needed.
-
+
-------------------------------------------------------------------
Wed Feb 25 10:15:35 UTC 2019 - dakechi@suse.com
@@ -37,9 +85,9 @@
-------------------------------------------------------------------
Wed Feb 20 08:18:35 UTC 2019 - xarbulu@suse.com
-- Add templates folder with RA configuration templates
+- Add templates folder with RA configuration templates
-------------------------------------------------------------------
Thu Dec 20 08:33:10 UTC 2018 - xarbulu@suse.com
-- First version of the SAP HANA deployment formula
+- First version of the SAP HANA deployment formula
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/saphanabootstrap-formula.spec new/saphanabootstrap-formula-0.2.4/saphanabootstrap-formula.spec
--- old/saphanabootstrap-formula-0.1.0/saphanabootstrap-formula.spec 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/saphanabootstrap-formula.spec 2019-07-03 10:00:51.613343765 +0200
@@ -1,7 +1,7 @@
#
# spec file for package saphanabootstrap-formula
#
-# Copyright (c) 2018 SUSE LLC, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,40 +12,39 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# See also http://en.opensuse.org/openSUSE:Specfile_guidelines
Name: saphanabootstrap-formula
-Version: 0.1.0
-Release: 1
+Version: 0.2.4
+Release: 0
Summary: SAP HANA platform deployment formula
-
License: Apache-2.0
+
Url: https://github.com/SUSE/%{name}
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
-Requires: salt-shaptools
Requires: habootstrap-formula
+Requires: salt-shaptools
+
+# On SLE/Leap 15-SP1 and TW requires the new salt-formula configuration location.
+%if ! (0%{?sle_version:1} && 0%{?sle_version} < 150100)
+Requires: salt-standalone-formulas-configuration
+%endif
%define fname hana
-%define fdir %{_datadir}/susemanager/formulas
+%define fdir %{_datadir}/salt-formulas
%define ftemplates templates
%description
-SAP HANA deployment salt formula
-
-# package to deploy on SUMA specific path.
-%package suma
-Summary: SAP HANA platform deployment formula (SUMA specific)
-Requires: salt-shaptools
-Requires: habootstrap-formula-suma
-
-%description suma
-SAP HANA deployment salt formula (SUMA specific)
+SAP HANA deployment salt formula. This formula is capable to install
+SAP HANA nodes, enable system replication and configure SLE-HA cluster
+with the SAPHanaSR resource agent, using standalone salt or via SUSE Manager
+formulas with forms, available on SUSE Manager 4.0.
%prep
%setup -q
@@ -53,12 +52,17 @@
%build
%install
-pwd
+
+# before SUMA 4.0/15-SP1, install on the standard Salt Location.
+%if 0%{?sle_version:1} && 0%{?sle_version} < 150100
+
mkdir -p %{buildroot}/srv/salt/
cp -R %{fname} %{buildroot}/srv/salt/
cp -R %{ftemplates} %{buildroot}/srv/salt/%{fname}/
-# SUMA Specific
+%else
+
+# On SUMA 4.0/15-SP1, a single shared directory will be used.
mkdir -p %{buildroot}%{fdir}/states/%{fname}
mkdir -p %{buildroot}%{fdir}/metadata/%{fname}
cp -R %{fname} %{buildroot}%{fdir}/states
@@ -69,21 +73,28 @@
cp -R metadata.yml %{buildroot}%{fdir}/metadata/%{fname}
fi
+%endif
+%if 0%{?sle_version:1} && 0%{?sle_version} < 150100
%files
%defattr(-,root,root,-)
-%license LICENSE
+%if 0%{?sle_version} < 120300
+%doc README.md LICENSE
+%else
%doc README.md
+%license LICENSE
+%endif
/srv/salt/%{fname}
/srv/salt/%{fname}/%{ftemplates}
%dir %attr(0755, root, salt) /srv/salt
-%files suma
+%else
+
+%files
%defattr(-,root,root,-)
-%license LICENSE
%doc README.md
-%dir %{_datadir}/susemanager
+%license LICENSE
%dir %{fdir}
%dir %{fdir}/states
%dir %{fdir}/metadata
@@ -91,9 +102,10 @@
%{fdir}/states/%{fname}/%{ftemplates}
%{fdir}/metadata/%{fname}
-%dir %attr(0755, root, salt) %{_datadir}/susemanager
-%dir %attr(0755, root, salt) %{fdir}
-%dir %attr(0755, root, salt) %{fdir}/states
-%dir %attr(0755, root, salt) %{fdir}/metadata
+%dir %attr(0750, root, salt) %{fdir}
+%dir %attr(0750, root, salt) %{fdir}/states
+%dir %attr(0750, root, salt) %{fdir}/metadata
+
+%endif
%changelog
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/templates/hanadb_exporter.j2 new/saphanabootstrap-formula-0.2.4/templates/hanadb_exporter.j2
--- old/saphanabootstrap-formula-0.1.0/templates/hanadb_exporter.j2 1970-01-01 01:00:00.000000000 +0100
+++ new/saphanabootstrap-formula-0.2.4/templates/hanadb_exporter.j2 2019-07-03 10:00:51.613343765 +0200
@@ -0,0 +1,25 @@
+{%- from "hana/map.jinja" import hana with context -%}
+{% set host = grains['host'] %}
+
+{% for node in hana.nodes %}
+{% if node.host == host and node.exporter is defined %}
+
+{% set dbinst = '{:0>2}'.format(node.instance) %}
+{% set node_subix = '{}_{}'.format(node.sid, dbinst) %}
+
+{
+ "exposition_port": {{ node.exporter.exposition_port|default(8001) }},
+ "hana": {
+ "host": "{{ node.host }}",
+ "port": 3{{ dbinst }}15,
+ "user": "{{ node.exporter.user }}",
+ "password": "{{ node.exporter.password }}"
+ },
+ "logging": {
+ "config_file": "/etc/hanadb_exporter/logging_config.ini",
+ "log_file": "/var/log/hanadb_exporter_{{ node_subix }}.log"
+ }
+}
+
+{% endif %}
+{% endfor %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/templates/performance_optimized.j2 new/saphanabootstrap-formula-0.2.4/templates/performance_optimized.j2
--- old/saphanabootstrap-formula-0.1.0/templates/performance_optimized.j2 2019-04-25 12:34:44.593238071 +0200
+++ new/saphanabootstrap-formula-0.2.4/templates/performance_optimized.j2 1970-01-01 01:00:00.000000000 +0100
@@ -1,70 +0,0 @@
-{% set data = pillar.cluster.configure.template.parameters %}
-{% set sid = data.sid.upper() %}
-{% set instance = '{:0>2}'.format(data.instance) %}
-
-#
-# defaults
-#
-
-rsc_defaults \
- resource-stickiness="1000" \
- migration-threshold="5000"
-
-op_defaults \
- timeout="600"
-
-#
-# production HANA
-#
-
-primitive rsc_ip_{{ sid }}_HDB{{ instance }} ocf:heartbeat:IPaddr2 \
- params \
- ip="{{ data.virtual_ip }}" cidr_netmask="{{ 32 if data.platform == "gcp" else data.virtual_ip_mask }}" {{ "nic=" ~ pillar.cluster.interface|default('eth0') }} \
- op start timeout="20" op stop timeout="20" \
- op monitor interval="10" timeout="20"
-
-primitive rsc_SAPHanaTopology_{{ sid }}_HDB{{ instance }} ocf:suse:SAPHanaTopology \
- params \
- SID="{{ sid }}" \
- InstanceNumber="{{ instance }}" \
- op monitor interval="10" timeout="600" \
- op start interval="0" timeout="600" \
- op stop interval="0" timeout="300"
-
-clone cln_SAPHanaTopology_{{ sid }}_HDB{{ instance }} rsc_SAPHanaTopology_{{ sid }}_HDB{{ instance }} \
- meta is-managed="true" clone-node-max="1" interleave="true"
-
-primitive rsc_SAPHana_{{ sid }}_HDB{{ instance }} ocf:suse:SAPHana \
- params \
- SID="{{ sid }}" \
- InstanceNumber="{{ instance }}" \
- PREFER_SITE_TAKEOVER="{{ data.prefer_takeover }}" \
- AUTOMATED_REGISTER="{{ data.auto_register }}" \
- DUPLICATE_PRIMARY_TIMEOUT="7200" \
- op start interval="0" timeout="3600" \
- op stop interval="0" timeout="3600" \
- op promote interval="0" timeout="3600" \
- op monitor interval="60" role="Master" timeout="700" \
- op monitor interval="61" role="Slave" timeout="700"
-
-ms msl_SAPHana_{{ sid }}_HDB{{ instance }} rsc_SAPHana_{{ sid }}_HDB{{ instance }} \
- meta clone-max="2" clone-node-max="1" interleave="true"
-
-{% if data.platform == "azure" %}
-
-primitive rsc_nc_{{ sid }}_HDB{{ instance }} anything \
- params binfile="/usr/bin/nc" cmdline_options="-l -k 62503" \
- meta resource-stickiness=0 \
- op monitor timeout="20" interval="10" depth="0"
-
-group g_ip_{{ sid }}_HDB{{ instance }} rsc_ip_{{ sid }}_HDB{{ instance }} rsc_nc_{{ sid }}_HDB{{ instance }}
-
-colocation col_saphana_ip_{{ sid }}_HDB{{ instance }} 2000: g_ip_{{ sid }}_HDB{{ instance }}:Started msl_SAPHana_{{ sid }}_HDB{{ instance }}:Master
-
-{% else %}
-
-colocation col_saphana_ip_{{ sid }}_HDB{{ instance }} 2000: rsc_ip_{{ sid }}_HDB{{ instance }}:Started msl_SAPHana_{{ sid }}_HDB{{ instance }}:Master
-
-{% endif %}
-
-order ord_SAPHana_{{ sid }}_HDB{{ instance }} Optional: cln_SAPHanaTopology_{{ sid }}_HDB{{ instance }} msl_SAPHana_{{ sid }}_HDB{{ instance }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/templates/scale_up_resources.j2 new/saphanabootstrap-formula-0.2.4/templates/scale_up_resources.j2
--- old/saphanabootstrap-formula-0.1.0/templates/scale_up_resources.j2 1970-01-01 01:00:00.000000000 +0100
+++ new/saphanabootstrap-formula-0.2.4/templates/scale_up_resources.j2 2019-07-03 10:00:51.613343765 +0200
@@ -0,0 +1,97 @@
+{% set data = pillar.cluster.configure.template.parameters %}
+{% set sid = data.sid.upper() %}
+{% set instance = '{:0>2}'.format(data.instance) %}
+
+#
+# defaults
+#
+
+rsc_defaults \
+ resource-stickiness="1000" \
+ migration-threshold="5000"
+
+op_defaults \
+ timeout="600"
+
+#
+# production HANA
+#
+
+primitive rsc_ip_{{ sid }}_HDB{{ instance }} ocf:heartbeat:IPaddr2 \
+ params \
+ ip="{{ data.virtual_ip }}" cidr_netmask="{{ 32 if data.platform == "gcp" else data.virtual_ip_mask }}" {{ "nic=" ~ pillar.cluster.interface|default('eth0') }} \
+ op start timeout="20" op stop timeout="20" \
+ op monitor interval="10" timeout="20"
+
+primitive rsc_SAPHanaTopology_{{ sid }}_HDB{{ instance }} ocf:suse:SAPHanaTopology \
+ params \
+ SID="{{ sid }}" \
+ InstanceNumber="{{ instance }}" \
+ op monitor interval="10" timeout="600" \
+ op start interval="0" timeout="600" \
+ op stop interval="0" timeout="300"
+
+clone cln_SAPHanaTopology_{{ sid }}_HDB{{ instance }} rsc_SAPHanaTopology_{{ sid }}_HDB{{ instance }} \
+ meta is-managed="true" clone-node-max="1" interleave="true"
+
+primitive rsc_SAPHana_{{ sid }}_HDB{{ instance }} ocf:suse:SAPHana \
+ params \
+ SID="{{ sid }}" \
+ InstanceNumber="{{ instance }}" \
+ PREFER_SITE_TAKEOVER="{{ data.prefer_takeover }}" \
+ AUTOMATED_REGISTER="{{ data.auto_register }}" \
+ DUPLICATE_PRIMARY_TIMEOUT="7200" \
+ op start interval="0" timeout="3600" \
+ op stop interval="0" timeout="3600" \
+ op promote interval="0" timeout="3600" \
+ op monitor interval="60" role="Master" timeout="700" \
+ op monitor interval="61" role="Slave" timeout="700"
+
+ms msl_SAPHana_{{ sid }}_HDB{{ instance }} rsc_SAPHana_{{ sid }}_HDB{{ instance }} \
+ meta clone-max="2" clone-node-max="1" interleave="true"
+
+{% if data.platform == "azure" %}
+
+primitive rsc_nc_{{ sid }}_HDB{{ instance }} anything \
+ params binfile="/usr/bin/nc" cmdline_options="-l -k 62503" \
+ meta resource-stickiness=0 \
+ op monitor timeout="20" interval="10" depth="0"
+
+group g_ip_{{ sid }}_HDB{{ instance }} rsc_ip_{{ sid }}_HDB{{ instance }} rsc_nc_{{ sid }}_HDB{{ instance }}
+
+colocation col_saphana_ip_{{ sid }}_HDB{{ instance }} 2000: g_ip_{{ sid }}_HDB{{ instance }}:Started msl_SAPHana_{{ sid }}_HDB{{ instance }}:Master
+
+{% else %}
+
+colocation col_saphana_ip_{{ sid }}_HDB{{ instance }} 2000: rsc_ip_{{ sid }}_HDB{{ instance }}:Started msl_SAPHana_{{ sid }}_HDB{{ instance }}:Master
+
+{% endif %}
+
+order ord_SAPHana_{{ sid }}_HDB{{ instance }} Optional: cln_SAPHanaTopology_{{ sid }}_HDB{{ instance }} msl_SAPHana_{{ sid }}_HDB{{ instance }}
+
+{% if data.cost_optimized_parameters is defined %}
+{% set qas_sid = data.cost_optimized_parameters.sid.upper() %}
+{% set qas_instance = '{:0>2}'.format(data.cost_optimized_parameters.instance) %}
+{% set qas_remote_host = data.cost_optimized_parameters.remote_host %}
+
+#
+# non-production HANA
+#
+
+primitive rsc_SAP_{{ qas_sid }}_HDB{{ qas_instance }} ocf:heartbeat:SAPDatabase \
+ params DBTYPE="HDB" SID="{{ qas_sid }}" \
+ MONITOR_SERVICES="hdbindexserver|hdbnameserver" \
+ op start interval="0" timeout="600" \
+ op monitor interval="120" timeout="700" \
+ op stop interval="0" timeout="300" \
+ meta priority="100"
+
+location loc_{{ qas_sid }}_never_on_{{ qas_remote_host }} rsc_SAP_{{ qas_sid }}_HDB{{ qas_instance }} -inf: {{ qas_remote_host }}
+
+colocation col_{{ qas_sid }}_never_with_{{ sid }}-ip -inf: rsc_SAP_{{ qas_sid }}_HDB{{ qas_instance }}:Started \
+ rsc_ip_{{ sid }}_HDB{{ instance }}
+
+order ord_{{ qas_sid }}_stop_before_{{ sid }}-promote inf: rsc_SAP_{{ qas_sid }}_HDB{{ qas_instance }}:stop \
+ msl_SAPHana_{{ sid }}_HDB{{ instance }}:promote
+
+{% endif %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/saphanabootstrap-formula-0.1.0/templates/srTakeover_hook.j2 new/saphanabootstrap-formula-0.2.4/templates/srTakeover_hook.j2
--- old/saphanabootstrap-formula-0.1.0/templates/srTakeover_hook.j2 1970-01-01 01:00:00.000000000 +0100
+++ new/saphanabootstrap-formula-0.2.4/templates/srTakeover_hook.j2 2019-07-03 10:00:51.613343765 +0200
@@ -0,0 +1,114 @@
+{%- from "hana/map.jinja" import hana with context -%}
+{% set host = grains['host'] %}
+
+{% for node in hana.nodes %}
+{% if node.host == host and node.secondary is defined and node.scenario_type.lower() == 'cost-optimized' %}
+
+{% set dbsid = node.sid.lower() %}
+{% set dbinst = '{:0>2}'.format(node.instance) %}
+
+{% for prim_node in hana.nodes %}
+{% if node.secondary.remote_host == prim_node.host and prim_node.primary is defined %}
+
+{% set dbuser = prim_node.primary.userkey.user_name %}
+{% set dbpwd = prim_node.password %}
+{% set dbversion = salt['hana.get_version'](sid=dbsid, inst=dbinst, password=dbpwd) %}
+{% if salt['pkg.version_cmp'](dbversion, '2.0') < 0 %}
+ {% set dbport = ('3'~ dbinst ~'15')|int %}
+{% else %}
+ {% set dbport = ('3'~ dbinst ~'13')|int %}
+{% endif -%}
+
+dbuser="{{ dbuser }}"
+dbpwd="{{ dbpwd }}"
+dbinst="{{ dbinst }}"
+dbport="{{ dbport }}"
+
+{% endif %}
+{% endfor %}
+{% endif %}
+{% endfor %}
+
+#!/usr/bin/env python2
+"""
+Auto-generated HA/DR hook script
+
+"""
+
+stmnt1 = "ALTER SYSTEM ALTER CONFIGURATION ('global.ini','SYSTEM') UNSET ('memorymanager','global_allocation_limit') WITH RECONFIGURE"
+stmnt2 = "ALTER SYSTEM ALTER CONFIGURATION ('global.ini','SYSTEM') UNSET ('system_replication','preload_column_tables') WITH RECONFIGURE"
+
+import os, time, dbapi
+
+from hdb_ha_dr.client import HADRBase, Helper
+
+class srTakeover(HADRBase):
+ def __init__(self, *args, **kwargs):
+ # delegate construction to base class
+ super(srTakeover, self).__init__(*args, **kwargs)
+
+ def about(self):
+ return {"provider_company" : "SUSE",
+ "provider_name" : "srTakeover", # provider name = class name
+ "provider_description" : "Replication takeover script to set parameters to default.",
+ "provider_version" : "1.0"}
+
+ def startup(self, hostname, storage_partition, system_replication_mode, **kwargs):
+ self.tracer.debug("enter startup hook; %s" % locals())
+ self.tracer.debug(self.config.toString())
+ self.tracer.info("leave startup hook")
+ return 0
+
+ def shutdown(self, hostname, storage_partition, system_replication_mode, **kwargs):
+ self.tracer.debug("enter shutdown hook; %s" % locals())
+ self.tracer.debug(self.config.toString())
+ self.tracer.info("leave shutdown hook")
+ return 0
+
+ def failover(self, hostname, storage_partition, system_replication_mode, **kwargs):
+ self.tracer.debug("enter failover hook; %s" % locals())
+ self.tracer.debug(self.config.toString())
+ self.tracer.info("leave failover hook")
+ return 0
+
+ def stonith(self, failingHost, **kwargs):
+ self.tracer.debug("enter stonith hook; %s" % locals())
+ self.tracer.debug(self.config.toString())
+ # e.g. stonith of params["failed_host"]
+ # e-g- set vIP active
+ self.tracer.info("leave stonith hook")
+ return 0
+
+ def preTakeover(self, isForce, **kwargs):
+ """Pre takeover hook."""
+ self.tracer.info("%s.preTakeover method called with isForce=%s" %
+ (self.__class__.__name__, isForce))
+ if not isForce:
+ # run pre takeover code
+ # run pre-check, return != 0 in case of error => will abort takeover
+ return 0
+ else:
+ # possible force-takeover only code
+ # usually nothing to do here
+ return 0
+
+ def postTakeover(self, rc, **kwargs):
+ """Post takeover hook."""
+ self.tracer.info("%s.postTakeover method called with rc=%s" % (self.__class__.__name__, rc))
+ if rc == 0:
+ # normal takeover succeeded
+ conn = dbapi.connect('localhost',dbport,dbuser,dbpwd)
+ cursor = conn.cursor()
+ cursor.execute(stmnt1)
+ cursor.execute(stmnt2)
+ return 0
+ elif rc == 1:
+ # waiting for force takeover
+ conn = dbapi.connect('localhost',dbport,dbuser,dbpwd)
+ cursor = conn.cursor()
+ cursor.execute(stmnt1)
+ cursor.execute(stmnt2)
+ return 0
+ elif rc == 2:
+ # error, something went wrong
+ return 0
\ No newline at end of file