Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jean-Paul Smets
slapos
Commits
4fb9c5ff
Commit
4fb9c5ff
authored
Jul 30, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM SR: add resiliency support
parent
425dd640
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
188 additions
and
2 deletions
+188
-2
software/kvm/common.cfg
software/kvm/common.cfg
+47
-2
software/kvm/instance-kvm-export.cfg.in
software/kvm/instance-kvm-export.cfg.in
+31
-0
software/kvm/instance-kvm-import.cfg.in
software/kvm/instance-kvm-import.cfg.in
+37
-0
software/kvm/instance-kvm-resilient.cfg.jinja2
software/kvm/instance-kvm-resilient.cfg.jinja2
+42
-0
software/kvm/instance.cfg.in
software/kvm/instance.cfg.in
+6
-0
software/kvm/template/kvm-export.sh.in
software/kvm/template/kvm-export.sh.in
+18
-0
software/kvm/template/kvm-import.sh.in
software/kvm/template/kvm-import.sh.in
+7
-0
No files found.
software/kvm/common.cfg
View file @
4fb9c5ff
...
...
@@ -11,12 +11,16 @@ extends =
../../component/openssl/buildout.cfg
../../component/dcron/buildout.cfg
../../stack/nodejs.cfg
../../stack/resilient/buildout.cfg
../../stack/slapos.cfg
parts =
template
eggs
# XXX: we have to manually add this for resilience
rdiff-backup
#XXX-Cedric : Currently, one can only access to KVM using noVNC.
# Ideally one should be able to access KVM by using either NoVNC or VNC.
# Problem is : no native crypto support in web browsers. So we have to disable ssl
...
...
@@ -73,7 +77,7 @@ command =
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
#md5sum = fd9374172f7eb41629357351e73a36b8
md5sum = aa565068d290ff3fe0a137b4dad58140
output = ${buildout:directory}/template.cfg
mode = 0644
...
...
@@ -84,6 +88,48 @@ md5sum = 6cb18eae515703c189bf5a9cf9eeb6d5
output = ${buildout:directory}/template-kvm.cfg
mode = 0644
[template-kvm-resilient]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance-kvm-resilient.cfg.jinja2
md5sum = 3ee64c654aae503b93b39e9ccd6d3643
rendered = ${buildout:directory}/template-kvm-resilient.cfg
context = key buildout buildout:bin-directory
key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory
import-list = file parts template-parts:destination
file replicated template-replicated:destination
mode = 0644
[template-kvm-import]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm-import.cfg.in
md5sum = 7b36d6c61154b7ec3113a1bfaa25a904
output = ${buildout:directory}/template-kvm-import.cfg
mode = 0644
[template-kvm-import-script]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/kvm-import.sh.in
filename = kvm-import.sh.in
md5sum = e03ed049cddd8d157228b09e1ebc071a
download-only = true
mode = 0755
[template-kvm-export]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm-export.cfg.in
md5sum = 9e1dc5bd8f2c144fca4fdfe38427cb8b
output = ${buildout:directory}/template-kvm-export.cfg
mode = 0644
[template-kvm-export-script]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/kvm-export.sh.in
filename = kvm-export.sh.in
md5sum = 08cd8da2221f09095b14e35e6acd2a56
download-only = true
mode = 0755
[template-nbd]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-nbd.cfg.in
...
...
@@ -97,4 +143,3 @@ url = ${:_profile_base_location_}/instance-frontend.cfg.in
md5sum = cdb690495e9eb007d2b7d2f8e12f5c59
output = ${buildout:directory}/template-frontend.cfg
mode = 0644
software/kvm/instance-kvm-export.cfg.in
0 → 100644
View file @
4fb9c5ff
[buildout]
extends = ${template-kvm:output}
${pbsready-export:output}
parts +=
cron-entry-backup
certificate-authority
publish-connection-information
kvm-promise
websockify-sighandler
novnc-promise
kvm-monitor
cron
cron-entry-monitor
frontend-promise
# Create the exporter executable, which is a simple shell script
[exporter]
recipe = slapos.recipe.template
url = ${template-kvm-export-script:location}/${template-kvm-export-script:filename}
output = $${directory:bin}/$${slap-parameter:namebase}-exporter
mode = 0755
backup-disk-path = $${directory:backup}/virtual.qcow2
# Resilient stack wants a "wrapper" parameter
wrapper = $${:output}
# Extends publish section with resilient parameters
[publish-connection-information]
<= resilient-publish-connection-parameter
software/kvm/instance-kvm-import.cfg.in
0 → 100644
View file @
4fb9c5ff
[buildout]
# Here, we don't need KVM to run to import data, so we don't
# even extend the kvm instance profile.
extends = ${pbsready-import:output}
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
bin = $${buildout:directory}/bin
srv = $${buildout:directory}/srv
var = $${buildout:directory}/var
log = $${:var}/log
scripts = $${:etc}/run
services = $${:etc}/service
promises = $${:etc}/promise
novnc-conf = $${:etc}/novnc
run = $${:var}/run
ca-dir = $${:srv}/ssl
cron-entries = $${:etc}/cron.d
crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
[importer]
recipe = slapos.recipe.template
url = ${template-kvm-import-script:location}/${template-kvm-import-script:filename}
output = $${directory:bin}/$${slap-parameter:namebase}-importer
mode = 0755
backup-disk-path = $${directory:backup}/virtual.qcow2
disk-path = $${directory:srv}/virtual.qcow2
# Resilient stack wants a "wrapper" parameter
wrapper = $${:output}
backup-disk-path = $${directory:backup}/virtual.qcow2
software/kvm/instance-kvm-resilient.cfg.jinja2
0 → 100644
View file @
4fb9c5ff
# vim: set ft=cfg:
{% import 'parts' as parts %}
{% import 'replicated' as replicated %}
[buildout]
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
# += because we need to take up parts (like instance-custom, slapmonitor etc) from the profile we extended
parts +=
{{ parts.replicate("kvm", "2") }}
publish-connection-informations
{{ replicated.replicate("kvm", "2", "kvm-export", "kvm-import") }}
# Bubble up/down the parameters
[request-kvm]
return =
# Resilient related parameters
url ssh-public-key ssh-url notification-id ip
# KVM related parameters
backend-url url
# XXX-Cedric: add all KVM parameters
config = number authorized-key notify ip-list namebase
# XXX-Cedric: add all KVM parameters
# config-disk-size =
[publish-connection-informations]
recipe = slapos.cookbook:publish
backend-url = ${request-kvm:connection-backend-url}
url = ${request-kvm:connection-url}
[slap-parameter]
# Default parameters for distributed deployment
# I.e state "backup1 of maria should go there, ..."
# XXX-Cedric: Hardcoded parameters. Should be dynamically generated.
# XXX-Cedric: add all KVM parameters
# config-disk-size =
software/kvm/instance.cfg.in
View file @
4fb9c5ff
...
...
@@ -13,3 +13,9 @@ kvm = ${template-kvm:output}
nbd = ${template-nbd:output}
frontend = ${template-frontend:output}
kvm-resilient = ${template-kvm-resilient:rendered}
kvm-import = ${template-kvm-import:output}
kvm-export = ${template-kvm-export:output}
frozen = ${instance-frozen:output}
pull-backup = ${template-pull-backup:output}
software/kvm/template/kvm-export.sh.in
0 → 100644
View file @
4fb9c5ff
#!/bin/bash
# Create a backup of the disk image of the virtual machine
QEMU_IMG
=
${
kvm
-instance
:qemu-img-path
}
SNAPSHOT_NAME
=
$(
date
+%s
)
DISK_PATH
=
${
kvm
-instance
:disk-path
}
BACKUP_PATH
=
${
:backup-disk-path
}
if
[
!
-f
$DISK_PATH
]
;
then
echo
"Nothing to backup, disk image doesn't exist yet."
exit
0
;
fi
$QEMU_IMG
snapshot
-c
$SNAPSHOT_NAME
$DISK_PATH
if
[
-f
$BACKUP_PATH
]
;
then
rm
$BACKUP_PATH
fi
$QEMU_IMG
convert
-f
qcow2
-O
qcow2
-s
$SNAPSHOT_NAME
$DISK_PATH
$BACKUP_PATH
$QEMU_IMG
snapshot
-d
$SNAPSHOT_NAME
$DISK_PATH
software/kvm/template/kvm-import.sh.in
0 → 100644
View file @
4fb9c5ff
#!/bin/bash
DISK_PATH
=
${
:disk-path
}
BACKUP_PATH
=
${
:backup-disk-path
}
# TODO: Use rdiff
rm
$DISK_PATH
cp
$BACKUP_PATH
$DISK_PATH
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment