Commit 8a3e7c39 authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge branch 'kvm'

parents b9d6bbb7 12701248
...@@ -56,7 +56,7 @@ configure-options = ...@@ -56,7 +56,7 @@ configure-options =
[debian-amd64-netinst.iso] [debian-amd64-netinst.iso]
# Download the installer of Debian 7 (Wheezy) # Download the installer of Debian 7 (Wheezy)
recipe = slapos.recipe.download recipe = hexagonit.recipe.download
url = http://cdimage.debian.org/debian-cd/7.1.0/amd64/iso-cd/debian-7.1.0-amd64-netinst.iso url = http://cdimage.debian.org/debian-cd/7.1.0/amd64/iso-cd/debian-7.1.0-amd64-netinst.iso
filename = ${:_buildout_section_name_} filename = ${:_buildout_section_name_}
md5sum = 80f498a1f9daa76bc911ae13692e4495 md5sum = 80f498a1f9daa76bc911ae13692e4495
......
...@@ -3,6 +3,7 @@ import logging ...@@ -3,6 +3,7 @@ import logging
import time import time
import slapos import slapos
from slapos.slap.slap import NotFoundError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
...@@ -58,8 +59,15 @@ def takeover(server_url, key_file, cert_file, computer_guid, ...@@ -58,8 +59,15 @@ def takeover(server_url, key_file, cert_file, computer_guid,
log.debug("Renaming {}: {}".format(cp_winner.getId(), cp_exporter_ref)) log.debug("Renaming {}: {}".format(cp_winner.getId(), cp_exporter_ref))
# update name (and later, software type) for the partition that will take over # update name (and later, software type) for the partition that will take over
while True:
time.sleep(10)
try:
cp_winner.rename(new_name=cp_exporter_ref) cp_winner.rename(new_name=cp_exporter_ref)
break
except NotFoundError:
log.warning('Impossible to rename. Retrying in a few seconds...')
log.debug('Renamed.')
cp_winner.bang(message='partitions have been renamed!') cp_winner.bang(message='partitions have been renamed!')
# Note: Root instance will reconfigure itself the winning instance (software_type # Note: Root instance will reconfigure itself the winning instance (software_type
# and parameters.) # and parameters.)
......
...@@ -79,7 +79,7 @@ command = ...@@ -79,7 +79,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 = 461187060d12a6bea4d5b9699687c0e9 #md5sum = bdd0495ef729e7272ec9c97aca919c09
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
mode = 0644 mode = 0644
...@@ -98,11 +98,11 @@ md5sum = 6753004b582c0470bd028253ce1964ad ...@@ -98,11 +98,11 @@ md5sum = 6753004b582c0470bd028253ce1964ad
download-only = true download-only = true
[template-kvm-resilient-test] [template-kvm-resilient-test]
recipe = slapos.recipe.template recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/instance-kvm-resilient-test.cfg.in url = ${:_profile_base_location_}/instance-kvm-resilient-test.cfg.jinja2
#md5sum = 9dead7572072307b6c38cdf47052225b md5sum = 027d68d9decbc6aec59365fa723975d7
output = ${buildout:directory}/template-kvm-resilient-test.cfg
mode = 0644 mode = 0644
download-only = true
[template-kvm-import] [template-kvm-import]
recipe = slapos.recipe.template recipe = slapos.recipe.template
...@@ -115,7 +115,7 @@ mode = 0644 ...@@ -115,7 +115,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/kvm-import.sh.in url = ${:_profile_base_location_}/template/kvm-import.sh.in
filename = kvm-import.sh.in filename = kvm-import.sh.in
md5sum = e03ed049cddd8d157228b09e1ebc071a md5sum = a731372420dc59c0b5ba7bc5f39a14ad
download-only = true download-only = true
mode = 0755 mode = 0755
...@@ -130,7 +130,7 @@ mode = 0644 ...@@ -130,7 +130,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/kvm-export.sh.in url = ${:_profile_base_location_}/template/kvm-export.sh.in
filename = kvm-export.sh.in filename = kvm-export.sh.in
md5sum = 08cd8da2221f09095b14e35e6acd2a56 md5sum = 3e878b3343c76f0d6950986fffcb6a8c
download-only = true download-only = true
mode = 0755 mode = 0755
......
...@@ -23,7 +23,7 @@ git-executable = ${git:location}/bin/git ...@@ -23,7 +23,7 @@ git-executable = ${git:location}/bin/git
[slapos.toolbox-repository] [slapos.toolbox-repository]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.toolbox.git repository = http://git.erp5.org/repos/slapos.toolbox.git
branch = master branch = kvmresiliency
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
[erp5.util-repository] [erp5.util-repository]
......
[buildout] [buildout]
eggs-directory = ${buildout:eggs-directory} eggs-directory = {{ eggs_directory }}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = {{ develop_eggs_directory }}
offline = true offline = true
parts = parts =
...@@ -10,45 +10,47 @@ parts = ...@@ -10,45 +10,47 @@ parts =
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/ home = ${buildout:directory}
var = $${buildout:directory}/var/ etc = ${:home}/etc/
srv = $${buildout:directory}/srv/ var = ${:home}/var/
bin = $${buildout:directory}/bin/ srv = ${:home}/srv/
tmp = $${buildout:directory}/tmp/ bin = ${:home}/bin/
tmp = ${:home}/tmp/
services = $${:etc}/service/ log = ${:var}/log/
scripts = $${:etc}/run/ services = ${:etc}/service/
scripts = ${:etc}/run/
[deploy-resiliency-test] [deploy-resiliency-test]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
#log-path = {directory:log} wrapper-path = ${directory:scripts}/runKVMResiliencyTestSuite
wrapper-path = $${directory:bin}/runKVMResiliencyTestSuite testnode-parameters = --test-result-path={{ slapparameter_dict.get('test-result-path') }} --revision={{ slapparameter_dict.get('test-suite-revision') }} --node-title={{ slapparameter_dict.get('scalability-launcher-title') }} --test-suite={{ slapparameter_dict.get('test-suite') }} --test-suite-master-url={{ slapparameter_dict.get('test-suite-master-url') }} --log-path=${directory:log}
#output = $${binary-wrap-launcher:binary-path} kvm-test-parameters = server_url=${slap-connection:server-url} key_file=${slap-connection:key-file} cert_file=${slap-connection:cert-file} computer_id=${slap-connection:computer-id} partition_id=${slap-connection:partition-id} software=${slap-connection:software-release-url} namebase=kvm kvm_rootinstance_name='${request-resilient-kvm:name}'
#site-id = "{site_id}"
# Suppose that there is a user zope family in the configuration command-line = {{ bin_directory }}/runResiliencyTest ${:testnode-parameters} ${:kvm-test-parameters}
#erp5-url = $${erp5-cluster:connection-family-user}{:site-id}
#parameters-extra = $*
command-line = ${buildout:bin-directory}/runKVMResiliencyTestSuite --server-url=$${slap-connection:server-url} --key-file=$${slap-connection:key-file} --cert-file=$${slap-connection:cert-file} --computer-id=$${slap-connection:computer-id} --partition-id=$${slap-connection:partition-id} --software=$${slap-connection:software-release-url} --namebase=kvm --kvm-rootinstance-name='$${request-resilient-kvm:name}' [deploy-standalone-resiliency-test]
#return = url # Used to manually run the KVM test if we don't have a running testnode.
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/runStandaloneKVMResiliencyTestSuite
command-line = {{ bin_directory }}/runStandaloneResiliencyTest --test-suite-title=kvm ${deploy-resiliency-test:kvm-test-parameters}
[request-resilient-kvm] [request-resilient-kvm]
<= slap-connection <= slap-connection
recipe = slapos.cookbook:request recipe = slapos.cookbook:request
software-url = $${slap-connection:software-release-url} software-url = ${slap-connection:software-release-url}
software-type = kvm-resilient software-type = kvm-resilient
name = Resilient KVM (Root Instance) name = Resilient KVM (Root Instance)
config = virtual-hard-drive-url virtual-hard-drive-md5sum resiliency-backup-periodicity config = virtual-hard-drive-url virtual-hard-drive-md5sum resiliency-backup-periodicity
config-virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url} config-virtual-hard-drive-url = ${slap-parameter:virtual-hard-drive-url}
config-virtual-hard-drive-md5sum = $${slap-parameter:virtual-hard-drive-md5sum} config-virtual-hard-drive-md5sum = ${slap-parameter:virtual-hard-drive-md5sum}
config-resiliency-backup-periodicity = */5 config-resiliency-backup-periodicity = */5
# We don't use url parameter, but we want it to be there to make sure root instance is ready. # We don't use url parameter, but we want it to be there to make sure root instance is ready.
return = url return = url
# XXX What to do? # XXX What to do?
#sla = instance_guid #sla = instance_guid
#sla-instance_guid = $${slap-parameter:frontend-instance-guid} #sla-instance_guid = ${slap-parameter:frontend-instance-guid}
[slap-parameter] [slap-parameter]
virtual-hard-drive-url = https://softinst43236.host.vifib.net/data/public/8e2138.php?dl=true virtual-hard-drive-url = https://softinst43236.host.vifib.net/data/public/8e2138.php?dl=true
virtual-hard-drive-md5sum = de0f10c7c6538e9928879332afd9be7a virtual-hard-drive-md5sum = de0f10c7c6538e9928879332afd9be7a
# XXX: what to do about pbs-kvm1-computer-guid and kvm1-computer-guid ?
...@@ -17,7 +17,7 @@ kvm-import = ${template-kvm-import:output} ...@@ -17,7 +17,7 @@ kvm-import = ${template-kvm-import:output}
kvm-export = ${template-kvm-export:output} kvm-export = ${template-kvm-export:output}
# Used for the test of resiliency. The system wants a "test" software_type. # Used for the test of resiliency. The system wants a "test" software_type.
test = ${template-kvm-resilient-test:output} test = $${dynamic-template-kvm-resilient-test:rendered}
frozen = ${instance-frozen:output} frozen = ${instance-frozen:output}
pull-backup = ${template-pull-backup:output} pull-backup = ${template-pull-backup:output}
...@@ -34,7 +34,7 @@ cert = $${slap-connection:cert-file} ...@@ -34,7 +34,7 @@ cert = $${slap-connection:cert-file}
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${template-kvm-resilient:location}/instance-kvm-resilient.cfg.jinja2 template = ${template-kvm-resilient:location}/instance-kvm-resilient.cfg.jinja2
rendered = $${buildout:directory}/template-kvm-resilient.cfg rendered = $${buildout:directory}/template-kvm-resilient.cfg
context = key buildout buildout:bin-directory 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 slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
...@@ -44,3 +44,14 @@ import-list = file parts :template-parts-destination ...@@ -44,3 +44,14 @@ import-list = file parts :template-parts-destination
file replicated :template-replicated-destination file replicated :template-replicated-destination
mode = 0644 mode = 0644
[dynamic-template-kvm-resilient-test]
recipe = slapos.recipe.template:jinja2
template = ${template-kvm-resilient-test:location}/instance-kvm-resilient-test.cfg.jinja2
rendered = $${buildout:directory}/template-kvm-resilient-test.cfg
bin-directory = ${buildout:bin-directory}
context =
key bin_directory dynamic-template-kvm-resilient-test:bin-directory
key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory
key slapparameter_dict slap-configuration:configuration
mode = 0644
...@@ -14,5 +14,5 @@ $QEMU_IMG snapshot -c $SNAPSHOT_NAME $DISK_PATH ...@@ -14,5 +14,5 @@ $QEMU_IMG snapshot -c $SNAPSHOT_NAME $DISK_PATH
if [ -f $BACKUP_PATH ]; then if [ -f $BACKUP_PATH ]; then
rm $BACKUP_PATH rm $BACKUP_PATH
fi fi
$QEMU_IMG convert -f qcow2 -O qcow2 -s $SNAPSHOT_NAME $DISK_PATH $BACKUP_PATH $QEMU_IMG convert -f qcow2 -O qcow2 -s $SNAPSHOT_NAME $DISK_PATH $BACKUP_PATH && \
$QEMU_IMG snapshot -d $SNAPSHOT_NAME $DISK_PATH $QEMU_IMG snapshot -d $SNAPSHOT_NAME $DISK_PATH
...@@ -3,5 +3,5 @@ DISK_PATH=${:disk-path} ...@@ -3,5 +3,5 @@ DISK_PATH=${:disk-path}
BACKUP_PATH=${:backup-disk-path} BACKUP_PATH=${:backup-disk-path}
# TODO: Use rdiff # TODO: Use rdiff
rm $DISK_PATH rm $DISK_PATH && \
cp $BACKUP_PATH $DISK_PATH cp $BACKUP_PATH $DISK_PATH
...@@ -84,4 +84,6 @@ output = ${buildout:directory}/instance-frozen.cfg ...@@ -84,4 +84,6 @@ output = ${buildout:directory}/instance-frozen.cfg
[versions] [versions]
# Pin Jinja2 to 2.6, as 2.7 breaks current code # Pin Jinja2 to 2.6, as 2.7 breaks current code
Jinja2 = 2.6 Jinja2 = 2.6
# ... And newer s.r.template requires Jinja2 >= 2.7
slapos.recipe.template = 2.4.2
...@@ -73,11 +73,11 @@ eggs = ...@@ -73,11 +73,11 @@ eggs =
[versions] [versions]
# Use SlapOS patched zc.buildout # Use SlapOS patched zc.buildout
zc.buildout = 1.6.0-dev-SlapOS-010 zc.buildout = 1.6.0-dev-SlapOS-012
# zc.recipe.egg 2.x is for Buildout 2 # zc.recipe.egg 2.x is for Buildout 2
zc.recipe.egg = 1.3.2 zc.recipe.egg = 1.3.2
# Use own version of h.r.download to be able to open xz-like archives # Use own version of h.r.download to be able to open xz-like archives
hexagonit.recipe.download = 1.6nxd002 hexagonit.recipe.download = 1.7nxd002
# Use pinned version of setuptools. Other versions work, but changing # Use pinned version of setuptools. Other versions work, but changing
# version makes buildout recompile everything. Developers' nightmare. # version makes buildout recompile everything. Developers' nightmare.
setuptools = 0.9.8 setuptools = 0.9.8
......
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