KVM frontend : Send slave connection parameters to master

parent e64ed370
......@@ -24,11 +24,11 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
from slapos.recipe.librecipe import GenericBaseRecipe, GenericSlapRecipe
import json
import zc.buildout
class Recipe(GenericBaseRecipe):
class Recipe(GenericSlapRecipe):
"""
kvm frontend instance configuration.
"""
......@@ -82,7 +82,7 @@ class Recipe(GenericBaseRecipe):
proxy_table_content = json.dumps(proxy_table)
return proxy_table_content
def install(self):
def _install(self):
# Check for mandatory field
if self.options.get('domain', None) is None:
raise zc.buildout.UserError('No domain name specified. Please define '
......@@ -118,4 +118,14 @@ class Recipe(GenericBaseRecipe):
self.substituteTemplate(self.getTemplateFilename('nodejs_run.in'),
config))
# Send connection parameters of slave instances
site_url = "https://%s:%s/" % (self.options['domain'], self.options['port'])
for slave in rewrite_rule_list:
self.setConnectionDict(
dict(url="%s%s" % (site_url, slave['resource']),
domainname=self.options['domain'],
port=self.options['port'],
resource=slave['resource']),
slave['reference'])
return [map_file, conf_file, runner_path]
......@@ -124,10 +124,13 @@ partition-id = $${slap-connection:partition-id}
name = SlaveFrontend
software-type = frontend
slave = true
return = frontend_url
config = host port
config-host = $${novnc-instance:ip}
config-port = $${novnc-instance:port}
return = url
[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
frontend_url = $${request-slave-frontend:frontend_url}
frontend_url = $${request-slave-frontend:connection-url}
vnc_passwd = $${kvm-instance:passwd}
......@@ -169,7 +169,7 @@ command =
[template-kvm]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg
md5sum = ce62abe1edabc78a4baa574a39d7faa0
md5sum = ef4b95334fd8b4608ec10595aba3df3d
output = ${buildout:directory}/template-kvm.cfg
mode = 0644
......@@ -235,4 +235,4 @@ signature-certificate-list =
b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE-----
\ No newline at end of file
-----END CERTIFICATE-----
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