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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos
Commits
0d16d5e8
Commit
0d16d5e8
authored
May 17, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm resilient: promise check disk corruption on kvm clone
Check that backup kvm disk is not corrupted
parent
d1f6c119
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
software/kvm/common.cfg
software/kvm/common.cfg
+3
-3
software/kvm/instance-kvm-import.cfg.jinja2.in
software/kvm/instance-kvm-import.cfg.jinja2.in
+21
-0
software/kvm/instance.cfg.in
software/kvm/instance.cfg.in
+1
-0
software/kvm/template/kvm-export.sh.jinja2
software/kvm/template/kvm-export.sh.jinja2
+1
-0
No files found.
software/kvm/common.cfg
View file @
0d16d5e8
...
@@ -89,7 +89,7 @@ command =
...
@@ -89,7 +89,7 @@ command =
[template]
[template]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
url = ${:_profile_base_location_}/instance.cfg.in
md5sum =
5c159864ce41394486867c27d65c2f50
md5sum =
01bad94ed1358b27d24a6f3745408f7d
output = ${buildout:directory}/template.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
mode = 0644
...
@@ -124,7 +124,7 @@ on-update = true
...
@@ -124,7 +124,7 @@ on-update = true
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
ignore-existing = true
ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm-import.cfg.jinja2.in
url = ${:_profile_base_location_}/instance-kvm-import.cfg.jinja2.in
md5sum =
5e21ad759c148d26134ecefbb4d3d9f1
md5sum =
30f74f1958bd77e647a1bbe70e286e5a
mode = 0644
mode = 0644
download-only = true
download-only = true
on-update = true
on-update = true
...
@@ -152,7 +152,7 @@ recipe = hexagonit.recipe.download
...
@@ -152,7 +152,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true
ignore-existing = true
url = ${:_profile_base_location_}/template/kvm-export.sh.jinja2
url = ${:_profile_base_location_}/template/kvm-export.sh.jinja2
filename = kvm-export.sh.jinja2
filename = kvm-export.sh.jinja2
md5sum =
c18e958bf374d5fa35dbb952686595fb
md5sum =
b617d64de73de1eed518185f310bbc82
download-only = true
download-only = true
mode = 0755
mode = 0755
...
...
software/kvm/instance-kvm-import.cfg.jinja2.in
View file @
0d16d5e8
...
@@ -4,6 +4,9 @@ eggs-directory = {{ eggs_directory }}
...
@@ -4,6 +4,9 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
offline = true
parts +=
kvm-disk-image-corruption-promise
# Here, we don't need KVM to run to import data, so we don't
# Here, we don't need KVM to run to import data, so we don't
# even extend the kvm instance profile.
# even extend the kvm instance profile.
extends =
extends =
...
@@ -59,3 +62,21 @@ context =
...
@@ -59,3 +62,21 @@ context =
raw gzip_binary {{ gzip_binary }}
raw gzip_binary {{ gzip_binary }}
backup-disk-path = ${directory:backup}/virtual.qcow2
backup-disk-path = ${directory:backup}/virtual.qcow2
[kvm-disk-image-corruption-promise]
# Check that disk image is not corrupted
recipe = collective.recipe.template
input = inline:#!/bin/sh
QEMU_IMAGE="${directory:srv}/virtual.qcow2"
if [ ! -s "$QEMU_IMAGE" ]; then
exit 0
fi
{{ qemu_location }}/bin/qemu-img check $QEMU_IMAGE
RETURN_CODE=$?
if [ $RETURN_CODE -eq 0 ] || [ $RETURN_CODE -eq 3 ]; then
exit 0
else
exit 1
fi
output = ${directory:promises}/kvm-disk-image-corruption
mode = 700
\ No newline at end of file
software/kvm/instance.cfg.in
View file @
0d16d5e8
...
@@ -149,6 +149,7 @@ extensions = jinja2.ext.do
...
@@ -149,6 +149,7 @@ extensions = jinja2.ext.do
context =
context =
key develop_eggs_directory buildout:develop-eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory
key eggs_directory buildout:eggs-directory
key qemu_location kvm:location
raw template_kvm_import ${template-kvm-import-script:location}/${template-kvm-import-script:filename}
raw template_kvm_import ${template-kvm-import-script:location}/${template-kvm-import-script:filename}
raw pbsready_import_template ${pbsready-import:output}
raw pbsready_import_template ${pbsready-import:output}
key slapparameter_dict slap-configuration:configuration
key slapparameter_dict slap-configuration:configuration
...
...
software/kvm/template/kvm-export.sh.jinja2
View file @
0d16d5e8
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#
#
# Create a backup of the disk image of the virtual machine
# Create a backup of the disk image of the virtual machine
#
#
set
-e
LC_ALL
=
C
LC_ALL
=
C
export
LC_ALL
export
LC_ALL
BACKUP_DIR
={{
directory[
'backup'
]
}}
BACKUP_DIR
={{
directory[
'backup'
]
}}
...
...
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