Commit 30d1a937 authored by Nicolas Wavrant's avatar Nicolas Wavrant

resilient: new paramater to define the time to sleep before running the backup in the cron job.

Default is a random value between 0 and 6 hours. KVM and Slaprunner test instances set it at 0.
parent 3f95bad9
......@@ -127,7 +127,7 @@ on-update = true
recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm-resilient-test.cfg.jinja2
md5sum = 6b40e280201aaf9258c4cb5de7c1f5b4
md5sum = c1b6a998b362dfd2202e0c19cb49a80d
mode = 0644
download-only = true
on-update = true
......
......@@ -50,6 +50,12 @@
"type": "string",
"optional": true
},
"resiliency-backup-sleep-time-buffer": {
"title": "Time to sleep before backup",
"description": "Time to sleep once the cron job is triggered before the backup start for real.",
"type": "string",
"optional": true
},
"remove-backup-older-than": {
"title": "Remove backups older than...",
"description": "Remove all the backups in PBS that are older than specified value. It should be rdiff-backup-compatible.",
......
......@@ -59,6 +59,7 @@ config-{{ key }} = {{ dumps(value) }}
config-virtual-hard-drive-url = ${slap-parameter:virtual-hard-drive-url}
config-virtual-hard-drive-md5sum = ${slap-parameter:virtual-hard-drive-md5sum}
config-resiliency-backup-periodicity = */5 * * * *
config-resiliency-backup-sleep-time-buffer = 0
config-resilient-clone-number = 1
config-ignore-known-hosts-file = false
return = ipv6
......
......@@ -107,7 +107,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/instance-resilient-test.cfg.jinja2
download-only = true
md5sum = 09a955bde79fb11565d689b0415e135c
md5sum = 5b9d2d4b38e2bf4a6440bdf63b634507
filename = instance-resilient-test.cfg.jinja2
mode = 0644
......
......@@ -55,6 +55,7 @@ name = Resilient Instance (Root Instance)
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
config-resiliency-backup-periodicity = */10 * * * *
config-resiliency-backup-sleep-time-buffer = 0
config-resilient-clone-number = 1
config-ignore-known-hosts-file = false
# XXX hardcoded
......
......@@ -51,6 +51,12 @@
"type": "string",
"optional": true
},
"resiliency-backup-sleep-time-buffer": {
"title": "Time to sleep before backup",
"description": "Time to sleep once the cron job is triggered before the backup start for real.",
"type": "string",
"optional": true
},
"remove-backup-older-than": {
"title": "Remove backups older than...",
"description": "Remove all the backups in PBS that are older than specified value. It should be rdiff-backup-compatible.",
......
......@@ -59,7 +59,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-export.cfg.in
output = ${buildout:directory}/pbsready-export.cfg
md5sum = cb2537598981a1a4af0dea05cc6ac6bd
md5sum = affd75f6357e2f91521eb5e89a639842
mode = 0644
[template-pull-backup]
......
......@@ -25,6 +25,11 @@
"description": "Periodicity of backup, in cron format. Default is every hour.",
"type": "string"
},
"resiliency-backup-sleep-time-buffer": {
"title": "Time to sleep before backup",
"description": "Time to sleep once the cron job is triggered before the backup start for real.",
"type": "string",
},
"remove-backup-older-than": {
"title": "Remove backups older than...",
"description": "Remove all the backups in PBS that are older than specified value. It should be rdiff-backup-compatible.",
......
......@@ -78,10 +78,11 @@ recipe = slapos.cookbook:cron.d
name = backup
frequency = $${slap-parameter:resiliency-backup-periodicity}
# Sleep from 1 to 6 hours before backing up (disks/network IO optimization)
sleep-command = ${bash:location}/bin/bash -c "sleep $((RANDOM%(60*60*6)))"
sleep-command = ${bash:location}/bin/bash -c "sleep $(($${slap-parameter:resiliency-backup-sleep-time-buffer}))"
command = ($${:sleep-command}; $${notifier-exporter:wrapper} --transaction-id `date +%s`)
[slap-parameter]
# In cron.d format (i.e things like */15 * * * * are accepted).
resiliency-backup-periodicity = 0 0 * * *
resiliency-backup-sleep-time-buffer = RANDOM%(60*60*6)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment