Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos-caddy
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
Guillaume Hervier
slapos-caddy
Commits
7bc73e50
Commit
7bc73e50
authored
Oct 14, 2014
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm: converted templates to jinja2
parent
3e0d0fb0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
41 deletions
+61
-41
software/kvm/common.cfg
software/kvm/common.cfg
+8
-8
software/kvm/development.cfg
software/kvm/development.cfg
+0
-1
software/kvm/instance-kvm-export.cfg.jinja2
software/kvm/instance-kvm-export.cfg.jinja2
+9
-6
software/kvm/instance-kvm-import.cfg.in
software/kvm/instance-kvm-import.cfg.in
+7
-7
software/kvm/template/kvm-export.sh.in
software/kvm/template/kvm-export.sh.in
+0
-12
software/kvm/template/kvm-export.sh.jinja2
software/kvm/template/kvm-export.sh.jinja2
+15
-0
software/kvm/template/kvm-import.sh.in
software/kvm/template/kvm-import.sh.in
+0
-7
software/kvm/template/kvm-import.sh.jinja2
software/kvm/template/kvm-import.sh.jinja2
+22
-0
No files found.
software/kvm/common.cfg
View file @
7bc73e50
...
...
@@ -115,15 +115,15 @@ on-update = true
[template-kvm-import]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm-import.cfg.in
md5sum =
7b36d6c61154b7ec3113a1bfaa25a904
md5sum =
98b1acc438895c0fa2309144a9a52a62
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
url = ${:_profile_base_location_}/template/kvm-import.sh.
jinja2
filename = kvm-import.sh.
jinja2
md5sum =
2178e7ef7f1b9ea6639bfbaf045e1feb
download-only = true
mode = 0755
...
...
@@ -131,15 +131,15 @@ mode = 0755
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/instance-kvm-export.cfg.jinja2
mode = 644
md5sum =
900f416956903fa4858e67e93b5169a1
md5sum =
4972bc6f6a4cb41c1820ac13a32915a8
download-only = true
on-update = true
[template-kvm-export-script]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/kvm-export.sh.
in
filename = kvm-export.sh.
in
md5sum =
95fde96f35cbf90d677c44d18b60faf
b
url = ${:_profile_base_location_}/template/kvm-export.sh.
jinja2
filename = kvm-export.sh.
jinja2
md5sum =
2e2a99e33e5cdde35833d164da1e325
b
download-only = true
mode = 0755
...
...
software/kvm/development.cfg
View file @
7bc73e50
...
...
@@ -40,4 +40,3 @@ command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.toolbox.egg-link &&
grep parts ${buildout:develop-eggs-directory}/erp5.util.egg-link
software/kvm/instance-kvm-export.cfg.jinja2
View file @
7bc73e50
...
...
@@ -17,13 +17,16 @@ parts +=
# Create the exporter executable, which is a simple shell script
[exporter]
recipe = slapos.recipe.template
url = {{ template_kvm_export }}
output = ${directory:bin}/${slap-parameter:namebase}-exporter
mode = 0755
backup-disk-path = ${directory:backup}/virtual.qcow2
recipe = slapos.recipe.template:jinja2
template = {{ template_kvm_export }}
rendered = ${directory:bin}/${slap-parameter:namebase}-exporter
# Resilient stack wants a "wrapper" parameter
wrapper = ${:output}
wrapper = ${:rendered}
mode = 0700
context =
section directory directory
section buildout buildout
key socket_path kvm-instance:socket-path
# Extends publish section with resilient parameters
[publish-connection-information]
...
...
software/kvm/instance-kvm-import.cfg.in
View file @
7bc73e50
...
...
@@ -25,13 +25,13 @@ 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
recipe = slapos.recipe.template:jinja2
template = ${template-kvm-import-script:location}/${template-kvm-import-script:filename}
rendered = $${directory:bin}/$${slap-parameter:namebase}-importer
mode = 0700
# Resilient stack wants a "wrapper" parameter
wrapper = $${:output}
wrapper = $${:rendered}
context =
section directory directory
backup-disk-path = $${directory:backup}/virtual.qcow2
software/kvm/template/kvm-export.sh.in
deleted
100644 → 0
View file @
3e0d0fb0
#!/bin/bash
# Create a backup of the disk image of the virtual machine
BACKUP_PATH
=
${
:backup-disk-path
}
QMP_CLIENT
=
${
buildout
:directory
}
/software_release/bin/qemu-qmp-client
if
[
!
-f
$DISK_PATH
]
;
then
echo
"Nothing to backup, disk image doesn't exist yet."
exit
0
;
fi
$QMP_CLIENT
--socket
${
kvm
-instance
:socket-path
}
--drive-backup
$BACKUP_PATH
software/kvm/template/kvm-export.sh.jinja2
0 → 100644
View file @
7bc73e50
#!/bin/bash
#
# Create a backup of the disk image of the virtual machine
#
LC_ALL
=
C
export
LC_ALL
BACKUP_DIR
={{
directory[
'backup'
]
}}
BACKUP_FILE
=
virtual.qcow2
QMP_CLIENT
={{
buildout[
'directory'
]
}}
/software_release/bin/qemu-qmp-client
$QMP_CLIENT
--socket
{{
socket_path
}}
--drive-backup
$BACKUP_DIR
/
$BACKUP_FILE
cd
$BACKUP_DIR
&&
find
-type
f
!
-name
backup.signature
-print0
| xargs
-P4
-0
sha256sum
|
LC_ALL
=
C
sort
-k
66
>
backup.signature
software/kvm/template/kvm-import.sh.in
deleted
100644 → 0
View file @
3e0d0fb0
#!/bin/bash
DISK_PATH
=
${
:disk-path
}
BACKUP_PATH
=
${
:backup-disk-path
}
# TODO: Use rdiff
rm
$DISK_PATH
cp
$BACKUP_PATH
$DISK_PATH
software/kvm/template/kvm-import.sh.jinja2
0 → 100644
View file @
7bc73e50
#!/bin/bash
VM_DIR
={{
directory[
'srv'
]
}}
BACKUP_DIR
={{
directory[
'backup'
]
}}
VM_FILE
=
virtual.qcow2
LC_ALL
=
C
export
LC_ALL
umask
077
write_backup_proof
()
{
cd
{{
directory[
'backup'
]
}}
find
-type
f
!
-name
backup.signature
!
-wholename
"./rdiff-backup-data/*"
-print0
| xargs
-P4
-0
sha256sum
|
LC_ALL
=
C
sort
-k
66
>
{{
directory[
'srv'
]
}}
/proof.signature
diff
-ruw
{{
directory[
'backup'
]
}}
{{
directory[
'srv'
]
}}
/proof.signature
>
{{
directory[
'srv'
]
}}
/backup.diff
}
# For now we just make the diff before
write_backup_proof
# TODO: Use rdiff
rm
$VM_DIR
/
$VM_FILE
cp
$BACKUP_DIR
/
$VM_FILE
$VM_DIR
/
$VM_FILE
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