!14 [sync] PR-13: geo-rep fix the name of changelog archive file

From: @openeuler-sync-bot
Reviewed-by: @liuzhiqiang26
Signed-off-by: @liuzhiqiang26
This commit is contained in:
openeuler-ci-bot 2021-06-09 17:13:40 +08:00 committed by Gitee
commit 2dfbcda8a8
2 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,91 @@
From db71e7ddd15dceec33a930ad14b30b043d723692 Mon Sep 17 00:00:00 2001
From: Kotresh HR <khiremat@redhat.com>
Date: Fri, 16 Aug 2019 16:07:03 +0530
Subject: [PATCH] geo-rep: Fix the name of changelog archive file
Background:
The processed changelogs are archived each month in a single tar file.
The default format is "archive_YYYYMM.tar" which is specified as "%%Y%%m"
in configuration file.
Problem:
The created changelog archive file didn't have corresponding year
and month. It created as "archive_%Y%m.tar" on python2 only systems.
Cause and Fix:
Geo-rep expects "%Y%m" after the ConfigParser reads it from config file.
Since it was "%%Y%%m" in config file, geo-rep used to get correct value
"%Y%m" in python3 and "%%Y%%m" in python2 which is incorrect.
The fix can be to use "%Y%m" in config file but that fails in python3.
So the fix is to use "RawConfigParser" in geo-rep and use "%Y%m". This
works both in python2 and python3.
Conflict:delete config_upgrade:cnf=RawConfigParser is_config_file_old:cnf=RawConfigParser
Change-Id: Ie5b7d2bc04d0d53cd1769e064c2d67aaf95d557c
fixes: bz#1741890
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Signed-off-by: yanglongkang <yanglongkang@huawei.com>
---
geo-replication/gsyncd.conf.in | 2 +-
geo-replication/syncdaemon/gsyncdconfig.py | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/geo-replication/gsyncd.conf.in b/geo-replication/gsyncd.conf.in
index e674344..9155cd8 100644
--- a/geo-replication/gsyncd.conf.in
+++ b/geo-replication/gsyncd.conf.in
@@ -114,7 +114,7 @@ type=int
help=Minimum time interval in seconds for passive worker to become Active
[changelog-archive-format]
-value=%%Y%%m
+value=%Y%m
help=Processed changelogs will be archived in working directory. Pattern for archive file
[use-meta-volume]
diff --git a/geo-replication/syncdaemon/gsyncdconfig.py b/geo-replication/syncdaemon/gsyncdconfig.py
index 26fb6a5..ae0f427 100644
--- a/geo-replication/syncdaemon/gsyncdconfig.py
+++ b/geo-replication/syncdaemon/gsyncdconfig.py
@@ -10,9 +10,9 @@
#
try:
- from ConfigParser import ConfigParser, NoSectionError
+ from ConfigParser import RawConfigParser, NoSectionError
except ImportError:
- from configparser import ConfigParser, NoSectionError
+ from configparser import RawConfigParser, NoSectionError
import os
from string import Template
from datetime import datetime
@@ -91,7 +91,7 @@ class Gconf(object):
if name != "all" and not self._is_configurable(name):
raise GconfNotConfigurable()
- cnf = ConfigParser()
+ cnf = RawConfigParser()
with open(self.custom_conf_file) as f:
cnf.readfp(f)
@@ -135,7 +135,7 @@ class Gconf(object):
if curr_val == value:
return True
- cnf = ConfigParser()
+ cnf = RawConfigParser()
with open(self.custom_conf_file) as f:
cnf.readfp(f)
@@ -170,7 +170,7 @@ class Gconf(object):
self.session_conf_items = []
self.default_values = {}
- conf = ConfigParser()
+ conf = RawConfigParser()
# Default Template config file
with open(self.default_conf_file) as f:
conf.readfp(f)
--
2.23.0

View File

@ -3,7 +3,7 @@
Name: glusterfs
Version: 7.0
Release: 6
Release: 7
License: GPLv2 and LGPLv3+
Summary: Aggregating distributed file system
URL: http://docs.gluster.org/
@ -11,6 +11,7 @@ Source0: https://download.gluster.org/pub/gluster/glusterfs/7/7.0/glust
Source7: glusterfsd.service
Patch0: 0000-core-fix-memory-pool-management-races.patch
Patch1: 0001-geo-rep-Fix-the-name-of-changelog-archive-file.patch
BuildRequires: systemd bison flex gcc make libtool ncurses-devel readline-devel libattr-devel
BuildRequires: libxml2-devel openssl-devel libaio-devel libacl-devel python3-devel git perl
@ -459,6 +460,9 @@ exit 0
%{_mandir}/man8/*gluster*.8*
%changelog
* Tue Jun 8 2021 yanglongkang <yanglongkang@huawei.com> - 7.0-7
- geo-rep fix the name of changelog archive file
* Tue Feb 9 2021 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 7.0-6
- set release num to 6 for CI