Пример #1
0
    def _add_proxy_role(self, host, role_name):
        """
        Commands used to add role for host:
        cps role-host-add --host  **  nova-proxy001
        cps commit

        Commands used to check if add successful:
        cps template-instance-list --service nova nova-proxy001
        If get proxy info, then it is add successfully, no mater the status of proxy is fault.
        :param role_name:
        :return:
        """
        log.info('Start to add proxy role in host: %s, for role: %s' %
                 (host, role_name))
        for i in range(3):
            try:
                add_result = RefCPSService.role_host_add(role_name, [host])
                RefCPSService.cps_commit()
                log.info('add proxy role success, host: %s, role: %s' %
                         (host, role_name))
                return True
            except Exception as e:
                log.error(
                    "add proxy role error, try again, host: %s, role: %s, exception: %s"
                    % (host, role_name, e.message))
                time.sleep(1)
                continue

        log.error('add proxy role error, host: %s, role: %s' %
                  (host, role_name))
        return False
Пример #2
0
    def _add_proxy_role(self, host, role_name):
        """
        Commands used to add role for host:
        cps role-host-add --host  **  nova-proxy001
        cps commit

        Commands used to check if add successful:
        cps template-instance-list --service nova nova-proxy001
        If get proxy info, then it is add successfully, no mater the status of proxy is fault.
        :param role_name:
        :return:
        """
        log.info('Start to add proxy role in host: %s, for role: %s' % (host, role_name))
        for i in range(3):
            try:
                add_result = RefCPSService.role_host_add(role_name, [host])
                RefCPSService.cps_commit()
                log.info('add proxy role success, host: %s, role: %s'
                         % (host, role_name))
                return True
            except Exception as e:
                log.error("add proxy role error, try again, host: %s, role: %s, exception: %s"
                          % (host, role_name, e.message))
                time.sleep(1)
                continue

        log.error('add proxy role error, host: %s, role: %s' % (host, role_name))
        return False
Пример #3
0
 def add_role_for_cascading_node(self):
     start_info = 'Start to add role for cascading node. Include: nova-api, nova-scheduler, neutron-server, loadbalancer'
     print(start_info)
     log.info(start_info)
     host_name_of_cascading_node = socket.gethostname()
     RefCPSService.role_host_add('nova-api', [host_name_of_cascading_node])
     RefCPSService.role_host_add('nova-scheduler',
                                 [host_name_of_cascading_node])
     RefCPSService.role_host_add('neutron-server',
                                 [host_name_of_cascading_node])
     RefCPSService.role_host_add('loadbalancer',
                                 [host_name_of_cascading_node])
     RefCPSService.cps_commit()
     finish_info = 'Finish to add role for cascading node. Include: nova-api, nova-scheduler, neutron-server, loadbalancer'
     print(finish_info)
     log.info(finish_info)
Пример #4
0
    def add_role_for_cascading_node(self):
        start_info = 'Start to add role for cascading node. Include: nova-api, nova-scheduler, neutron-server, loadbalancer'
        print(start_info)
        log.info(start_info)
        host_name_of_cascading_node = socket.gethostname()
        log.info("host_name_of_cascading_node = %s" % host_name_of_cascading_node)

        RefCPSService.role_host_add('nova-api', [host_name_of_cascading_node])
        RefCPSService.role_host_add('nova-scheduler', [host_name_of_cascading_node])
        RefCPSService.role_host_add('neutron-server', [host_name_of_cascading_node])
        RefCPSService.role_host_add('loadbalancer', [host_name_of_cascading_node])
        RefCPSService.cps_commit()
        finish_info = 'Finish to add role for cascading node. Include: nova-api, nova-scheduler, neutron-server, loadbalancer'

        print(finish_info)
        log.info(finish_info)
Пример #5
0
 def __update_template_params_for_proxy__(service, template_name, dict_params):
     for i in range(3):
         try:
             RefCPSService.update_template_params(service, template_name, dict_params)
             RefCPSService.cps_commit()
             log.info("update template params success, service: %s, template_name: %s"
                      % (service, template_name))
             time.sleep(1)
             return True
         except Exception as e:
             log.error("update template params error, try again, service: %s, template_name: %s, exception: %s"
                       % (service, template_name, e.message))
             time.sleep(1)
             continue
     log.error("update template params failed, service: %s, template_name: %s."
               % (service, template_name))
     return False
Пример #6
0
    def _add_proxy_role(self, host, role_name):
        """
        Commands used to add role for host:
        cps role-host-add --host  **  nova-proxy001
        cps commit

        Commands used to check if add successful:
        cps template-instance-list --service nova nova-proxy001
        If get proxy info, then it is add successfully, no mater the status of proxy is fault.
        :param role_name:
        :return:
        """
        log.info('Start to add proxy role in host: %s, for role: %s' %
                 (host, role_name))
        add_result = RefCPSService.role_host_add(role_name, [host])
        RefCPSService.cps_commit()
        log.info('Finish to add proxy role in host: %s, for role: %s' %
                 (host, role_name))
Пример #7
0
 def __enable_l2_remote_port_for_proxy__(proxy_name):
     service = 'neutron'
     # e.g. 'neutron-l2-proxy003'
     template = '-'.join(['neutron-l2', proxy_name])
     updated_params = {
         'remote_port_enabled': 'True'
     }
     for i in range(3):
         try:
             RefCPSService.update_template_params(service, template, updated_params)
             RefCPSService.cps_commit()
             log.info("enable l2 remote port success, proxy: %s" % proxy_name)
             return True
         except Exception as e:
             log.error("enable l2 remote port error, try again, proxy: %s, exception: %s"
                       % (proxy_name, e.message))
             time.sleep(1)
             continue
     log.error("enable l2 remote port failed, proxy: %s" % proxy_name)
     return False
Пример #8
0
 def __enable_l2_remote_port_for_proxy__(proxy_name):
     service = 'neutron'
     # e.g. 'neutron-l2-proxy003'
     template = '-'.join(['neutron-l2', proxy_name])
     updated_params = {'remote_port_enabled': 'True'}
     for i in range(3):
         try:
             RefCPSService.update_template_params(service, template,
                                                  updated_params)
             RefCPSService.cps_commit()
             log.info("enable l2 remote port success, proxy: %s" %
                      proxy_name)
             return True
         except Exception as e:
             log.error(
                 "enable l2 remote port error, try again, proxy: %s, exception: %s"
                 % (proxy_name, e.message))
             time.sleep(1)
             continue
     log.error("enable l2 remote port failed, proxy: %s" % proxy_name)
     return False
Пример #9
0
 def __update_template_params_for_proxy__(service, template_name,
                                          dict_params):
     for i in range(3):
         try:
             RefCPSService.update_template_params(service, template_name,
                                                  dict_params)
             RefCPSService.cps_commit()
             log.info(
                 "update template params success, service: %s, template_name: %s"
                 % (service, template_name))
             time.sleep(1)
             return True
         except Exception as e:
             log.error(
                 "update template params error, try again, service: %s, template_name: %s, exception: %s"
                 % (service, template_name, e.message))
             time.sleep(1)
             continue
     log.error(
         "update template params failed, service: %s, template_name: %s." %
         (service, template_name))
     return False
Пример #10
0
 def _commit_config(self):
     RefCPSService.cps_commit()
Пример #11
0
 def _commit_config(self):
     RefCPSService.cps_commit()