Add VM automirror support

Allows shipping snapshots automatically to remote clusters on a cron,
identically to how autobackup handles local snapshot exports.

VMs are selected based on configured tags, and individual destination
clusters can be specified based on a colon-separated suffix to the
tag(s).

Automirror snapshots use the prefix "am" (analogous to "ab" for
autobackups) to differentiate them from normal "mr" mirrors.
This commit is contained in:
2024-11-15 01:37:27 -05:00
parent cebc660fb0
commit 078d48a50b
8 changed files with 1010 additions and 120 deletions

View File

@ -53,6 +53,9 @@ from daemon_lib.vmbuilder import (
from daemon_lib.autobackup import (
worker_cluster_autobackup,
)
from daemon_lib.automirror import (
worker_cluster_automirror,
)
# Daemon version
version = "0.9.103"
@ -122,6 +125,26 @@ def cluster_autobackup(self, force_full=False, email_recipients=None, run_on="pr
)
@celery.task(name="cluster.automirror", bind=True, routing_key="run_on")
def cluster_automirror(
self, email_recipients=None, email_errors_only=False, run_on="primary"
):
@ZKConnection(config)
def run_cluster_automirror(
zkhandler, self, email_recipients=None, email_errors_only=False
):
return worker_cluster_automirror(
zkhandler,
self,
email_recipients=email_recipients,
email_errors_only=email_errors_only,
)
return run_cluster_automirror(
self, email_recipients=email_recipients, email_errors_only=email_errors_only
)
@celery.task(name="vm.flush_locks", bind=True, routing_key="run_on")
def vm_flush_locks(self, domain=None, force_unlock=False, run_on="primary"):
@ZKConnection(config)