NAS backup: automated infrastructure backup (database, configs, certificates)#12900
Open
jmsperu wants to merge 1 commit intoapache:4.22from
Open
NAS backup: automated infrastructure backup (database, configs, certificates)#12900jmsperu wants to merge 1 commit intoapache:4.22from
jmsperu wants to merge 1 commit intoapache:4.22from
Conversation
Adds automated backup of CloudStack infrastructure to NAS storage: - MySQL databases (cloud + cloud_usage if enabled) - Management server configuration (/etc/cloudstack/management/) - Agent configuration (/etc/cloudstack/agent/) - SSL certificates and keystores Backup runs daily via BackgroundPollManager, configurable via global settings: - nas.infra.backup.enabled (default: false) - nas.infra.backup.location (NAS mount path) - nas.infra.backup.retention (default: 7 backup sets) - nas.infra.backup.include.usage.db (default: true) Backups are stored in the NAS backup storage under infra-backup/ with automatic retention management. Uses mysqldump --single-transaction for hot database backup (no table locks, InnoDB consistent snapshot). Database credentials are read from /etc/cloudstack/management/db.properties.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #12900 +/- ##
============================================
- Coverage 17.61% 17.60% -0.01%
+ Complexity 15676 15674 -2
============================================
Files 5917 5918 +1
Lines 531537 531688 +151
Branches 64985 65008 +23
============================================
- Hits 93610 93608 -2
- Misses 427369 427525 +156
+ Partials 10558 10555 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a new
InfrastructureBackupTaskto the NAS backup plugin that performs daily backups of CloudStack infrastructure (database, management/agent configs, SSL certs) to NAS storage.Problem
CloudStack's NAS backup provider only backs up VM disks. The management server database, agent configurations, SSL certificates, and global settings are not backed up. If the management server fails, all metadata is lost unless someone manually configured mysqldump cron.
Solution
A new background poll task that automatically backs up:
cloud+ optionallycloud_usage) usingmysqldump --single-transactionfor InnoDB-consistent hot backups/etc/cloudstack/management/)/etc/cloudstack/agent/) if present/etc/cloudstack/management/cert/) if presentDatabase credentials are read from
/etc/cloudstack/management/db.propertiesat runtime (no secrets stored in global config).Configuration
nas.infra.backup.enabledfalsenas.infra.backup.location/mnt/nas-backup)nas.infra.backup.retention7nas.infra.backup.include.usage.dbtruecloud_usagedatabaseBackup Structure
Changes
InfrastructureBackupTask.java- background task implementingBackgroundPollTaskNASBackupProvider.java- added 4 ConfigKeys, scheduled the backup taskTest plan
nas.infra.backup.enabled=trueandnas.infra.backup.location=/mnt/test-backupcloud-*.sql.gzdatabase dump is created and restorablemanagement-config.tar.gzcontains/etc/cloudstack/management/filesagent-config.tar.gzis created only when agent config dir existsdb.propertiesgracefullycloud_usagebackup is included/excluded based on config