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

Storage: Per project image and backup storage options #14582

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

boltmark
Copy link
Contributor

@boltmark boltmark commented Dec 4, 2024

This PR adds support for per-project image and backup storage options. We maintain the option to select storage options at the server level, and add a more fine-grained option to select this at the project level.


TODO: Add overview of implementation

@github-actions github-actions bot added Documentation Documentation needs updating API Changes to the REST API labels Dec 4, 2024
// Create images and backups directories, and symlink to the daemon path by default.
imageDaemonPath := shared.VarPath("images", "daemon", fmt.Sprintf("project_%s", project.Name))
imageSymPath := shared.VarPath("images", fmt.Sprintf("project_%s", project.Name))
err = os.MkdirAll(imageDaemonPath, 0700)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
if err != nil {
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", imageDaemonPath, err))
}
err = os.Symlink(imageDaemonPath, imageSymPath)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
if err != nil {
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", imageDaemonPath, err))
}
err = os.Symlink(imageDaemonPath, imageSymPath)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
backupsSymPath := shared.VarPath("backups", fmt.Sprintf("project_%s", project.Name))
backupsCustomPath := filepath.Join(backupsSymPath, "custom")
backupsInstancesPath := filepath.Join(backupsSymPath, "instances")
err = os.MkdirAll(backupsDaemonPath, 0700)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
if err != nil {
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", backupsDaemonPath, err))
}
err = os.Symlink(backupsDaemonPath, backupsSymPath)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
if err != nil {
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", backupsCustomPath, err))
}
err = os.MkdirAll(backupsInstancesPath, 0700)

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
if err != nil {
return fmt.Errorf("Failed to create the new symlink at %q: %w", shared.VarPath(storageType), err)
// Create the new symlink.
err = os.Symlink(destPath, shared.VarPath(storageType, "daemon"))

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
}

// Create the new symlink.
err = os.Symlink(destPath, shared.VarPath(storageType, fmt.Sprintf("project_%s", projectName)))

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
if err != nil {
return fmt.Errorf("Failed to create the new symlink at %q: %w", shared.VarPath(storageType), err)
// Create the new symlink.
err = os.Symlink(destPath, shared.VarPath(storageType, "daemon"))

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
}

// Create the new symlink.
err = os.Symlink(destPath, shared.VarPath(storageType, fmt.Sprintf("project_%s", projectName)))

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes to the REST API Documentation Documentation needs updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant