-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(backup): incremental NAS backup support for KVM #13074
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
Open
jmsperu
wants to merge
44
commits into
apache:main
Choose a base branch
from
jmsperu:feature/nas-backup-incremental
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,021
−45
Open
Changes from 17 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
f2a9202
docs: add RFC for incremental NAS backup support (KVM)
jmsperu 1981469
feat(backup): add chain-metadata keys + nas.backup.full.every config
jmsperu fbb916b
feat(backup): nasbackup.sh full+incremental modes via backup-begin
jmsperu 1f2aebc
feat(backup): orchestrate full vs incremental in NAS provider
jmsperu 43e2f75
feat(backup): on-demand bitmap recreation for incremental NAS backup
jmsperu 39303fb
feat(backup): restore path follows incremental backing-chain
jmsperu b8d069e
feat(backup): cascade-delete + chain repair for NAS incrementals
jmsperu 49edc7f
test(backup): smoke tests for incremental NAS backup chain
jmsperu d80ed16
test(backup): mock returns no-backing-chain for rsync-failure test
jmsperu 9764025
docs: move RFC out of repo per reviewer feedback
jmsperu 72f967a
test(backup): mock BackupDetailsDao to fix NPE in NASBackupProviderTest
jmsperu 7e1691b
feat(backup): anchor incremental chain on VM active_checkpoint_id
jmsperu b7b74c4
refactor(backup): mirror snapshot-style delete chain for NAS incremen…
jmsperu 9f4d61f
test(backup): drop unnecessary host.getId() stub in live-child delete…
jmsperu 691931d
feat(backup): add nas.backup.incremental.enabled master switch
jmsperu 0bdcdb1
feat(backup): pre-seed bitmap on stopped-VM backup for next incremental
jmsperu 5be1910
refactor(backup): per-volume parent paths for incremental NAS backup
jmsperu 3e2e144
fix(nas-backup): address Copilot review on PR #13074
jmsperu 4f3375a
fix(nas-backup): don't persist unconfirmed bitmap; gate sanity_checks
jmsperu bedcc2a
test(nas-backup): enable incremental in active-checkpoint test
jmsperu f2210f4
refactor(nas-backup): address abh1sar review on PR #13074
jmsperu 3456ba7
backup(nas): address review cleanups — remove dead code + reviewer-me…
jmsperu ba74778
backup(nas): wrapper uses the passed bitmap name instead of re-parsin…
jmsperu 8adde4d
backup(nas): fix parent-checkpoint recreation for incremental after V…
jmsperu 3ed8a30
backup(nas): regression test — incremental backup survives a VM restart
jmsperu 096bef1
backup(nas): collapse N+1 chain queries when sweeping delete-pending …
jmsperu 73c4206
backup(nas): move backup-mode policy + stdout markers from script to …
jmsperu 4207ea9
test(backup): set CHAIN_POSITION on sweep-up-pending-parent test fixt…
jmsperu f574628
test(backup): drop unnecessary PARENT_BACKUP_ID stub in sweep-pending…
jmsperu 5f91f86
backup(nas): clear VM active checkpoint on single-volume restore (#13…
jmsperu 8afd170
backup(nas): legacy-full mode — persist nothing when incremental disa…
jmsperu c331e8f
backup(nas): remove dead rebase op + restore unconditional sanity_che…
jmsperu 901eb40
backup(nas): redefine parent checkpoint with minimal XML, drop persis…
jmsperu 3972b06
backup(nas): self-heal incremental->full in-script, drop EXIT_* signa…
jmsperu 5262f17
backup(nas): fall back to full when the parent bitmap is missing from…
jmsperu a51f335
backup: account chain-delete resources exactly-once at physical remov…
jmsperu 3f3f242
Merge branch 'main' into feature/nas-backup-incremental
abh1sar 7c2574b
fix(backup): NAS incremental — getPath, all-disk bitmap, Hidden tombs…
jmsperu cda0417
backup: rename BackupVO.backupType to 'type' so UpdateBuilder tracks …
jmsperu ae2a6b2
fix(backup): NAS incremental — count parent bitmap per-disk, don't ab…
jmsperu 7263411
Merge branch 'main' into feature/nas-backup-incremental
abh1sar 4552c44
feat(backup): NAS incremental — reclaim parent bitmap + guard non-che…
jmsperu 560c6d3
address review: drop Linstor-incremental branch + PARENT_BITMAP_DELET…
jmsperu 4707ccd
Merge remote-tracking branch 'origin/main' into feature/nas-backup-in…
jmsperu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
core/src/main/java/org/apache/cloudstack/backup/RebaseBackupCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| // | ||
|
|
||
| package org.apache.cloudstack.backup; | ||
|
|
||
| import com.cloud.agent.api.Command; | ||
| import com.cloud.agent.api.LogLevel; | ||
|
|
||
| /** | ||
| * Tells the KVM agent to rebase a NAS backup qcow2 onto a new backing parent. Used by the | ||
| * NAS backup provider during chain repair when a middle incremental is being deleted: the | ||
| * immediate child must absorb the soon-to-be-deleted parent's blocks and then re-link to | ||
| * the grandparent. Both target and new-backing paths are NAS-mount-relative. | ||
| */ | ||
| public class RebaseBackupCommand extends Command { | ||
| private String targetPath; // mount-relative path of the qcow2 to repoint | ||
| private String newBackingPath; // mount-relative path of the new backing parent | ||
| private String backupRepoType; | ||
| private String backupRepoAddress; | ||
| @LogLevel(LogLevel.Log4jLevel.Off) | ||
| private String mountOptions; | ||
|
|
||
| public RebaseBackupCommand(String targetPath, String newBackingPath, | ||
| String backupRepoType, String backupRepoAddress, String mountOptions) { | ||
| super(); | ||
| this.targetPath = targetPath; | ||
| this.newBackingPath = newBackingPath; | ||
| this.backupRepoType = backupRepoType; | ||
| this.backupRepoAddress = backupRepoAddress; | ||
| this.mountOptions = mountOptions; | ||
| } | ||
|
|
||
| public String getTargetPath() { | ||
| return targetPath; | ||
| } | ||
|
|
||
| public String getNewBackingPath() { | ||
| return newBackingPath; | ||
| } | ||
|
|
||
| public String getBackupRepoType() { | ||
| return backupRepoType; | ||
| } | ||
|
|
||
| public String getBackupRepoAddress() { | ||
| return backupRepoAddress; | ||
| } | ||
|
|
||
| public String getMountOptions() { | ||
| return mountOptions == null ? "" : mountOptions; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean executeInSequence() { | ||
| return true; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupChainKeys.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| package org.apache.cloudstack.backup; | ||
|
|
||
| /** | ||
| * Keys used by the NAS backup provider when storing incremental-chain metadata | ||
| * in the existing {@code backup_details} key/value table. Stored here (not on | ||
| * the {@code backups} table) so other providers do not need a schema change to | ||
| * support their own incremental implementations. | ||
| */ | ||
| public final class NASBackupChainKeys { | ||
|
|
||
| /** UUID of the parent backup (full or previous incremental). Empty for full backups. */ | ||
| public static final String PARENT_BACKUP_ID = "nas.parent_backup_id"; | ||
|
|
||
| /** QEMU dirty-bitmap name created by this backup, used as the {@code <incremental>} reference for the next one. */ | ||
| public static final String BITMAP_NAME = "nas.bitmap_name"; | ||
|
|
||
| /** Identifier shared by every backup in the same chain (the full anchors a chain; its incrementals inherit the id). */ | ||
| public static final String CHAIN_ID = "nas.chain_id"; | ||
|
|
||
| /** Position within the chain: 0 for the full, 1 for the first incremental, and so on. */ | ||
| public static final String CHAIN_POSITION = "nas.chain_position"; | ||
|
|
||
| /** Backup type marker: {@value #TYPE_FULL} or {@value #TYPE_INCREMENTAL}. Mirrors {@code backups.type} for fast lookup without a join. */ | ||
| public static final String TYPE = "nas.type"; | ||
|
|
||
| public static final String TYPE_FULL = "full"; | ||
| public static final String TYPE_INCREMENTAL = "incremental"; | ||
|
DaanHoogland marked this conversation as resolved.
Outdated
abh1sar marked this conversation as resolved.
|
||
|
|
||
| /** Set to the bitmap name when this incremental had to recreate its parent bitmap on the host (informational; this incremental is larger than usual). */ | ||
| public static final String BITMAP_RECREATED = "nas.bitmap_recreated"; | ||
|
|
||
| /** | ||
| * Tombstone key stored in {@code backup_details} when a backup is requested for deletion | ||
| * but still has live children. The on-NAS file is preserved until the last child is gone, | ||
| * at which point cascade deletion collects every tombstoned ancestor. Mirrors the snapshot | ||
| * subsystem's {@code Hidden} state semantics (see {@code DefaultSnapshotStrategy}). | ||
| */ | ||
| public static final String DELETE_PENDING = "nas.delete_pending"; | ||
|
|
||
| /** | ||
| * VM-scoped detail (stored in {@code vm_instance_details}) holding the QEMU dirty-bitmap | ||
| * name that currently exists on the running VM and is therefore the only valid parent | ||
| * for the next incremental backup. Written by {@link #BITMAP_NAME} on each successful | ||
| * backup; cleared on restore (the restored disk image has no bitmap, so the next backup | ||
| * must be a fresh full). When the VM has no detail, {@code decideChain} forces full. | ||
| */ | ||
| public static final String VM_ACTIVE_CHECKPOINT_ID = "nas.active_checkpoint_id"; | ||
|
|
||
| private NASBackupChainKeys() { | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.