Fix behavior of slave instances between kvm and kvm frontend

parent 513a4660
...@@ -106,11 +106,11 @@ class Recipe(BaseSlapRecipe): ...@@ -106,11 +106,11 @@ class Recipe(BaseSlapRecipe):
shared=True shared=True
) )
url = 'https://%s:%s/%s/vnc_auto.html?host=%s&port=%s&encrypt=1&path=%s' % ( 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? # XXX-Cedric : uh? how to fetch slave reference?
slave_frontend.getParameter('domain'), slave_frontend.getParameter('domainname'),
slave_frontend.getParameter('port'), slave_frontend.getParameter('port'),
slave_frontend.get('reference'), slave_frontend.get('reference'),
slave_frontend.getParameter('domain'), slave_frontend.getParameter('domainname'),
slave_frontend.getParameter('port'), slave_frontend.getParameter('port'),
slave_frontend.get('reference')) slave_frontend.get('reference'))
connection_dict = dict( connection_dict = dict(
...@@ -118,6 +118,7 @@ class Recipe(BaseSlapRecipe): ...@@ -118,6 +118,7 @@ class Recipe(BaseSlapRecipe):
backend_url = ipv6_url, backend_url = ipv6_url,
password = kvm_conf['vnc_passwd']) password = kvm_conf['vnc_passwd'])
else: else:
# No frontend : just set raw IPv6
connection_dict = dict( connection_dict = dict(
url = ipv6_url, url = ipv6_url,
password = kvm_conf['vnc_passwd']) password = kvm_conf['vnc_passwd'])
......
...@@ -71,17 +71,19 @@ class Recipe(BaseSlapRecipe): ...@@ -71,17 +71,19 @@ class Recipe(BaseSlapRecipe):
base_url = 'https://%s:%s/' % (frontend_domain_name, frontend_port_number) base_url = 'https://%s:%s/' % (frontend_domain_name, frontend_port_number)
for slave_instance in slave_instance_list: for slave_instance in slave_instance_list:
current_slave_dict = dict() current_slave_dict = dict()
current_slave_dict['host'] = slave_instance.get('host') current_slave_dict['host'] = slave_instance.getConnectionParameter('host')
current_slave_dict['port'] = slave_instance.get('port') current_slave_dict['port'] = slave_instance.getConnectionParameter('port')
if current_slave_dict['host'] is None \ if current_slave_dict['host'] is None \
or current_slave_dict['port'] is None: or current_slave_dict['port'] is None:
continue continue
# Is target https or http? # Is target https or http?
current_slave_dict['https'] = slave_instance.get('https', 'true') current_slave_dict['https'] = slave_instance.getConnectionParameter(
'https', 'true')
if current_slave_dict['https'] in FALSE_VALUE_LIST: if current_slave_dict['https'] in FALSE_VALUE_LIST:
current_slave_dict['https'] = 'false' current_slave_dict['https'] = 'false'
reference = slave_instance.get('slave_reference') reference = slave_instance.get('slave_reference')
# XXX-Cedric : how to fetch reference?
current_slave_dict['reference'] = reference current_slave_dict['reference'] = reference
slave_dict[reference] = "%s%s" % (base_url, reference.replace('-', '')) slave_dict[reference] = "%s%s" % (base_url, reference.replace('-', ''))
rewrite_rule_list.append(current_slave_dict) rewrite_rule_list.append(current_slave_dict)
...@@ -110,10 +112,20 @@ class Recipe(BaseSlapRecipe): ...@@ -110,10 +112,20 @@ 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? # Send connection parameters of master instance
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()))
# Send connection parameters of slave instances
for slave_instance in slave_instance_list:
slave_site_url = '%s%s' % (node_parameter_dict['site_url'],
# XXX-Cedric reference?
slave_instance.get('reference'))
slave_instance.setConnectionDict(
dict(site_url=slave_site_url,
domainname=frontend_domain_name),
port=frontend_port_number)
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