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

Migrated ephemeral_disk data does not retain ownership for directories #3702

Closed
pam9999 opened this issue Dec 29, 2017 · 3 comments
Closed

Comments

@pam9999
Copy link

pam9999 commented Dec 29, 2017

If filing a bug please include the following:

Nomad version

0.7.0

Operating system and Environment details

RHEL 7.4 with umask 0027

Issue

We use a MariaDB docker container and MariaDB create one directory for each database.
When the allocation directory is migrated from one nomad client to another, ownership on these directories are not retained. Directories are created as root and the Docker process (running with mysql user) cannot access anymore to the databases directories.

Reproduction steps

Create a job spec with a mariadb task in a docker container (i.e. Redhat rhscl/mariadb-101-rhel7 image).
Run the job and create a database (directories are created with mysql ownership)
Drain the node
Directories are created with root ownership and docker process cannot access these directories anymore because of the restrictive umask.

We patched alloc_watcher.go

        // If the header is for a directory we create the directory
        if hdr.Typeflag == tar.TypeDir {
            os.MkdirAll(filepath.Join(dest, hdr.Name), os.FileMode(hdr.Mode))
            f, err := os.Open(filepath.Join(dest, hdr.Name))
            if err != nil {
                return fmt.Errorf("error open directory: %v", err)
            }
            if err := f.Chown(hdr.Uid, hdr.Gid); err != nil {
                f.Close()
                return fmt.Errorf("error chowning directory %v", err)
            }
            continue
        }
@chelseakomlo
Copy link
Contributor

Thanks for submitting this issue- we'll reproduce it and test this patch as well.

schmichael added a commit that referenced this issue Jan 5, 2018
Fixes #3702

Added missing chown call and made it conditional on running as root and
not on Windows as we do with files.
@schmichael
Copy link
Member

Fixed in #3723 which has some binaries with the fix attached if you want to test. Thanks again @pam9999!

schmichael added a commit that referenced this issue Jan 8, 2018
Fixes #3702

Added missing chown call and made it conditional on running as root and
not on Windows as we do with files.
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants