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
Labels
Merge Requests
113
Merge Requests
113
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
2c492506
Commit
2c492506
authored
Feb 11, 2025
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/kvm: Extract disk-image-corruption to template
parent
498d57b7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
18 deletions
+35
-18
software/kvm/buildout.hash.cfg
software/kvm/buildout.hash.cfg
+6
-2
software/kvm/instance-kvm.cfg.jinja2
software/kvm/instance-kvm.cfg.jinja2
+6
-16
software/kvm/instance.cfg.in
software/kvm/instance.cfg.in
+1
-0
software/kvm/software.cfg
software/kvm/software.cfg
+3
-0
software/kvm/template/disk-image-corruption.sh
software/kvm/template/disk-image-corruption.sh
+19
-0
No files found.
software/kvm/buildout.hash.cfg
View file @
2c492506
...
@@ -15,11 +15,11 @@
...
@@ -15,11 +15,11 @@
[template]
[template]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
09552cbd0da123f018ddd0fcd75f3507
md5sum =
5eccc2e9f207399cbeac762dce32dd7c
[template-kvm]
[template-kvm]
filename = instance-kvm.cfg.jinja2
filename = instance-kvm.cfg.jinja2
md5sum =
957f3a3c8e5f9a905026cc01a25b326e
md5sum =
8414431b20715cb9383b5577de9afdaf
[template-kvm-cluster]
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
filename = instance-kvm-cluster.cfg.jinja2.in
...
@@ -100,3 +100,7 @@ md5sum = d53afe719e2cbfc2480277af340f8429
...
@@ -100,3 +100,7 @@ md5sum = d53afe719e2cbfc2480277af340f8429
[check-backup-directory.sh]
[check-backup-directory.sh]
filename = template/check-backup-directory.sh
filename = template/check-backup-directory.sh
md5sum = e569494a941e1d585c2e0bbf070cf1c9
md5sum = e569494a941e1d585c2e0bbf070cf1c9
[disk-image-corruption.sh]
filename = template/disk-image-corruption.sh
md5sum = ae1f4eaf629243ea9e58c8895849e01a
software/kvm/instance-kvm.cfg.jinja2
View file @
2c492506
...
@@ -566,22 +566,12 @@ config-host = ${kvm-parameter-dict:vnc-ip}
...
@@ -566,22 +566,12 @@ config-host = ${kvm-parameter-dict:vnc-ip}
config-port = ${kvm-parameter-dict:vnc-websocket-port}
config-port = ${kvm-parameter-dict:vnc-websocket-port}
[kvm-disk-image-corruption-bin]
[kvm-disk-image-corruption-bin]
recipe = collective.recipe.template
recipe = slapos.recipe.template:jinja2
input = inline:#!/bin/sh
url = {{ disk_image_corruption }}
# Return code 0 is "OK"
context =
# Return code 3 is "found leaks, but image is OK"
key disk_device_path slap-parameter:disk-device-path
# http://git.qemu.org/?p=qemu.git;a=blob;f=qemu-img.c;h=4e9a7f5741c9cb863d978225829e68fefcae3947;hb=HEAD#l702
key qemu_img_path kvm-parameter-dict:qemu-img-path
if [ "${slap-parameter:disk-device-path}" != "" ]; then
key disk_path kvm-parameter-dict:disk-path
# disk device option is used, skip qemu img check
exit 0
fi
${kvm-parameter-dict:qemu-img-path} check -U ${kvm-parameter-dict:disk-path} > /dev/null 2>&1
RETURN_CODE=$?
if [ $RETURN_CODE -eq 0 ] || [ $RETURN_CODE -eq 3 ]; then
exit 0
else
exit 1
fi
output = ${directory:bin}/kvm-disk-image-corruption
output = ${directory:bin}/kvm-disk-image-corruption
mode = 700
mode = 700
...
...
software/kvm/instance.cfg.in
View file @
2c492506
...
@@ -101,6 +101,7 @@ extra-context =
...
@@ -101,6 +101,7 @@ extra-context =
raw template_nginx ${template-nginx:target}
raw template_nginx ${template-nginx:target}
raw websockify_executable_location ${buildout:directory}/bin/websockify
raw websockify_executable_location ${buildout:directory}/bin/websockify
raw wipe_disk_wrapper ${buildout:directory}/bin/securedelete
raw wipe_disk_wrapper ${buildout:directory}/bin/securedelete
raw disk_image_corruption ${disk-image-corruption.sh:target}
template-parts-destination = ${template-parts:target}
template-parts-destination = ${template-parts:target}
template-replicated-destination = ${template-replicated:target}
template-replicated-destination = ${template-replicated:target}
import-list = file parts :template-parts-destination
import-list = file parts :template-parts-destination
...
...
software/kvm/software.cfg
View file @
2c492506
...
@@ -147,3 +147,6 @@ context =
...
@@ -147,3 +147,6 @@ context =
[check-backup-directory.sh]
[check-backup-directory.sh]
<= template-base
<= template-base
output = ${buildout:parts-directory}/${:_buildout_section_name_}/check-backup-directory.sh
output = ${buildout:parts-directory}/${:_buildout_section_name_}/check-backup-directory.sh
[disk-image-corruption.sh]
<= download-base
software/kvm/template/disk-image-corruption.sh
0 → 100644
View file @
2c492506
#!/bin/sh
if
[
"{{ disk_device_path }}"
!=
""
]
;
then
# disk device option is used, skip qemu img check
exit
0
fi
if
[
!
-s
"{{ disk_path }}"
]
;
then
exit
0
fi
{{
qemu_img_path
}}
check
-U
{{
disk_path
}}
>
/dev/null 2>&1
RETURN_CODE
=
$?
# Return code 0 is "OK"
# Return code 3 is "found leaks, but image is OK"
# http://git.qemu.org/?p=qemu.git;a=blob;f=qemu-img.c;h=4e9a7f5741c9cb863d978225829e68fefcae3947;hb=HEAD#l702
if
[
$RETURN_CODE
-eq
0
]
||
[
$RETURN_CODE
-eq
3
]
;
then
exit
0
else
exit
1
fi
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