Rework KVM instance to have working frontend

Use new recipes in KVM to make instance not raise when no frontend is found,
Don't request slave kvm frontend instance on SAME machine,
Check if frontend is available using a promise
parent 6ca9568a
......@@ -9,6 +9,7 @@ parts =
certificate-authority
kvm-promise
novnc-promise
frontend-promise
publish-kvm-connection-information
eggs-directory = ${buildout:eggs-directory}
......@@ -59,6 +60,7 @@ path = $${basedirectory:promises}/vnc_promise
hostname = $${kvm-instance:vnc-ip}
port = $${kvm-instance:vnc-port}
[novnc-instance]
recipe = slapos.cookbook:novnc
path = $${ca-novnc:executable}
......@@ -104,23 +106,20 @@ path = $${basedirectory:promises}/novnc_promise
hostname = $${novnc-instance:ip}
port = $${novnc-instance:port}
[kvm-monitor]
recipe = slapos.cookbook:generic.slapmonitor
db-path = $${rootdirectory:srv}/slapmonitor_database
[request-common]
[request-slave-frontend]
recipe = slapos.cookbook:request
software-url = $${slap-connection:software-release-url}
sla = computer_guid
sla-computer_guid = $${slap-connection:computer-id}
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}
[request-slave-frontend]
<=request-common
name = SlaveFrontend
software-type = frontend
slave = true
......@@ -129,8 +128,27 @@ config-host = $${novnc-instance:ip}
config-port = $${novnc-instance:port}
return = url resource port domainname
# Will generate, if existing, URL to reach KVM using frontend
[get-slave-connection-url]
recipe = slapos.cookbook:generate_output_if_input_not_null
input-list =
frontend-url request-slave-frontend:connection-url
frontend-port request-slave-frontend:connection-port
frontend-resource request-slave-frontend:connection-resource
frontend-domainname request-slave-frontend:connection-domainname
template = %(frontend-url)s/vnc_auto.html?host=%(frontend-domainname)s&port=%(frontend-port)s&encrypt=1&path=%(frontend-resource)s
# This is default output, if slave is not ready yet
output = Not ready yet. Please use backend URL if possible or wait a few minutes.
[frontend-promise]
recipe = slapos.cookbook:check_url_available
path = $${basedirectory:promises}/frontend_promise
url = $${get-slave-connection-url:output}
dash_path = ${dash:location}/bin/dash
[publish-kvm-connection-information]
recipe = slapos.cookbook:publish
backend_url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1
url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}
url = $${get-slave-connection-url:output}
password = $${kvm-instance:passwd}
......@@ -132,7 +132,7 @@ command =
[template-kvm]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg
md5sum = b6572c018e44d4676e76805116bcade0
md5sum = 8d67a6cabe4fbce2bd44aa006a0d0cf8
output = ${buildout:directory}/template-kvm.cfg
mode = 0644
......@@ -286,4 +286,4 @@ zc.recipe.egg = 1.3.2
# Required by:
# slapos.core==0.23
zope.interface = 3.8.0
\ No newline at end of file
zope.interface = 3.8.0
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