Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CPDEV-101420] Fix failure of second backup after restore #685

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

n549
Copy link
Collaborator

@n549 n549 commented Aug 27, 2024

Description

When doing the following sequence of action:

  • backup
  • restore
  • backup
    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:

  • backup
  • restore
  • backup
    ER: All the procedures finish successfully.

TestCase 2

Deploy a cluster at Ubuntu nodes and run maintenance procedures:

  • backup
  • restore
  • backup
    ER: All the procedures finish successfully.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Integration CI passed
  • Unit tests. If Yes list of new/changed tests with brief description
  • There is no merge conflicts

Unit tests

Indicate new or changed unit tests and what they do, if any.

@n549 n549 added the bug Something isn't working label Aug 27, 2024
@n549 n549 requested review from Imadzuma and vlar0816 August 27, 2024 07:08
@koryaga koryaga merged commit 9427769 into main Sep 2, 2024
45 checks passed
@koryaga koryaga deleted the fix/second_backup_failure branch September 2, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants