Eli Mesika has uploaded a new change for review.

Change subject: core:force bool fence agents options value
......................................................................

core:force bool fence agents options value

This patch fixes a error caused by fence-agents package that broke
backward compatibility.

fence-agents used to accept boolean agent flags as secure or lanplus
either as 'lanplus' or 'lanplus=1' or 'lanplus=true'
Now, we can not pass such options without a true/1 value
This patch fixes the issue by changing such flags in 2 places

1) The default options set by agent implicitly
2) The existing options stored in the fence_agents table

This patch does not address encrypted options and such should be
redefined
This will be clearly communicated via the BZ release notes.

Change-Id: I45f7a245dc01186f85619efd062c6f326c40d095
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1225082
Signed-off-by: emesika <emes...@redhat.com>
---
A packaging/dbscripts/upgrade/03_05_1270_fix_bool_fence_agents_options.sql
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
2 files changed, 36 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/82/41482/1

diff --git 
a/packaging/dbscripts/upgrade/03_05_1270_fix_bool_fence_agents_options.sql 
b/packaging/dbscripts/upgrade/03_05_1270_fix_bool_fence_agents_options.sql
new file mode 100644
index 0000000..8c945ef
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_1270_fix_bool_fence_agents_options.sql
@@ -0,0 +1,35 @@
+--- The fence agents package broke backward compatibility by not supporting 
boolean flags to be provided without
+--- a value. i.e. from now on for example 'lanplus' is not legal while 
'lanplus=1' or 'lanplus=true' is OK
+--- This upgrade script will change all known flags used by existing agents to 
have an explicit value.
+
+Create or replace FUNCTION __temp_fix_bool_fence_agents_options()
+RETURNS VOID
+   AS $procedure$
+   DECLARE
+   v_agents varchar[] := array['inet4-only', 'inet6-only', 'lanplus', 
'missing-as-off', 'notls', 'snmp-priv-passwd-script',
+                               'ssh', 'ssl-insecure', 'ssl-secure', 'ssl', 
'use-sudo', 'verbose', 'version'];
+   v_temp_option_name varchar(50);
+   v_option_true_val varchar(50);
+   v_option_one_val varchar(50);
+
+BEGIN
+    for i in 1 .. array_upper(v_agents, 1)
+    loop
+        v_temp_option_name := 'temp__' || upper(v_agents[i]) || '__expr';
+        v_option_true_val := v_agents[i] || '=' || 'true';
+        v_option_one_val := v_agents[i] || '=' || '1';
+        update vds_static set pm_options =  replace(pm_options, 
v_option_one_val, v_temp_option_name) ;
+        update vds_static set pm_options =  replace(pm_options, 
v_option_true_val, v_temp_option_name) ;
+        update vds_static set pm_options =  replace(pm_options, v_agents[i], 
v_option_one_val) ;
+        update vds_static set pm_options =  replace(pm_options, 
v_temp_option_name, v_option_one_val) ;
+    end loop;
+    --fix options
+    -- in case we have options that one is substring of the other we will get 
'=1-' expressions that
+    -- should be replaced with '-' (for example 'ssl-insecure', 'ssl-secure', 
'ssl')
+    update vds_static set pm_options =  replace(pm_options,'=1-','-') ;
+END; $procedure$
+LANGUAGE plpgsql;
+
+SELECT __temp_fix_bool_fence_agents_options();
+DROP function __temp_fix_bool_fence_agents_options();
+
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 2bb6e50..1ccbd20 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -859,7 +859,7 @@
 select 
fn_db_update_config_value('BootstrapMinimalVdsmVersion','4.9','general');
 select fn_db_update_config_value('DBEngine','Postgres','general');
 select fn_db_update_config_value('DefaultTimeZone','(GMT) GMT Standard 
Time','general');
-select 
fn_db_update_config_value('FenceAgentDefaultParams','drac7:privlvl=OPERATOR,lanplus,delay=10;ilo3:lanplus,power_wait=4;ilo4:lanplus,power_wait=4','general');
+select 
fn_db_update_config_value('FenceAgentDefaultParams','drac7:privlvl=OPERATOR,lanplus=1,delay=10;ilo3:lanplus=1,power_wait=4;ilo4:lanplus=1,power_wait=4','general');
 select 
fn_db_update_config_value('FenceAgentDefaultParamsForPPC','ilo3:lanplus=1,cipher=1,privlvl=administrator,power_wait=4,retry_on=2;ilo4:ilanplus=1,cipher=1,privlvl=administrator,power_wait=4,retry_on=2;ipmilan:lanplus=1,cipher=1,privlvl=administrator,power_wait=4,retry_on=2','general');
 select 
fn_db_update_config_value('FenceAgentMapping','drac7=ipmilan,ilo2=ilo,ilo3=ipmilan,ilo4=ipmilan','general');
 select 
fn_db_update_config_value('FenceStartStatusDelayBetweenRetriesInSec','10','general');


-- 
To view, visit https://gerrit.ovirt.org/41482
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I45f7a245dc01186f85619efd062c6f326c40d095
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to