Add slave system in kvm and kvm_frontend (WIP)

parent b5cb205a
...@@ -35,6 +35,8 @@ import pkg_resources ...@@ -35,6 +35,8 @@ import pkg_resources
import ConfigParser import ConfigParser
import hashlib import hashlib
FALSE_VALUE_LIST = ['n', 'no', '0', 'false']
class Recipe(BaseSlapRecipe): class Recipe(BaseSlapRecipe):
# To avoid magic numbers # To avoid magic numbers
...@@ -86,13 +88,41 @@ class Recipe(BaseSlapRecipe): ...@@ -86,13 +88,41 @@ class Recipe(BaseSlapRecipe):
target_port = vnc_port) target_port = vnc_port)
self.linkBinary() self.linkBinary()
self.computer_partition.setConnectionDict(dict(
url = "https://[%s]:%s/vnc_auto.html?host=[%s]&port=%s&encrypt=1" % ( ipv6_url = 'https://[%s]:%s/vnc_auto.html?host=[%s]&port=%s&encrypt=1' % (
noVNC_conf['source_ip'], noVNC_conf['source_ip'], noVNC_conf['source_port'],
noVNC_conf['source_port'], noVNC_conf['source_ip'], noVNC_conf['source_port'])
noVNC_conf['source_ip'],
noVNC_conf['source_port']), # Request frontend slave instance, unless contrary is specified
password = kvm_conf['vnc_passwd'])) # XXX-Cedric : HARDCODE : during dev, request is OPT-IN
request_frontend = self.parameter_dict.get('frontend', 'false')
#request_frontend = self.parameter_dict.get('frontend', True)
if not request_frontend in FALSE_VALUE_LIST:
slave_frontend = self.request(
# XXX-Cedric : how to "de-hardcode" url?
software_release='/opt/slapdev/software/kvm-frontend/software.cfg',
software_type='RootInstanceSoftware',
partition_reference='%s_frontend' % self.computer_partition_id,
shared=True
)
url = 'https://%s:%s/%s/vnc_auto.html?host=%s&port=%s&encrypt=1&path=%s' % (
# XXX-Cedric : uh? how to fetch slave url/port/reference?
slave_frontend.getParameter('domain'),
slave_frontend.getParameter('port'),
slave_frontend.get('reference'),
slave_frontend.getParameter('domain'),
slave_frontend.getParameter('port'),
slave_frontend.get('reference'))
connection_dict = dict(
url = url,
backend_url = ipv6_url,
password = kvm_conf['vnc_passwd'])
else:
connection_dict = dict(
url = ipv6_url,
password = kvm_conf['vnc_passwd'])
self.computer_partition.setConnectionDict(connection_dict)
return self.path_list return self.path_list
......
...@@ -101,10 +101,10 @@ class Recipe(BaseSlapRecipe): ...@@ -101,10 +101,10 @@ class Recipe(BaseSlapRecipe):
for reference, url in slave_dict.iteritems(): for reference, url in slave_dict.iteritems():
self.setConnectionDict(dict(site_url=url), reference) self.setConnectionDict(dict(site_url=url), reference)
# XXX-Cedric : how to get/set slave parameters?
self.setConnectionDict( self.setConnectionDict(
dict(site_url=node_parameter_dict['site_url'], dict(site_url=node_parameter_dict['site_url'],
domain_ipv6_address=self.getGlobalIPv6Address(), domain_ipv6_address=self.getGlobalIPv6Address()))
domain_ipv4_address=self.getLocalIPv4Address()))
return self.path_list return self.path_list
def installLogrotate(self): def installLogrotate(self):
......
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