Bug 1764003 - [Upgrade] Config files are not upgraded to new version
Summary: [Upgrade] Config files are not upgraded to new version
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: geo-replication
Version: 7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kotresh HR
QA Contact:
URL:
Whiteboard:
Depends On: 1707731 1764171
Blocks: 1708064
TreeView+ depends on / blocked
 
Reported: 2019-10-22 07:06 UTC by Kotresh HR
Modified: 2019-11-11 08:55 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1707731
Environment:
Last Closed: 2019-11-11 08:55:33 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gluster.org Gerrit 23577 0 None Open geo-rep: Upgrading config file to new version 2019-11-11 08:53:35 UTC
Gluster.org Gerrit 23579 0 None Merged geo-rep: Test case for upgrading config file 2019-11-11 08:55:32 UTC

Description Kotresh HR 2019-10-22 07:06:28 UTC
+++ This bug was initially created as a clone of Bug #1707731 +++

Description of problem:

Configuration handling was enhanced with patch https://review.gluster.org/#/c/glusterfs/+/18257/, Old configurations are not applied if Geo-rep session is created in the old version and upgraded.

Actual results:

All configurations reset when upgraded.


Expected results:

Configuration should be upgraded to the new format when Geo-replication is run for the first time after the upgrade.

--- Additional comment from Aravinda VK on 2019-05-17 06:53:49 UTC ---

## Reading Old format:

Config file consists of a section named "__section_order__", read that to get the order of different section. Sort the section based on order(based on values), and prepare a dict with values updated from each section.

For example:

```
[__section_order__]
sec1=0
sec2=2
sec3=1

[sec1]
log_level = INFO

[sec2]
log_level = DEBUG

[sec3]
log_level = ERROR
```

configs = {}
for sec in sorded_sections():
    for item_key, item_value in sec.items:
        configs[item_key] = item_value

With this logic, `log_level` will have final value "DEBUG"


## Upgrade:

During Geo-rep start(In gsyncd.py):

- Read the session config and see it is a new format or old
- If it is old format, read the config as explained above
- Compare the configs collected and write to new config only if it is different from Default configs
- Reload the new config

To get the old format config,

- Install old version of Glusterfs(<4) and create a geo-rep session.
- Set some configurations in Geo-rep
- Copy the config file for reference
- Old parsing code can be referred here https://github.com/gluster/glusterfs/blob/release-3.13/geo-replication/syncdaemon/configinterface.py

Comment 1 Worker Ant 2019-10-22 07:51:30 UTC
REVIEW: https://review.gluster.org/23577 (geo-rep: Upgrading config file to new version) posted (#1) for review on release-7 by Kotresh HR

Comment 2 Worker Ant 2019-10-22 07:53:49 UTC
REVIEW: https://review.gluster.org/23579 (geo-rep: Test case for upgrading config file) posted (#1) for review on release-7 by Kotresh HR

Comment 3 Worker Ant 2019-11-11 08:53:36 UTC
REVIEW: https://review.gluster.org/23577 (geo-rep: Upgrading config file to new version) merged (#2) on release-7 by Kotresh HR

Comment 4 Worker Ant 2019-11-11 08:55:33 UTC
REVIEW: https://review.gluster.org/23579 (geo-rep: Test case for upgrading config file) merged (#2) on release-7 by Kotresh HR


Note You need to log in before you can comment on or make changes to this bug.