fix(linstor): Database Backup when Linstor Controller is not the Pool Master. - #142
fix(linstor): Database Backup when Linstor Controller is not the Pool Master.#142Ythogtha wants to merge 10 commits into
Conversation
0e5dcb8 to
f5e5bfc
Compare
b18a3f2 to
46bc6e3
Compare
Millefeuille42
left a comment
There was a problem hiding this comment.
Only small changes / clarification. Not all comments are actually blocking though.
| def is_controller(self): | ||
| """Checks if the current host is the Linstor Controller. | ||
| This is done by checking that the Linstor database path is a mountpoint. | ||
| Which should only be the case on the Linstor Controller.""" | ||
| return os.path.ismount(DATABASE_PATH) |
There was a problem hiding this comment.
Should be merged with existing code like cls._is_mounted(DATABASE_PATH).
There was a problem hiding this comment.
So can you replace existing cls._is_mounted(DATABASE_PATH) calls with is_controller() ? Thx. :)
|
I don't understand the choice of using a log file rather than directly listing the logs, either by using:
|
Because we can't use throttling with filenames on SR operations (not check_sr), because we don't know if we have access to the files. |
9126138 to
6e1ab3d
Compare
|
Also, I converted some method into |
b090447 to
b6b7676
Compare
3dba5e3 to
09c9925
Compare
e712aa5 to
fce2d13
Compare
09c9925 to
6c0d0a3
Compare
6c0d0a3 to
b42bcd2
Compare
3ed3cbd to
b2d00c7
Compare
1825cbe to
9978d7f
Compare
14961f8 to
43e4e88
Compare
85d4bc6 to
285450d
Compare
Wescoeur
left a comment
There was a problem hiding this comment.
Ok for merge after rebase. Just one comment to add regarding the new LINSTOR_AUTO_BACKUP_DELAY constant and a remaining refactoring.
| # on the master. | ||
| NS_PREFIX_LVM: Final = "lvm-" | ||
|
|
||
| LINSTOR_AUTO_BACKUP_DELAY = 3600 |
There was a problem hiding this comment.
We should add a comment here to explain usage and unit used.
For example: "Delay expressed in seconds between two LINSTOR DB backups launched by check_sr helper.
| def is_controller(self): | ||
| """Checks if the current host is the Linstor Controller. | ||
| This is done by checking that the Linstor database path is a mountpoint. | ||
| Which should only be the case on the Linstor Controller.""" | ||
| return os.path.ismount(DATABASE_PATH) |
There was a problem hiding this comment.
So can you replace existing cls._is_mounted(DATABASE_PATH) calls with is_controller() ? Thx. :)
- Retention of 10 backups from operations, and check_sr always saves on latest. - Provides a secondary backup location, with the same retention policy. Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
… Master. * Added secondary backup location outside of Linstor's DRBD mounts. * Throttling uses a logfile for backup operations. * sr_scan operates a regular backup only if it runs on the Linstor Controller. * Retention is enforced by sr_scan on controller, with access to actual files. * Exceptions are raised only on backup errors from sr_scan ; Other operations will only report in SMlog. * Retention checks all backup.zip files for consistency : Valid zip with a non-empty linstordb.mv.db file inside, Reporting errors, and keeping only valid files. Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
check_sr works only on the Controller to have access to the backup files. It applies Validation, Retention, and Throttling for the automatic backup. All three of which requires access to the backup files, on the Controller. Removal of the logfile to manage throttling for normal operation. Hence removal of the delay parameter. Restricted caught Exceptions in backup validation to (FileNotFoundError, zipfile.BadZipFile). Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
Don't except/raise LinstorDatabaseBackupError in _check_database_backup(). Simpler glob search for backup files, as the date is properly validated by datetime. Fix bug in database_backup_age(). Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
database_backup_path instead of database_backup_file because it is a str|Path. Throttling delay converted to Constant. Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
…le None self._linstor Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
43e4e88 to
d341622
Compare
Also some explanations on new LINSTOR_AUTO_BACKUP_DELAY in constants.py Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
Linstor Controller(needs access to files).check_sroperates a regular backup only if it runs on theLinstor Controller, to allow throttling.check_sronController, with access to actual files.backup.zipfiles for consistency :Valid zip with a non-empty
linstordb.mv.dbfile inside,Reporting errors, and keeping only valid files.