-
Notifications
You must be signed in to change notification settings - Fork 933
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: Add support for storage bucket backup (from Incus) #13924
base: main
Are you sure you want to change the base?
Conversation
08a58ba
to
8fdf38f
Compare
Heads up @mionaalex - the "Documentation" label was applied to this issue. |
19cae2b
to
8b2a40c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
8b2a40c
to
94eb9bf
Compare
eb04463
to
ccbbddd
Compare
d70a96f
to
b1894d6
Compare
a3ece3c
to
8a38733
Compare
please can you rebase |
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 21ed02ae159abd398ea623406101f877d4092b59) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 95bfa8881566ab6a66135a4709065d97feeaaa6b) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit b2dbe44d3447c554d9d7e5d4ee855238a7b27c6e) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 8f0061f699db14ba101378ca4314c3ee33afd93c) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit f4b0e4dad87ebc1bd0cc94d9b6b0cdaa0a848020) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit db96183b5d2f728bcf92f65b54e9265a8ff7a5f5) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 5f6dbb7bea79b315797533d792ff81c3a0bc8fbb) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
ValidateBackupName ensures that a backup name does not contain '..', forward slashes, or back slashes. Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit d5b4350adc2f318ed9fdfd1078eaf8e7f00e8f88) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 679ce9355b1f16cbf2a825eb3f0b901b80f35298) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 2e6756328f2e72b1d2b1704a2b2b4373230e2cee) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 98693c062efc05ec500022e7032e63ca96c291ba) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
As is suggested by GitHub Advanced Security, we are making the validation of backup names a bit more strict (now checking for '\\' and '..'). We want to add these checks for all backups to ensure consistency across LXD. Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
Signed-off-by: Fabian Mettler <dev@maveonair.com> (cherry picked from commit 50f73d42057032403b29e5986763d265cfcb5256) Signed-off-by: Mark Bolton <mark.bolton@canonical.com> License: Apache-2.0
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
8a38733
to
97ff9ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind landing this change and the associated cherry-pick for the function in a separate PR to isolate the new functionality only in this PR. Thanks
func (c *ClusterTx) CreateStoragePoolBucketBackup(ctx context.Context, args StoragePoolBucketBackup) error { | ||
_, err := c.getStoragePoolBucketBackupID(ctx, args.Name) | ||
if err == nil { | ||
return ErrAlreadyDefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use api.StatusErrorf() here like we do in CreateStoragePoolBucketKey
then we wont need the new ErrAlreadyDefined var.
api.StatusErrorf(http.StatusConflict, "A bucket key using that access key already exists on this server")
Then we can check it in the call site using:
api.StatusErrorCheck(err, http.StatusConflict)
|
||
// DownloadAllFiles downloads all files from a bucket and writes them to a tar writer. | ||
func (t TransferManager) DownloadAllFiles(bucketName string, tarWriter *instancewriter.InstanceTarWriter) error { | ||
logger.Debugf("Downloading all files from bucket %s", bucketName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont use logger.*f
functions, but we can probably just remove these right?
please can you rebase |
This PR adds support for storage bucket backups. It includes cherry-picks from lxc/incus#365, and the below description comes in part from the associated incus PR.
Description
API
The following endpoints are added, along with the
storage_bucket_backup
extension:Export
CLI
Archive
The export command creates a tarball from the defined bucket, which is structured as follows:
bucket
directory contains the actual databackup.yml
contains the bucket metadata and keys:Import
CLI
Design decisions of note
TransferManager
struct is implemented, which utilizes MinIO to handle downloading files from a bucket to create the backup, and uploading files to a bucket when creating a bucket from a backup.Overall, what's been changed