Commit bd813a0d authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

software/kvm: Switch to monitor-promise-base

parent f0802513
...@@ -19,19 +19,19 @@ md5sum = 2cbfd6b08c65369c1d45cf3ba2ff335a ...@@ -19,19 +19,19 @@ md5sum = 2cbfd6b08c65369c1d45cf3ba2ff335a
[template-kvm] [template-kvm]
filename = instance-kvm.cfg.jinja2 filename = instance-kvm.cfg.jinja2
md5sum = bcd3705e510da52e7ddf1e1527839642 md5sum = c4919f64073f99b179b3cfe348d26b6f
[template-kvm-cluster] [template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in filename = instance-kvm-cluster.cfg.jinja2.in
md5sum = 352f18067714501c8ccee55f8930d245 md5sum = 2e743132ba4e001f784791311df9ba6a
[template-kvm-resilient] [template-kvm-resilient]
filename = instance-kvm-resilient.cfg.jinja2 filename = instance-kvm-resilient.cfg.jinja2
md5sum = 6677ac6074f6be671fe8e8b8a6a4afe8 md5sum = 90b14c5df6ecae01b9e6b0836c6941e6
[template-kvm-import] [template-kvm-import]
filename = instance-kvm-import.cfg.jinja2.in filename = instance-kvm-import.cfg.jinja2.in
md5sum = dc3f3ad9ebd8b3b5c3ded57b91cee9c7 md5sum = a996ca557832deb2ac347edbec47a403
[template-kvm-import-script] [template-kvm-import-script]
filename = template/kvm-import.sh.jinja2 filename = template/kvm-import.sh.jinja2
...@@ -47,7 +47,7 @@ md5sum = b617d64de73de1eed518185f310bbc82 ...@@ -47,7 +47,7 @@ md5sum = b617d64de73de1eed518185f310bbc82
[template-nbd] [template-nbd]
filename = instance-nbd.cfg.in filename = instance-nbd.cfg.in
md5sum = f634a5249b773658b7a7bc9fa9bb0368 md5sum = a05b581d65768ac55faf3b06d4aec447
[template-ansible-promise] [template-ansible-promise]
filename = template/ansible-promise.in filename = template/ansible-promise.in
...@@ -79,4 +79,4 @@ md5sum = 599dbbbd438fe7801e3f8642ae9e9a78 ...@@ -79,4 +79,4 @@ md5sum = 599dbbbd438fe7801e3f8642ae9e9a78
[template-httpd] [template-httpd]
filename = instance-kvm-http.cfg.in filename = instance-kvm-http.cfg.in
md5sum = 26a181a48046ce88570adb32334747ef md5sum = e8332b69804bd22daff1816ef8a2600b
...@@ -229,7 +229,6 @@ log = ${:var}/log ...@@ -229,7 +229,6 @@ log = ${:var}/log
scripts = ${:etc}/run scripts = ${:etc}/run
services = ${:etc}/service services = ${:etc}/service
webroot = ${:srv}/document webroot = ${:srv}/document
promises = ${:etc}/promise
ssl = ${:etc}/ssl ssl = ${:etc}/ssl
[directory-doc] [directory-doc]
......
...@@ -14,7 +14,6 @@ public = ${:srv}/public/ ...@@ -14,7 +14,6 @@ public = ${:srv}/public/
log = ${:var}/log log = ${:var}/log
services = ${:etc}/service services = ${:etc}/service
scripts = ${:etc}/run scripts = ${:etc}/run
promises = ${:etc}/promise
run = ${:var}/run run = ${:var}/run
document = ${:srv}/document document = ${:srv}/document
ssl = ${:etc}/ssl ssl = ${:etc}/ssl
...@@ -65,7 +64,9 @@ update-command = ...@@ -65,7 +64,9 @@ update-command =
stop-on-error = true stop-on-error = true
[httpd-promise] [httpd-promise]
<= monitor-promise-base
module = check_port_listening
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
path = ${directory:promises}/apache-httpd name = apache_httpd.py
hostname = ${apache-conf:ip} config-hostname = ${apache-conf:ip}
port = ${apache-conf:port} config-port = ${apache-conf:port}
\ No newline at end of file
...@@ -41,7 +41,6 @@ var = ${buildout:directory}/var ...@@ -41,7 +41,6 @@ var = ${buildout:directory}/var
log = ${:var}/log log = ${:var}/log
scripts = ${:etc}/run scripts = ${:etc}/run
services = ${:etc}/service services = ${:etc}/service
promises = ${:etc}/promise
novnc-conf = ${:etc}/novnc novnc-conf = ${:etc}/novnc
run = ${:var}/run run = ${:var}/run
ca-dir = ${:srv}/ssl ca-dir = ${:srv}/ssl
...@@ -63,8 +62,7 @@ context = ...@@ -63,8 +62,7 @@ context =
backup-disk-path = ${directory:backup}/virtual.qcow2 backup-disk-path = ${directory:backup}/virtual.qcow2
[kvm-disk-image-corruption-promise] [kvm-disk-image-corruption-bin]
# Check that disk image is not corrupted
recipe = collective.recipe.template recipe = collective.recipe.template
input = inline:#!/bin/sh input = inline:#!/bin/sh
QEMU_IMAGE="${directory:srv}/virtual.qcow2" QEMU_IMAGE="${directory:srv}/virtual.qcow2"
...@@ -78,5 +76,13 @@ input = inline:#!/bin/sh ...@@ -78,5 +76,13 @@ input = inline:#!/bin/sh
else else
exit 1 exit 1
fi fi
output = ${directory:promises}/kvm-disk-image-corruption output = ${directory:bin}/kvm-disk-image-corruption
mode = 700 mode = 700
[kvm-disk-image-corruption-promise]
# Check that disk image is not corrupted
<= monitor-promise-base
module = check_command_execute
recipe = slapos.cookbook:check_port_listening
name = kvm_disk_image_corruption.py
config-command = ${kvm-disk-image-corruption-bin:output}
...@@ -57,7 +57,6 @@ cors-domains = {{ monitor_parameter.get('monitor-cors-domains', '') }} ...@@ -57,7 +57,6 @@ cors-domains = {{ monitor_parameter.get('monitor-cors-domains', '') }}
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc etc = ${buildout:directory}/etc
promises = ${:etc}/promise
# Bubble down the parameters of the requested instance to the user # Bubble down the parameters of the requested instance to the user
[request-kvm] [request-kvm]
...@@ -83,21 +82,26 @@ monitor-base-url = ${monitor-publish-parameters:monitor-base-url} ...@@ -83,21 +82,26 @@ monitor-base-url = ${monitor-publish-parameters:monitor-base-url}
monitor-setup-url = {{ monitor_interface_url }}/#page=settings_configurator&url=${monitor-publish-parameters:monitor-url}&username=${monitor-publish-parameters:monitor-user}&password=${publish-early:monitor-password} monitor-setup-url = {{ monitor_interface_url }}/#page=settings_configurator&url=${monitor-publish-parameters:monitor-url}&username=${monitor-publish-parameters:monitor-user}&password=${publish-early:monitor-password}
{% endif -%} {% endif -%}
[kvm-frontend-url-promise] [kvm-frontend-url-bin]
# Check that url parameter is complete
recipe = collective.recipe.template recipe = collective.recipe.template
input = inline:#!/bin/sh input = inline:#!/bin/sh
URL="${request-kvm:connection-url}" URL="${request-kvm:connection-url}"
if [[ ! "$URL" == https://* ]]; then if [[ ! "$URL" == https://* ]]; then
exit 1 exit 1
fi fi
output = ${resilient-directory:promise}/kvm-frontend-url output = ${directory:bin}/kvm-frontend-url
mode = 700 mode = 700
[kvm-frontend-url-promise]
# Check that url parameter is complete
<= monitor-promise-base
module = check_command_execute
name = kvm_frontend_url.py
config-command = ${kvm-frontend-url-bin:output}
[kvm-backend-url-promise] [kvm-backend-url-promise]
# Check that backend url is reachable # Check that backend url is reachable
recipe = slapos.cookbook:check_url_available <= monitor-promise-base
path = ${directory:promises}/frontend_promise module = check_url_available
url = ${publish-connection-information:url} name = frontend_promise.py
dash_path = /bin/sh config-url = ${publish-connection-information:url}
curl_path = {{ curl_executable_location }}
...@@ -40,7 +40,6 @@ var = ${buildout:directory}/var ...@@ -40,7 +40,6 @@ var = ${buildout:directory}/var
log = ${:var}/log log = ${:var}/log
scripts = ${:etc}/run scripts = ${:etc}/run
services = ${:etc}/service services = ${:etc}/service
promises = ${:etc}/promise
novnc-conf = ${:etc}/novnc novnc-conf = ${:etc}/novnc
run = ${:var}/run run = ${:var}/run
prerm = ${:etc}/prerm prerm = ${:etc}/prerm
...@@ -216,13 +215,13 @@ command-line = ${kvm-controller:rendered} ...@@ -216,13 +215,13 @@ command-line = ${kvm-controller:rendered}
[kvm-vnc-promise] [kvm-vnc-promise]
recipe = slapos.cookbook:check_port_listening <= monitor-promise-base
path = ${directory:promises}/vnc_promise module = check_port_listening
hostname = ${kvm-parameter-dict:vnc-ip} name = vnc_promise.py
port = ${kvm-parameter-dict:vnc-port} config-hostname = ${kvm-parameter-dict:vnc-ip}
config-port = ${kvm-parameter-dict:vnc-port}
[kvm-disk-image-corruption-promise] [kvm-disk-image-corruption-bin]
# Check that disk image is not corrupted
recipe = collective.recipe.template recipe = collective.recipe.template
input = inline:#!/bin/sh input = inline:#!/bin/sh
# Return code 0 is "OK" # Return code 0 is "OK"
...@@ -239,9 +238,16 @@ input = inline:#!/bin/sh ...@@ -239,9 +238,16 @@ input = inline:#!/bin/sh
else else
exit 1 exit 1
fi fi
output = ${directory:promises}/kvm-disk-image-corruption output = ${directory:bin}/kvm-disk-image-corruption
mode = 700 mode = 700
[kvm-disk-image-corruption-promise]
# Check that disk image is not corrupted
<= monitor-promise-base
module = check_command_execute
name = kvm_disk_image_corruption.py
config-command = ${kvm-disk-image-corruption-bin:output}
{% if wipe_disk == 'true' -%} {% if wipe_disk == 'true' -%}
{% do part_list.append('wipe-disk-wrapper') -%} {% do part_list.append('wipe-disk-wrapper') -%}
{% set wipe_file_list = '${kvm-parameter-dict:disk-path}' -%} {% set wipe_file_list = '${kvm-parameter-dict:disk-path}' -%}
...@@ -255,16 +261,22 @@ command-line = ...@@ -255,16 +261,22 @@ command-line =
{{ wipe_disk_wrapper }} -n {{ slapparameter_dict.get('wipe-disk-iterations', 1) }} -suz --check-pid-file ${kvm-parameter-dict:pid-file-path} --file {{ wipe_file_list }} {{ wipe_disk_wrapper }} -n {{ slapparameter_dict.get('wipe-disk-iterations', 1) }} -suz --check-pid-file ${kvm-parameter-dict:pid-file-path} --file {{ wipe_file_list }}
{% endif -%} {% endif -%}
[kvm-started-promise] [kvm-started-bin]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = {{ qemu_start_promise_tpl }} template = {{ qemu_start_promise_tpl }}
rendered = ${directory:promises}/qemu-virtual-machine-is-ready rendered = ${directory:bin}/qemu-virtual-machine-is-ready
mode = 700 mode = 700
context = context =
raw dash {{ dash_executable_location }} raw dash {{ dash_executable_location }}
raw qemu_ready_path ${kvm-controller-parameter-dict:kvm-status-path} raw qemu_ready_path ${kvm-controller-parameter-dict:kvm-status-path}
raw qemu_service_log_file ${buildout:directory}/.${slap-connection:partition-id}_kvm.log raw qemu_service_log_file ${buildout:directory}/.${slap-connection:partition-id}_kvm.log
[kvm-started-promise]
<= monitor-promise-base
module = check_command_execute
name = qemu_virtual_machine_is_ready.py
config-command = ${kvm-started-bin:rendered}
[novnc-instance] [novnc-instance]
recipe = slapos.cookbook:novnc recipe = slapos.cookbook:novnc
path = ${ca-novnc:executable} path = ${ca-novnc:executable}
...@@ -325,10 +337,11 @@ executable = ${directory:bin}/novnc ...@@ -325,10 +337,11 @@ executable = ${directory:bin}/novnc
wrapper = ${directory:bin}/websockify wrapper = ${directory:bin}/websockify
[novnc-promise] [novnc-promise]
recipe = slapos.cookbook:check_port_listening <= monitor-promise-base
path = ${directory:promises}/novnc_promise module = check_port_listening
hostname = ${novnc-instance:ip} name = novnc_promise.py
port = ${novnc-instance:port} config-hostname = ${novnc-instance:ip}
config-port = ${novnc-instance:port}
#---------------- #----------------
...@@ -380,11 +393,10 @@ name = ${slap-parameter:frontend-instance-name} ...@@ -380,11 +393,10 @@ name = ${slap-parameter:frontend-instance-name}
sla-instance_guid = ${slap-parameter:frontend-instance-guid} sla-instance_guid = ${slap-parameter:frontend-instance-guid}
[frontend-promise] [frontend-promise]
recipe = slapos.cookbook:check_url_available <= monitor-promise-base
path = ${directory:promises}/frontend_promise module = check_url_available
url = ${publish-connection-information:url} name = frontend_promise.py
dash_path = {{ dash_executable_location }} config-url = ${publish-connection-information:url}
curl_path = {{ curl_executable_location }}
{% if additional_frontend %} {% if additional_frontend %}
[request-slave-frontend-additional] [request-slave-frontend-additional]
...@@ -419,10 +431,11 @@ wrapper-path = ${directory:services}/http-server ...@@ -419,10 +431,11 @@ wrapper-path = ${directory:services}/http-server
hash-existing-files = ${buildout:directory}/software_release/buildout.cfg hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
[httpd-promise] [httpd-promise]
recipe = slapos.cookbook:check_port_listening <= monitor-promise-base
path = ${directory:promises}/httpd module = check_port_listening
hostname = ${httpd:host} name = httpd.py
port = ${httpd:port} config-hostname = ${httpd:host}
config-port = ${httpd:port}
{% endif %} {% endif %}
[monitor-instance-parameter] [monitor-instance-parameter]
...@@ -679,15 +692,21 @@ command-line = ${tunnel-cluster-url:runner-path} ...@@ -679,15 +692,21 @@ command-line = ${tunnel-cluster-url:runner-path}
wrapper-path = ${directory:services}/6tunnel-cluster wrapper-path = ${directory:services}/6tunnel-cluster
hash-existing-files = ${buildout:directory}/software_release/buildout.cfg hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
[ansible-vm-promise] [ansible-vm-bin]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = {{ ansible_promise_tpl }} template = {{ ansible_promise_tpl }}
rendered = ${directory:promises}/ansible_{{ name }} rendered = ${directory:bin}/ansible_{{ name }}
extensions = jinja2.ext.do extensions = jinja2.ext.do
context = context =
raw logs ${directory:public}/ansible raw logs ${directory:public}/ansible
raw name {{ name }} raw name {{ name }}
[ansible-vm-promise]
<= monitor-promise-base
module = check_execute_comand
name = ansible_{{ name }}.py
config-command = ${ansible-vm-bin:rendered}
[download-bootstrap-script] [download-bootstrap-script]
recipe = plone.recipe.command recipe = plone.recipe.command
file-location = ${directory:public}/vm-bootstrap file-location = ${directory:public}/vm-bootstrap
......
...@@ -23,7 +23,6 @@ log = $${buildout:directory}/log ...@@ -23,7 +23,6 @@ log = $${buildout:directory}/log
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run services = $${rootdirectory:etc}/run
watched-services = $${rootdirectory:etc}/service watched-services = $${rootdirectory:etc}/service
promises = $${rootdirectory:etc}/promise
[nbd-instance] [nbd-instance]
recipe = slapos.cookbook:nbdserver recipe = slapos.cookbook:nbdserver
...@@ -36,10 +35,11 @@ shell-path = ${dash:location}/bin/dash ...@@ -36,10 +35,11 @@ shell-path = ${dash:location}/bin/dash
path = $${basedirectory:services}/nbdserver path = $${basedirectory:services}/nbdserver
[nbd-promise] [nbd-promise]
recipe = slapos.cookbook:check_port_listening <= monitor-promise-base
path = $${basedirectory:promises}/nbd_promise module = check_port_listening
hostname = $${nbd-instance:ip} name = nbd_promise.py
port = $${nbd-instance:port} config-hostname = $${nbd-instance:ip}
config-port = $${nbd-instance:port}
[gen-passwd] [gen-passwd]
recipe = slapos.cookbook:generate.password recipe = slapos.cookbook:generate.password
...@@ -58,10 +58,11 @@ path = $${basedirectory:watched-services}/onetimeupload ...@@ -58,10 +58,11 @@ path = $${basedirectory:watched-services}/onetimeupload
key = $${gen-passwd:passwd} key = $${gen-passwd:passwd}
[onetimeupload-promise] [onetimeupload-promise]
recipe = slapos.cookbook:check_port_listening <= monitor-promise-base
path = $${basedirectory:promises}/onetimeupload_promise module = check_port_listening
hostname = $${onetimeupload-instance:ip} name = onetimeupload_promise.py
port = $${onetimeupload-instance:port} config-hostname = $${onetimeupload-instance:ip}
config-port = $${onetimeupload-instance:port}
[publish-connection-information] [publish-connection-information]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
......
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