[CPDEV-101420] Fix failure of second backup after restore #685
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When doing the following sequence of action:
the last backup fails at RHEL hosts.
RC
Out of the box RHEL has fs.protected_regular kernel variable set to 1 which means prohibiting O_CREAT open on regular files that we don’t own in world writable sticky directories (which the /tmp folder is), unless they are owned by the owner of the directory.
After the restore procedure the /tmp/kubemarine-backup.tar.gz file is left in /tmp folder, so the second backup procedure tries to update an existing file and fails.
Actually, Ubuntu 20.04 and 22.04 have fs.protected_regular=2 which means the same as 1, but also applies to group writable sticky directories, so the issue must be reproduced there too. Centos 7 doesn't have this variable and doesn't have such an issue.
Solution
Restore
procedure leaves/tmp/kubemarine-backup.tar.gz
file after itself. This file also can be left after previously failed backup procedures, etc.So it's better to delete this file anyway before creating new one in the
backup
procedure.How to apply
Test Cases
TestCase 1
Deploy a cluster at RHEL nodes and run maintenance procedures:
ER: All the procedures finish successfully.
TestCase 2
Deploy a cluster at Ubuntu nodes and run maintenance procedures:
ER: All the procedures finish successfully.
Checklist
Unit tests
Indicate new or changed unit tests and what they do, if any.