Bug 1119214

Summary: PreDefinedNetworkCustomProperties differs between different versions of psql
Product: [Retired] oVirt Reporter: GenadiC <gcheresh>
Component: ovirt-engine-coreAssignee: Lior Vernia <lvernia>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Burman <mburman>
Severity: high Docs Contact:
Priority: high    
Version: 3.5CC: alonbl, bazulay, ecohen, gcheresh, gklein, iheim, lvernia, mburman, mgoldboi, rbalakri, yeylon
Target Milestone: ---Keywords: AutomationBlocker, Triaged
Target Release: 3.5.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: network
Fixed In Version: ovirt-3.5.0_rc1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-17 12:19:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
ovirt-engine-setup log none

Description GenadiC 2014-07-14 09:42:45 UTC
Created attachment 917714 [details]
ovirt-engine-setup log

Description of problem:
Regular expression for the bridge_opts in db looks as follows: bridge_opts=^[^s=]+=[^s=]+(s+[^s=]+=[^s=]+)*$, but should be
bridge_opts=^[^\s=]+=[^\s=]+(\s+[^\s=]+=[^\s=]+)*$', '3.5')

Because of the missing '\' it expects s character instead of space.

Version-Release number of selected component (if applicable):


Steps to Reproduce:
1. Try to create bridge_opts for specific VM network on NIC with several parameters and space between them
2.
3.

Actual results:
Action succeeds only if you replace ' ' character with 's' character

Expected results:
Action should succeed with ' ' character

Additional info:
In ovirt-engine-setup log the regex appears with'\' characters

Comment 1 Lior Vernia 2014-07-14 11:51:02 UTC
Alon, this is an interesting bug, as when performing a clean dev install on my machine I do not encounter this - the backslashes are preserved all the way to the DB.

Could you think what the difference could be between the QE's deployment and my dev deployment, which strips away backslashes before they're stored in the DB entry?

Comment 2 Alon Bar-Lev 2014-07-14 11:59:29 UTC
Hi,

Need more input...

What stored? where? when?

Sources?

Thanks!

Comment 3 Lior Vernia 2014-07-14 12:18:28 UTC
The entry Genadi mentioned above in the vdc_options table: 'bridge_opts=^[^\s=]+=[^\s=]+(\s+[^\s=]+=[^\s=]+)*$', key 'PreDefinedNetworkCustomProperties', version '3.5'.

This entry is added from the 0000_config.sql DB pre-upgrade script.

When I checkout the ovirt-engine-3.5 branch, compile and run engine-setup as a non-root user, the DB contains the correct string in that entry and everything works fine.

On Genadi's deployment, which I suspect is installed like a normal user would install oVirt (yum install, then run engine-setup as root), the value appears in the DB with backslashes stripped, which of course causes some malfunctions.

Does this make sense?

Comment 4 Alon Bar-Lev 2014-07-14 12:44:58 UTC
hmmm.... this is strange! we run the dbscripts in production and devenv exactly the same. I have fedora and I see this ok, maybe it is rhel thing (older psql).

is this fresh system or upgrade? can you clean system and reinstall so we make sure it is reproducible?

Comment 5 GenadiC 2014-07-14 14:08:28 UTC
This is fresh system and was reproduced on 2 other fresh installations

Comment 6 Alon Bar-Lev 2014-07-15 06:44:55 UTC
yes, probably change between postgresql-8.4 and postgresql-9.2, hope that it is not rhel specific.

8.4
---
engine=> insert into vdc_options values (9999, 'alon', '\s', 'general');
INSERT 0 1
engine=> select * from vdc_options where option_name = 'alon';
 option_id | option_name | option_value | version 
-----------+-------------+--------------+---------
      9999 | alon        | s            | general
(1 row)

engine=> insert into vdc_options values (9999, 'alon', '\\s', 'general');
INSERT 0 1
engine=> select * from vdc_options where option_name = 'alon';
 option_id | option_name | option_value | version 
-----------+-------------+--------------+---------
      9999 | alon        | \s           | general
(1 row)
---

9.2
---
engine=> insert into vdc_options values (9999, 'alon', '\s', 'general');
INSERT 0 1
engine=> select * from vdc_options where option_name = 'alon';
 option_id | option_name | option_value | version 
-----------+-------------+--------------+---------
      9999 | alon        | \s           | general
(1 row)

engine=> insert into vdc_options values (9999, 'alon', '\\s', 'general');
INSERT 0 1
engine=> select * from vdc_options where option_name = 'alon';
 option_id | option_name | option_value | version 
-----------+-------------+--------------+---------
      9999 | alon        | \\s          | general
(1 row)
---

need to figure out how to bridge this gap.

Comment 7 Alon Bar-Lev 2014-07-15 06:58:20 UTC
solution:

engine=> insert into vdc_options values (9999, 'alon', $q$\s$q$, 'general');
INSERT 0 1
engine=> select * from vdc_options where option_name = 'alon';
 option_id | option_name | option_value | version 
-----------+-------------+--------------+---------
      9999 | alon        | \s           | general
(1 row)

please embed.

Comment 8 Lior Vernia 2014-07-16 11:45:13 UTC
Thanks Alon for the quick response and solution, will do!

Comment 9 Michael Burman 2014-08-07 13:54:19 UTC
Verified on-  oVirt Engine Version: 3.5.0-0.0.master.20140804172041.git23b558e.el6

Comment 10 Sandro Bonazzola 2014-10-17 12:19:41 UTC
oVirt 3.5 has been released and should include the fix for this issue.