Skip to content

Commit 85ca17a

Browse files
NAS backup: support incremental backups of RBD volumes (#14386)
* test: support Ceph/RBD primary storage in NAS backup smoke test test_backup_recovery_nas.py only allowed NFS primary storage, since it reused the primary storage pool's own path as the NAS backup repository address, and always required incremental-backup semantics that only qcow2/NFS storage can provide. Neither holds on Ceph/RBD. - setUpClass now accepts RBD alongside NFS as the primary storage pool type, picking a pool that's actually Up rather than list()[0] -- environments that added Ceph/RBD after the zone's original NFS primary storage keep that old pool around in Disabled state, and it still sorts first, silently exercising its path as if it were the storage VMs actually deploy on. - The NAS backup repository's NFS export address is resolved independently of the primary storage: when the primary pool isn't NFS, reuse the nfs test data entry (services[nfs][url]) -- the same temporary NFS mount point test_primary_storage.py uses for its temporary NFS primary storage pool, and something every marvin environment already has configured. An explicit nas_backup_repository_address test data entry or NAS_BACKUP_REPO_ADDRESS environment variable, if set, takes precedence. - The external offering imported in setUpClass is matched to the repository just created by externalid (== the repository's own id for the nas provider) rather than blindly taking index 0 -- a stray repository left over from an earlier interrupted run, whose backups didn't get cleaned up so its own teardown couldn't remove it either, sorts alongside the new one with no guarantee of which comes first. - Incremental NAS backups require QEMU dirty bitmaps / libvirt checkpoints, which only exist on file-based qcow2 storage (NASBackupProvider.allVolumesOnCheckpointCapableStorage). The six incremental-chain tests now skip on RBD/Ceph, where the provider always falls back to full-only backups server-side, rather than failing on assertions that storage type can never satisfy. - Added test_restore_volume_and_attach_to_vm, which exercises restoreVolumeFromBackupAndAttachToVM end-to-end (restoring a backed-up ROOT and DATADISK volume onto a second, stopped Instance) -- the API that drives the restore-and-attach code fixed by the previous commit (#14007). The target Instance is stopped with forced=True: a graceful ACPI stop was observed to time out (~2 minutes) before falling back to a hard destroy anyway, and once forced to a hard destroy the domain drops out of libvirt entirely, so the periodic ping-based PowerState sync the restore call depends on falls back to a much slower heuristic well past any reasonable wait. A forced stop destroys the domain immediately and deterministically. * KVM: support incremental NAS backups of RBD volumes Incremental NAS backups so far relied on QEMU dirty bitmaps / libvirt checkpoints, which only exist on file-based qcow2 storage. RBD images are raw and have nowhere to persist a bitmap, so any VM with a volume on Ceph was forced onto the full-only path and re-uploaded the whole image on every cycle. Ceph provides the equivalent natively, and this adds a second chain format that uses it: an `rbd snap` per cycle as the anchor plus `rbd export-diff --from-snap`, which computes the changed extents inside Ceph from the image object-map. NASBackupProvider now selects the mechanism per VM via getIncrementalFlavor() - QCOW2 for checkpoint-capable pools, RBD for Ceph, UNSUPPORTED (legacy full-only) for mixed or other storage, since the two formats cannot be mixed inside one backup. Everything else - chain identity, the nas.backup.full.every cadence, delete/tombstone semantics and resource accounting - is shared unchanged. Restore differs because an export-diff stream carries no pointer to the diff before it, unlike a rebased qcow2. The provider therefore sends the whole chain from its full anchor up to the backup being restored, and the agent recreates the image and replays each diff with `rbd import-diff` in order. The image has to be recreated: a full diff only carries the extents that were allocated when it was taken, so any block still allocated in the target would otherwise show through as stale data. That also drops RBD snapshots the volume carried, which is inherent to rewinding a volume wholesale. Two behaviours follow from the anchor living in Ceph rather than in the QEMU process: a stopped VM keeps its incremental cadence (no live QEMU needed), and a chain survives a VM restart or host migration. Only the newest anchor is kept per image; a full additionally sweeps every older snapshot carrying the csbackup- prefix, so a deleted chain, an unassigned offering or a restore cannot leak snapshots. The feature stays behind the existing nas.backup.incremental.enabled zone setting, which still defaults to false. Note: the agent drives the `rbd` CLI, so KVM hosts backing up Ceph volumes need ceph-common installed. Verified on a Ceph Reef 18.2.8 cluster with KVM hosts on Ceph Quincy 17.2.7 clients: FULL 1.86 GB followed by incrementals of 71 KB - 2.6 MB, restores replaying 2- and 3-diff chains across two RBD pools including through a tombstoned ancestor. test_backup_recovery_nas.py: the blanket RBD skip is replaced by an _is_rbd_storage() predicate, so the five chain tests now run on Ceph. test_stopped_vm_falls_back_to_full keeps a targeted skip because RBD has the opposite behaviour by design, and a new test_stopped_rbd_vm_keeps_incremental_cadence asserts that other side. * test: run the NAS backup smoke test on a cloud-init template The suite registered the legacy CentOS 5.5 tiny template via get_template(). Its kernel/udev does not reliably enumerate hot-attached virtio disks and it ships no mkfs.ext4, so the chain tests needed guest-side workarounds to reach the data they back up and restore. Register the Ubuntu 24.04 cloud-init template instead, which enumerates hot-attached disks, carries the usual filesystem tools and grows its root filesystem on first boot by itself. The cloud image disables SSH password authentication outright (60-cloudimg-settings.conf), so guest access moves to an SSH keypair and the stock "ubuntu" user. That user lands unprivileged, so commands touching /root or a raw block device now go through a _sudo() helper which wraps the whole command in `sh -c` under sudo, keeping redirects and ';'-separated commands root-privileged rather than just the first word. Cleanup ordering changes with it: a template cannot be deleted while a VM still uses it, so it is appended to _cleanup after the account that owns the VM, since cleanup_resources() deletes in list order. The in-place multi-disk restore regression test that accompanied this change upstream is left out: it asserts the uuid-based volume mapping in LibvirtRestoreBackupCommandWrapper, which this branch does not carry. * test: validate a whole backup chain, including across a mid-chain delete The existing chain tests each check one property of one backup: the full/incremental cadence, a restore from the tip, a delete that repairs or defers. None of them walks the chain as a whole, and none asserts on backup size. Add a test that builds FULL + 3 INCREMENTALs with a marker file per backup, restores from every backup and creates a VM from every backup, then deletes the 2nd incremental and repeats both sweeps over what survives. The mid-chain delete is what earns the runtime on RBD. An `rbd export-diff` stream carries no pointer to the diff before it, so a restore replays the whole sequence from the full anchor, and a diff whose descendant still needs it cannot be dropped when it is deleted, only hidden. Restoring the tip across that gap is what breaks if the provider ever sends a chain with a hole in it, and nothing else covered it. Sizes are asserted throughout: an incremental must be a small fraction of the full. That is what distinguishes a real export-diff delta from the whole image being re-exported every cycle, and no other test in this file looks at size at all, so a provider that silently fell back to full-every-time still passed. Each restore also asserts that markers written after that backup are gone. Checking only that the expected markers are present would pass even if the restore had quietly done nothing. VMs built from backups are expunged as the test goes rather than through _cleanup: seven of them are created, and holding them all to the end risks exhausting the environment's capacity partway through a run. * test: verify the guest of a VM created from a backup, not just that it boots The chain test checked an Instance created from a backup only for reaching Running. That proves the image boots; it says nothing about whether the diff chain was replayed into the new volume correctly, so a create-from-backup that produced a stale or empty image would still have passed. Check the guest the same way an in-place restore is checked: the markers taken up to that backup must be present, and markers written after it must be absent. The absent half matters as much as the present half -- without it, a VM that somehow came up with the source Instance's current disk would pass. Access uses the pattern already proven by test_incremental_after_vm_restart: the backup carries the source Instance's authorized_keys, so the new VM accepts the same keypair and the stock cloud-image "ubuntu" user. * nasbackup: carry the backup method separately from the mode The RBD path overloaded ChainDecision.mode with rbd-full and rbd-incremental, the same way the content-based path upstream overloaded it with content-full and content-incremental. Split the two concerns as that path already did: mode stays full or incremental, and a new method field says how the backup is taken -- qcow2 (push mode with dirty bitmaps) or rbd (Ceph-native, anchored on an rbd snapshot and exported with rbd export-diff). TakeBackupCommand gets a method field and nasbackup.sh a --method option. Both default to qcow2 when absent, so a management server that does not send a method keeps working against an upgraded agent. legacy-full is unchanged: rewriting it as full plus a "none" method would break incremental-disabled backups on agents that have not been upgraded yet. CHAIN_FORMAT stays as it is. The method says how a backup is taken and lives only for the duration of the request; the chain format is persisted and says what is on the repository, which is what restore and delete read later. The two coincide for the rbd method today but answer different questions. This mirrors c144d09 from #14194, which introduced the method for the content path and named an RBD diff as the next one to adopt it. Kept as close to that commit as the branch allows so the two merge cleanly: this branch carries the RBD path but not the content one, so the METHOD_CONTENT token is defined without a user here. * utils: add RbdUtils for the Ceph monitors of an RBD pool Everything that talks to Ceph needs the pool's monitors as a list the client can parse, and the rules are the same wherever that list is built: give each monitor the pool's port unless it names one already, and put a bare IPv6 address in square brackets so its own colons stay distinguishable from the separator before the port. The mon_host option of a disk's rbd: string wants the same list again, with ':' and ';' escaped, because those two separate the options of that string and its monitors. None of it depends on a storage pool, so collect it in RbdUtils as static methods with their unit tests, rather than leaving each caller to grow a copy that is right in a different set of cases. * kvm: build the Ceph monitors of the restore backup command with RbdUtils The monitors with a port, and the IPv6 monitors, are not valid arguments of rbd -m when the brackets are removed and the port is added to each monitor. * backup: name the rbd method in the TakeBackupCommand comment The field listed qcow2 and content but not rbd, the method this branch adds, so the one method a reader of this command is most likely to be chasing was the one the comment left out. * Add package dependencies * Add ceph-common as dependencies * kvm: refuse an RBD restore that would destroy a snapshot we did not take A restore rewinds the volume wholesale: the image is removed and rebuilt from its diff chain, so every snapshot it carried goes with it. The chain anchors this path takes are its own to drop, but a CloudStack volume snapshot kept on primary storage, or anything else taken outside this path, is content someone asked to keep, and destroying it quietly is not a trade the operator was offered. Ask what the image carries before touching it. A snapshot that is not one of ours refuses the restore, naming the ones in the way so they can be deleted or the backup restored into a new volume. Anything else is purged as before, except that an image which carries nothing is no longer handed a purge with nothing to do; when the listing itself fails we cannot tell, so it is purged as it always was. The failure to remove the image goes back to saying only that. Explaining it by a snapshot with clones made sense while a restore purged whatever it found, but the snapshot those clones belong to is now refused earlier, so a removal that still fails is failing for some other reason. The test that replays a whole chain stubbed every piped rbd call with the output of `rbd info`, whose "name" field would now read as a snapshot; tell the two commands apart there, and cover the refusal. * kvm: drop the cephx key file from a trap in nasbackup.sh The key the script hands the rbd CLI lives in a temporary file for the length of a call. cleanup() removes it, but only the failure paths call cleanup, so an exit that does not reach it left the key behind. Leave its removal to the shell as well, which covers every exit it still gets to run code on. * utils: test the escaped colons of an IPv6 Ceph monitor without a port composeOptionForMonHosts escapes every ':' of a monitor, because the colons separate the options of the rbd: string. That includes the colons of an IPv6 address, also when the pool has no port to add. Test that case, and make addPortToRbdMonitor, which is only used by RbdUtils itself, protected. * kvm: remove the backup anchor once the chain it anchors is gone An RBD chain is exported from a snapshot of every volume, the anchor, named csbackup-<id>. Each backup drops the previous anchor once its delta has been exported, so one anchor per volume is kept: the one the next incremental reads from. Nothing removed the last one. When the last backup of a chain was deleted, or the Instance was taken out of its backup offering, the anchor stayed on the image for as long as the volume lived, and with it the data it references: the next backup is a full one either way, so nothing ever read it again. Remove the anchors of an Instance's volumes wherever the chain ends, next to where the Instance's active checkpoint is already cleared. nasbackup.sh takes a removeanchors operation, which sweeps every snapshot carrying the backup prefix off the volumes it is given: only the snapshots this tool creates carry it, so a user or volume snapshot is never touched. The removal is best effort. The chain is gone either way, and a host that cannot be reached must not fail the delete of a backup or the removal of an offering, so a failure is logged rather than thrown. An Instance with no volume on an RBD pool carries no anchor and is left alone. * nas: decide a chain from its flavour rather than from an rbd flag decideChain carried a boolean telling the RBD flavour apart from the QCOW2 one, and every branch that differs between the two read it: the prefix of the anchor it names, the on-NAS format it requires of the parent, the decision it returns, and whether a stopped Instance can continue the chain at all. A third flavour would have to be threaded through each of them separately. Ask the flavour instead. anchorPrefixOf, flavorToFormat and flavorSupportsIncrementalWhileStopped answer the three questions the branches were asking, incrementalDecision builds the next link of a chain as fullDecision already built the first one, and both take the flavour. The prefix of a QCOW2 anchor is named alongside the RBD one rather than written in place. Behaviour is unchanged: a stopped Instance only reaches the full it took before when its flavour cannot continue a chain while stopped, which is every flavour but RBD, so the decision it returns is the same one. Also rename applyBackupFormat to applyBackupFormatToRestoreCommand, which says what it applies the format to. * packaging: suggest ceph-common instead of requiring it The agent only needs the rbd command line tools for RBD backups and migrations; python3-rados and python3-rbd stay required. * nas: address review of the RBD incremental backups - restore: check every target volume (RBD storage, no foreign snapshots) before removing any image, so a later volume cannot fail after an earlier one was already rewound - restore: replay each rbd import-diff with the restore timeout instead of the one hour default - backup: pause a running multi-disk VM around the RBD snapshots when the filesystems were not frozen, so the set is crash consistent - drop em-dashes from log and exception messages * nas: run RBD backups on a host that has the rbd command ceph-common is only suggested by the agent package, so not every KVM host has the rbd command. The agent now reports whether it does (host.rbd.cli) and an RBD backup runs on a host that has it: the Instance's own host, or for a stopped Instance any other Up host of its cluster. When there is none, a plain full backup is taken instead of failing on the missing command. * nas: restore RBD backups on a host that has the rbd command Restoring an RBD chain recreates the image and replays the diffs with the rbd command, which a host may lack as ceph-common is only suggested. Restore on the Instance's host when it has the command, otherwise on another host of its cluster that has it. A volume restore that attaches to a running Instance has to stay on that Instance's host. When no usable host has the command, fail with a message that says so. * import com.cloud.utils.exception.CloudRuntimeException * nasbackup.sh: bring back the quiesce fixes of #14305 dropped by the merges The merges of main into this branch lost most of #14305 in nasbackup.sh: - --quiesce-timeout was no longer parsed, so a quiesced backup, for which the agent passes it by default, failed with an invalid option on every storage - abort_backup_job() was gone, though the pull mode path of the Linstor backup still calls it, so a failed pull job kept the scratch devices busy - the push mode path lost the freeze timeout, the thaw after every freeze attempt, the thaw retries, the abort of the job in cleanup() and the retry of the domjobinfo query The script is main's again, plus what the rbd method adds. The rbd path now freezes and thaws the guest with the same helpers, resuming a paused Instance before it thaws. * nas: tell the user why a restore of an Instance from a backup failed When the host refuses or fails the restore, the NAS provider returned only false and the backup manager answered with the generic error, so the reason the host gave, such as an RBD image carrying snapshots the backup path did not take, never reached the user. Throw a BackupProviderException with the details of the answer, which the backup manager hands to the user as it is. * nas: check for volume snapshots on RBD before restoring an Instance from a backup Restoring an RBD volume from a backup rewinds the image wholesale, which removes every snapshot it carries, so the host refuses it when the image carries a snapshot the backup path did not take. Check the volume snapshots kept on primary storage in the management server first, and refuse before anything is sent to the host with the names of the volume and of its snapshots. The host still checks the image, which also catches snapshots CloudStack does not know about. * nas: remove a duplicate import of DataStoreRole in the test NASBackupProviderTest imported com.cloud.storage.DataStoreRole twice, which the checkstyle check of the build refuses. * test: release the public IP of each Instance the NAS backup tests create Marvin gives every Instance created by VirtualMachine.create or Backup.createVMFromBackup its own public IP, with a port forwarding rule for SSH, and destroying the Instance does not release that IP. The class only got them back when its account was removed, so the tests which create Instances from backups ran out of the 13 free addresses of the public range and failed with "Insufficient address capacity", after which Marvin silently left ssh_ip unset. Add release_publicIP() to marvin.lib.common, which releases a public IP unless it is the source NAT address of the network, and call it for the Instances of each test in tearDown, for the target Instance of test_restore_volume_and_attach_to_vm, and for each Instance which test_full_chain_restore_and_create_vm_survive_mid_chain_delete destroys as it goes. The Instance shared by the class keeps its IP until the class ends. * kvm: build every Ceph monitor list with RbdUtils The agent assembled the monitor list in several places, each with its own idea of the rules. Opening a RADOS connection, or writing a ceph.conf for one, appended the pool's port to the host string as a whole, so with several monitors only the last was given it and a monitor that already named its port was handed a second. The rbd: option string of a disk escaped the colons of an IPv6 address only when it was bracketed already, which left a bare one reading as though it carried options of its own. Use the shared helpers for all of them. Two inputs therefore come out differently, both previously wrong: a monitor that names its port keeps just that one, and a bare IPv6 address is bracketed before anything is appended to it or escaped in it. The iscsiadm portals in IscsiAdmStorageAdaptor read the same way but are not monitor lists, so they keep their own formatting. * nas: address the second review of the RBD incremental backups - restore: fail closed when the snapshots of an RBD image can not be listed, so a restore never removes snapshots it could not see; a missing image (exit code 2) has none. - removing the offering sends the anchor cleanup to a host which has the rbd command, and sends none when no host has it. - build the Ceph monitor list of an RBD disk string with RbdUtils, so a bare IPv6 monitor is bracketed, carries its port and survives nasbackup.sh's parser. - RBD backup: bound the freeze, pause and snapshot steps with timeouts and keep a state file in /run/csbackup while the guest is held. The guest is released by a TERM/HUP/INT trap of the script, by the take-backup wrapper when the script failed or was killed, and by the agent for every state file left when it starts (RbdBackupGuestReleaser), which covers SIGKILL, a crash and a restart of the agent. - nasbackup.sh holds a per-VM flock during the RBD backup, so two backups of a VM can not freeze the guest and share the state file at once. A refused backup exits with 21 and the wrapper then leaves the guest to the backup which holds the lock.
1 parent 9644bc6 commit 85ca17a

30 files changed

Lines changed: 3377 additions & 222 deletions

File tree

‎api/src/main/java/com/cloud/host/Host.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static String[] toStrings(Host.Type... types) {
5858
String HOST_KVM_DISK_ONLY_VM_SNAPSHOT_NVRAM = "host.kvm.diskonlyvmsnapshot.nvram";
5959
String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
6060
String HOST_RBD_VOLUME_ENCRYPTION = "host.volume.encryption.rbd";
61+
String HOST_RBD_CLI = "host.rbd.cli";
6162
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
6263
String HOST_VDDK_SUPPORT = "host.vddk.support";
6364
String HOST_VDDK_LIB_DIR = "vddk.lib.dir";
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// Licensed to the Apache Software Foundation (ASF) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The ASF licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
//
19+
20+
package org.apache.cloudstack.backup;
21+
22+
import java.util.List;
23+
24+
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
25+
26+
import com.cloud.agent.api.Command;
27+
28+
/**
29+
* Remove the backup anchors of an Instance's volumes: the RBD snapshots an incremental chain is
30+
* exported from. An anchor is only kept to export the next incremental from it, so once the chain
31+
* is gone the next backup is a full one and the anchor would only keep the data it references
32+
* allocated in the pool.
33+
*/
34+
public class RemoveBackupAnchorsCommand extends Command {
35+
private List<PrimaryDataStoreTO> volumePools;
36+
private List<String> volumePaths;
37+
38+
public RemoveBackupAnchorsCommand(List<PrimaryDataStoreTO> volumePools, List<String> volumePaths) {
39+
super();
40+
this.volumePools = volumePools;
41+
this.volumePaths = volumePaths;
42+
}
43+
44+
public List<PrimaryDataStoreTO> getVolumePools() {
45+
return volumePools;
46+
}
47+
48+
public void setVolumePools(List<PrimaryDataStoreTO> volumePools) {
49+
this.volumePools = volumePools;
50+
}
51+
52+
public List<String> getVolumePaths() {
53+
return volumePaths;
54+
}
55+
56+
public void setVolumePaths(List<String> volumePaths) {
57+
this.volumePaths = volumePaths;
58+
}
59+
60+
@Override
61+
public boolean executeInSequence() {
62+
return true;
63+
}
64+
}

‎core/src/main/java/org/apache/cloudstack/backup/RestoreBackupCommand.java‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ public class RestoreBackupCommand extends Command {
4141
private VirtualMachine.State vmState;
4242
private Integer mountTimeout;
4343

44+
/**
45+
* On-NAS format of the backup files: {@code qcow2} (default, also when null) or {@code rbddiff}
46+
* for Ceph/RBD chains written with {@code rbd export-diff}. Decides both the file extension the
47+
* agent looks for and how the volume is reconstructed.
48+
*/
49+
private String backupFormat;
50+
51+
/**
52+
* For {@code rbddiff} backups: every backup directory of the chain from its full anchor up to
53+
* and including the backup being restored, ordered root-first. {@code rbd import-diff} streams
54+
* have no backing-file metadata, so the chain cannot be self-describing the way rebased qcow2
55+
* files are — the agent has to be told which diffs to replay and in which order. Null/empty for
56+
* qcow2 backups.
57+
*/
58+
private List<String> backupChainPaths;
59+
4460
protected RestoreBackupCommand() {
4561
super();
4662
}
@@ -164,4 +180,20 @@ public Integer getMountTimeout() {
164180
public void setMountTimeout(Integer mountTimeout) {
165181
this.mountTimeout = mountTimeout;
166182
}
183+
184+
public String getBackupFormat() {
185+
return backupFormat;
186+
}
187+
188+
public void setBackupFormat(String backupFormat) {
189+
this.backupFormat = backupFormat;
190+
}
191+
192+
public List<String> getBackupChainPaths() {
193+
return backupChainPaths;
194+
}
195+
196+
public void setBackupChainPaths(List<String> backupChainPaths) {
197+
this.backupChainPaths = backupChainPaths;
198+
}
167199
}

‎core/src/main/java/org/apache/cloudstack/backup/TakeBackupCommand.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class TakeBackupCommand extends Command {
3939

4040
// Incremental backup fields (NAS provider; null/empty for legacy full-only callers).
4141
private String mode; // "full" or "incremental"; null => legacy behaviour (script default)
42-
private String method; // "qcow2" (bitmaps, push mode) or "content" (pull mode); null => "qcow2"
42+
private String method; // "qcow2" (bitmaps, push mode), "content" (pull mode) or "rbd" (Ceph export-diff); null => "qcow2"
4343
private String bitmapNew; // Checkpoint/bitmap name to create with this backup (timestamp-based)
4444
private String bitmapParent; // Incremental: parent bitmap to read changes since
4545

‎debian/control‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Package: cloudstack-agent
2626
Architecture: all
2727
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17 | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime | zulu-21, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat, python3-libnbd, socat, openssl, bzip2, gzip, unzip, file, xz-utils
2828
Recommends: init-system-helpers
29-
Suggests: python3-rados, python3-rbd
29+
Suggests: ceph-common, python3-rados, python3-rbd
3030
Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
3131
Description: CloudStack agent
3232
The CloudStack agent is in charge of managing shared computing resources in

‎packaging/el8/cloud.spec‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Requires: (libgcrypt > 1.8.3 or libgcrypt20)
128128
Requires: (selinux-tools if selinux-tools)
129129
Requires: sysstat
130130
Requires: python3-libnbd
131+
Suggests: ceph-common
131132
Suggests: python3-rados
132133
Suggests: python3-rbd
133134
Requires: socat

‎packaging/suse15/cloud.spec‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Requires: cifs-utils
120120
Requires: (edk2-ovmf or qemu-ovmf-x86_64)
121121
Requires: swtpm
122122
Requires: (python3-libvirt or python3-libvirt-python)
123+
Suggests: ceph-common
123124
Suggests: (python3-rados or python3-ceph-common)
124125
Suggests: (python3-rbd or python3-ceph-common)
125126
Requires: (qemu-img or qemu-tools)

‎plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupChainKeys.java‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,21 @@ public final class NASBackupChainKeys {
2727
/** UUID of the parent backup (full or previous incremental). Empty for full backups. */
2828
public static final String PARENT_BACKUP_ID = "nas.parent_backup_id";
2929

30-
/** QEMU dirty-bitmap name created by this backup, used as the {@code <incremental>} reference for the next one. */
30+
/**
31+
* Name of the point-in-time anchor this backup created, used as the parent reference for the
32+
* next backup in the chain. Its meaning depends on the chain format: for {@link #FORMAT_QCOW2}
33+
* chains it is the QEMU dirty-bitmap name used as the {@code <incremental>} reference; for
34+
* {@link #FORMAT_RBD_DIFF} chains it is the RBD snapshot name used as {@code --from-snap}.
35+
*/
3136
public static final String BITMAP_NAME = "nas.bitmap_name";
3237

38+
/**
39+
* On-NAS format of the chain this backup belongs to: {@link #FORMAT_QCOW2} (rebased qcow2
40+
* files, the file-based storage path) or {@link #FORMAT_RBD_DIFF} ({@code rbd export-diff}
41+
* streams, the Ceph/RBD path). Absent on legacy-full backups, which are always qcow2.
42+
*/
43+
public static final String CHAIN_FORMAT = "nas.chain_format";
44+
3345
/** Identifier shared by every backup in the same chain (the full anchors a chain; its incrementals inherit the id). */
3446
public static final String CHAIN_ID = "nas.chain_id";
3547

@@ -51,7 +63,6 @@ public final class NASBackupChainKeys {
5163
/**
5264
* In-memory backup-method sentinels used by {@code ChainDecision.method}: how a backup is
5365
* taken, independent of whether it is a full or an incremental ({@code ChainDecision.mode}).
54-
* Both methods write the same chain of qcow2 files, so restore and delete do not care.
5566
*
5667
* <p>{@link #METHOD_QCOW2}: libvirt push-mode backup; incrementals come from QEMU persistent
5768
* dirty bitmaps (libvirt checkpoints), which only qcow2 volumes can carry.</p>
@@ -66,6 +77,14 @@ public final class NASBackupChainKeys {
6677
*/
6778
public static final String METHOD_CONTENT = "content";
6879

80+
/**
81+
* Ceph-native backup, used for RBD volumes. They are raw and cannot carry a persistent dirty
82+
* bitmap, so each cycle anchors on an RBD snapshot and exports the delta with
83+
* {@code rbd export-diff}. Unlike the other methods this one writes {@link #FORMAT_RBD_DIFF}
84+
* streams rather than qcow2 files, which is what {@link #CHAIN_FORMAT} records for restore.
85+
*/
86+
public static final String METHOD_RBD = "rbd";
87+
6988
/**
7089
* VM-scoped detail (stored in {@code vm_instance_details}) holding the QEMU dirty-bitmap
7190
* name that currently exists on the running VM and is therefore the only valid parent
@@ -75,6 +94,10 @@ public final class NASBackupChainKeys {
7594
*/
7695
public static final String VM_ACTIVE_CHECKPOINT_ID = "nas.active_checkpoint_id";
7796

97+
/** Chain format values persisted under {@link #CHAIN_FORMAT}; also the on-NAS file extension. */
98+
public static final String FORMAT_QCOW2 = "qcow2";
99+
public static final String FORMAT_RBD_DIFF = "rbddiff";
100+
78101
private NASBackupChainKeys() {
79102
}
80103
}

0 commit comments

Comments
 (0)