Skip to content

Commit

Permalink
Merge pull request #1668 from schakrava/1667_replication_regression
Browse files Browse the repository at this point in the history
Fix regression in replication due to django 1.8 update. Fixes #1667
  • Loading branch information
schakrava committed Mar 7, 2017
2 parents 47c0538 + 1655e9e commit f3bcb52
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
24 changes: 12 additions & 12 deletions conf/settings.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -248,21 +248,21 @@ LOGGING = {
'level': 'DEBUG',
'propagate': True,
},
'system': {
'handlers': ['file'],
'level': 'DEBUG',
'system': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
'scripts': {
'handlers': ['file'],
'level': 'DEBUG',
},
'scripts': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
'fs': {
'handlers': ['file'],
'level': 'DEBUG',
},
'fs': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/rockstor/smart_manager/replication/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django # noqa E402
django.setup()
3 changes: 1 addition & 2 deletions src/rockstor/smart_manager/replication/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def __init__(self, identity, meta):
self.ack = False
self.total_bytes_received = 0
# close all db connections prior to fork.
for alias, info in db.connections.databases.items():
db.close_connection()
db.close_old_connections()
super(Receiver, self).__init__()

def _sys_exit(self, code):
Expand Down
3 changes: 1 addition & 2 deletions src/rockstor/smart_manager/replication/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def __init__(self, uuid, receiver_ip, replica, rt=None):
self.total_bytes_sent = 0
self.ppid = os.getpid()
self.max_snap_retain = settings.REPLICATION.get('max_snap_retain')
for alias, info in db.connections.databases.items():
db.close_connection()
db.close_old_connections()
super(Sender, self).__init__()

@contextmanager
Expand Down

0 comments on commit f3bcb52

Please sign in to comment.