Commit aedf00a9 authored by Guillaume Hervier's avatar Guillaume Hervier Committed by Rafael Monnerat

software/kvm: auto-restart services on SR upgrade.

parent 45ad5918
...@@ -124,7 +124,7 @@ qemu-path = {{ qemu_executable_location }} ...@@ -124,7 +124,7 @@ qemu-path = {{ qemu_executable_location }}
qemu-img-path = {{ qemu_img_executable_location }} qemu-img-path = {{ qemu_img_executable_location }}
etc-directory = ${directory:etc} etc-directory = ${directory:etc}
disk-storage-list = disk-storage-list =
{% for key, path in storage_dict.items() -%} {% for key, path in storage_dict.items() -%}
{{ ' ' ~ key ~ ' ' ~ path }} {{ ' ' ~ key ~ ' ' ~ path }}
{% endfor -%} {% endfor -%}
...@@ -143,7 +143,7 @@ httpd-port = 0 ...@@ -143,7 +143,7 @@ httpd-port = 0
cluster-doc-host = ${tunnel-cluster-url:ipv4} cluster-doc-host = ${tunnel-cluster-url:ipv4}
cluster-doc-port = ${tunnel-cluster-url:ipv4-port} cluster-doc-port = ${tunnel-cluster-url:ipv4-port}
{% else -%} {% else -%}
cluster-doc-host = cluster-doc-host =
cluster-doc-port = 0 cluster-doc-port = 0
{% endif -%} {% endif -%}
netcat-binary = {{ netcat_bin }} netcat-binary = {{ netcat_bin }}
...@@ -163,7 +163,7 @@ recipe = slapos.recipe.template:jinja2 ...@@ -163,7 +163,7 @@ recipe = slapos.recipe.template:jinja2
template = {{ template_kvm_run }} template = {{ template_kvm_run }}
rendered = ${directory:bin}/kvm_raw rendered = ${directory:bin}/kvm_raw
mode = 700 mode = 700
context = context =
section parameter_dict kvm-parameter-dict section parameter_dict kvm-parameter-dict
[kvm-controller] [kvm-controller]
...@@ -171,7 +171,7 @@ recipe = slapos.recipe.template:jinja2 ...@@ -171,7 +171,7 @@ recipe = slapos.recipe.template:jinja2
template = {{ template_kvm_controller_run }} template = {{ template_kvm_controller_run }}
rendered = ${directory:bin}/kvm_controller_raw rendered = ${directory:bin}/kvm_controller_raw
mode = 700 mode = 700
context = context =
section parameter_dict kvm-controller-parameter-dict section parameter_dict kvm-controller-parameter-dict
[tunnel-6to4-base] [tunnel-6to4-base]
...@@ -180,6 +180,7 @@ ipv4 = ${slap-network-information:local-ipv4} ...@@ -180,6 +180,7 @@ ipv4 = ${slap-network-information:local-ipv4}
ipv6 = ${slap-network-information:global-ipv6} ipv6 = ${slap-network-information:global-ipv6}
wrapper-path = ${directory:services}/6tunnel-${:ipv6-port} wrapper-path = ${directory:services}/6tunnel-${:ipv6-port}
command-line = {{ sixtunnel_executable_location }} -6 -4 -d -l ${:ipv6} ${:ipv6-port} ${:ipv4} ${:ipv4-port} command-line = {{ sixtunnel_executable_location }} -6 -4 -d -l ${:ipv6} ${:ipv6-port} ${:ipv4} ${:ipv4-port}
hash-files = ${buildout:directory}/software_release/buildout.cfg
{% if use_nat == 'true' and nat_rule_list -%} {% if use_nat == 'true' and nat_rule_list -%}
{% for port in nat_rule_list.split(' ') -%} {% for port in nat_rule_list.split(' ') -%}
...@@ -199,6 +200,7 @@ socket-path = ${kvm-controller-parameter-dict:socket-path} ...@@ -199,6 +200,7 @@ socket-path = ${kvm-controller-parameter-dict:socket-path}
wrapper-path = ${directory:services}/kvm wrapper-path = ${directory:services}/kvm
command-line = ${kvm-run:rendered} command-line = ${kvm-run:rendered}
kvm-controller = ${kvm-controller-wrapper:wrapper-path} kvm-controller = ${kvm-controller-wrapper:wrapper-path}
hash-files = ${buildout:directory}/software_release/buildout.cfg
[kvm-controller-wrapper] [kvm-controller-wrapper]
...@@ -239,7 +241,7 @@ mode = 700 ...@@ -239,7 +241,7 @@ mode = 700
[wipe-disk-wrapper] [wipe-disk-wrapper]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:prerm}/slapos_wipe_qemu_disk wrapper-path = ${directory:prerm}/slapos_wipe_qemu_disk
command-line = 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 -%}
...@@ -248,7 +250,7 @@ recipe = slapos.recipe.template:jinja2 ...@@ -248,7 +250,7 @@ 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:promises}/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
...@@ -267,20 +269,32 @@ ssl-cert-path = ${ca-novnc:cert-file} ...@@ -267,20 +269,32 @@ ssl-cert-path = ${ca-novnc:cert-file}
[websockify-sighandler] [websockify-sighandler]
recipe = slapos.cookbook:signalwrapper recipe = slapos.cookbook:signalwrapper
wrapper-path = ${directory:services}/websockify wrapper-path = ${directory:bin}/websockify-sighandler
wrapped-path = ${novnc-instance:path} wrapped-path = ${novnc-instance:path}
[websockify-sighandler-service]
recipe = slapos.cookbook:wrapper
command-line = ${websockify-sighandler:wrapper-path}
wrapper-path = ${directory:services}/websockify
hash-files = ${buildout:directory}/software_release/buildout.cfg
[certificate-authority] [certificate-authority]
recipe = slapos.cookbook:certificate_authority recipe = slapos.cookbook:certificate_authority
openssl-binary = {{ openssl_executable_location }} openssl-binary = {{ openssl_executable_location }}
ca-dir = ${directory:ca-dir} ca-dir = ${directory:ca-dir}
requests-directory = ${cadirectory:requests} requests-directory = ${cadirectory:requests}
wrapper = ${directory:services}/certificate_authority wrapper = ${directory:bin}/certificate_authority
ca-private = ${cadirectory:private} ca-private = ${cadirectory:private}
ca-certs = ${cadirectory:certs} ca-certs = ${cadirectory:certs}
ca-newcerts = ${cadirectory:newcerts} ca-newcerts = ${cadirectory:newcerts}
ca-crl = ${cadirectory:crl} ca-crl = ${cadirectory:crl}
[certificate-authority-service]
recipe = slapos.cookbook:wrapper
command-line = ${certificate-authority:wrapper}
wrapper-path = ${directory:services}/certificate_authority
hash-files = ${buildout:directory}/software_release/buildout.cfg
[cadirectory] [cadirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
requests = ${directory:ca-dir}/requests/ requests = ${directory:ca-dir}/requests/
...@@ -315,7 +329,13 @@ cron-entries = ${directory:cron-entries} ...@@ -315,7 +329,13 @@ cron-entries = ${directory:cron-entries}
crontabs = ${directory:crontabs} crontabs = ${directory:crontabs}
cronstamps = ${directory:cronstamps} cronstamps = ${directory:cronstamps}
catcher = ${cron-simplelogger:wrapper} catcher = ${cron-simplelogger:wrapper}
binary = ${directory:services}/crond binary = ${directory:bin}/crond_raw
[cron-service]
recipe = slapos.cookbook:wrapper
command-line = ${cron:binary}
wrapper-path = ${directory:services}/crond
hash-files = ${buildout:directory}/software_release/buildout.cfg
[cron-simplelogger] [cron-simplelogger]
recipe = slapos.cookbook:simplelogger recipe = slapos.cookbook:simplelogger
...@@ -356,10 +376,16 @@ recipe = slapos.cookbook:simplehttpserver ...@@ -356,10 +376,16 @@ recipe = slapos.cookbook:simplehttpserver
host = ${slap-network-information:local-ipv4} host = ${slap-network-information:local-ipv4}
port = ${slap-parameter:httpd-port} port = ${slap-parameter:httpd-port}
base-path = ${directory:public} base-path = ${directory:public}
wrapper = ${directory:services}/http-server wrapper = ${directory:bin}/http-server
log-file = ${directory:log}/httpd.log log-file = ${directory:log}/httpd.log
use-hash-url = false use-hash-url = false
[httpd-service]
recipe = slapos.cookbook:wrapper
command-line = ${httpd:wrapper}
wrapper-path = ${directory:services}/http-server
hash-files = ${buildout:directory}/software_release/buildout.cfg
[httpd-promise] [httpd-promise]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
path = ${directory:promises}/httpd path = ${directory:promises}/httpd
...@@ -440,7 +466,7 @@ route-default = ip route add {{ global_ipv4_prefix }} via ${slap-network-informa ...@@ -440,7 +466,7 @@ route-default = ip route add {{ global_ipv4_prefix }} via ${slap-network-informa
{% else -%} {% else -%}
route-default = route-default =
{% endif -%} {% endif -%}
command = command =
echo "#!/bin/sh" > ${:path} echo "#!/bin/sh" > ${:path}
echo "" >> ${:path} echo "" >> ${:path}
echo "${:ifconfig}" >> ${:path} echo "${:ifconfig}" >> ${:path}
...@@ -493,7 +519,7 @@ path-ip = ${directory:public}/ipv4 ...@@ -493,7 +519,7 @@ path-ip = ${directory:public}/ipv4
path-gateway = ${directory:public}/gateway path-gateway = ${directory:public}/gateway
path-network = ${directory:public}/network path-network = ${directory:public}/network
path-netmask = ${directory:public}/netmask path-netmask = ${directory:public}/netmask
command = command =
rm -f ${:path-host} rm -f ${:path-host}
rm -f ${:path-ip} rm -f ${:path-ip}
rm -f ${:path-gateway} rm -f ${:path-gateway}
...@@ -526,7 +552,13 @@ ipv6-port = {{ slapparameter_dict.get('document-port', '') }} ...@@ -526,7 +552,13 @@ ipv6-port = {{ slapparameter_dict.get('document-port', '') }}
ipv4-port = 16936 ipv4-port = 16936
shell-path = {{ dash_executable_location }} shell-path = {{ dash_executable_location }}
6tunnel-path = {{ sixtunnel_executable_location }} 6tunnel-path = {{ sixtunnel_executable_location }}
runner-path = ${directory:services}/6tunnel-cluster runner-path = ${directory:bin}/6tunnel-cluster
[tunnel-cluster-service]
recipe = slapos.cookbook:wrapper
command-line = ${tunnel-cluster-url:runner-path}
wrapper-path = ${directory:services}/6tunnel-cluster
hash-files = ${buildout:directory}/software_release/buildout.cfg
[ansible-vm-promise] [ansible-vm-promise]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -575,8 +607,8 @@ cpu-max-count = 24 ...@@ -575,8 +607,8 @@ cpu-max-count = 24
disk-cache = writeback disk-cache = writeback
disk-aio = native disk-aio = native
auto-ballooning = True auto-ballooning = True
machine-options = machine-options =
cpu-model = cpu-model =
nat-rules = 22 80 443 nat-rules = 22 80 443
use-nat = True use-nat = True
...@@ -598,7 +630,7 @@ external-disk-format = qcow2 ...@@ -598,7 +630,7 @@ external-disk-format = qcow2
enable-http-server = False enable-http-server = False
httpd-port = 8081 httpd-port = 8081
# for auto config, the public key file will be available in the VM via url http://10.0.2.100/authorized_key if use-nat = True # for auto config, the public key file will be available in the VM via url http://10.0.2.100/authorized_key if use-nat = True
authorized-key = authorized-key =
# send some content which will be accessible to the vm through static url: http://10.0.2.100/data # send some content which will be accessible to the vm through static url: http://10.0.2.100/data
data-to-vm = data-to-vm =
...@@ -617,7 +649,7 @@ keyboard-layout-language = fr ...@@ -617,7 +649,7 @@ keyboard-layout-language = fr
{% do part_list.append('cluster-url-path') -%} {% do part_list.append('cluster-url-path') -%}
{% endif -%} {% endif -%}
{% if enable_http == 'true' %} {% if enable_http == 'true' %}
{% do part_list.extend(['httpd', 'httpd-promise', 'publish-host-config']) -%} {% do part_list.extend(['httpd', 'httpd-service', 'httpd-promise', 'publish-host-config']) -%}
{% if slapparameter_dict.get('data-to-vm', '') %} {% if slapparameter_dict.get('data-to-vm', '') %}
{% do part_list.append('vm-data-content') -%} {% do part_list.append('vm-data-content') -%}
{% endif -%} {% endif -%}
...@@ -630,6 +662,9 @@ keyboard-layout-language = fr ...@@ -630,6 +662,9 @@ keyboard-layout-language = fr
{% if slapparameter_dict.get('bootstrap-script-url', '') -%} {% if slapparameter_dict.get('bootstrap-script-url', '') -%}
{% do part_list.append('download-bootstrap-script') -%} {% do part_list.append('download-bootstrap-script') -%}
{% endif -%} {% endif -%}
{% if slapparameter_dict.get('document-port', '') -%}
{% do part_list.append('tunnel-cluster-service') -%}
{% endif -%}
{% endif -%} {% endif -%}
...@@ -650,15 +685,18 @@ context = ...@@ -650,15 +685,18 @@ context =
[buildout] [buildout]
parts = parts =
certificate-authority certificate-authority
certificate-authority-service
publish-connection-information publish-connection-information
kvm-instance kvm-instance
kvm-controller-wrapper kvm-controller-wrapper
kvm-vnc-promise kvm-vnc-promise
kvm-disk-image-corruption-promise kvm-disk-image-corruption-promise
websockify-sighandler websockify-sighandler
websockify-sighandler-service
novnc-promise novnc-promise
kvm-started-promise kvm-started-promise
cron cron
cron-service
cron-entry-logrotate cron-entry-logrotate
frontend-promise frontend-promise
# monitor parts # monitor parts
...@@ -666,7 +704,7 @@ parts = ...@@ -666,7 +704,7 @@ parts =
# Complete parts with sections # Complete parts with sections
{{ part_list | join('\n ') }} {{ part_list | join('\n ') }}
extends = extends =
# Add extends list # Add extends list
{{ extends_list | join('\n ') }} {{ extends_list | join('\n ') }}
# {{ template_httpd_cfg }} # {{ template_httpd_cfg }}
......
...@@ -99,7 +99,7 @@ recipe = hexagonit.recipe.download ...@@ -99,7 +99,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2 url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
mode = 644 mode = 644
md5sum = 0fd548b8cac9278496d9d83dde26d09c md5sum = 149df1bc788ce68c86a5fda4872e008e
download-only = true download-only = true
on-update = true on-update = true
......
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