Ejemplo n.º 1
0
 def restart_service(self):
     log.info('Start to restart openstack service for nova/neutron/cinder.')
     cps_service = CPSServiceBusiness()
     for proxy in self.proxy_match_region.keys():
         cps_service.stop_all(proxy)
         cps_service.start_all(proxy)
     log.info('Finish to restart openstack service for nova/neutron/cinder.')
Ejemplo n.º 2
0
class DispatchPatchTool(object):

    def __init__(self, proxy_match_region):
        # self.filter_for_dispatch = ['.py', '.sh', '.ini', '.pem', '.txt', '.vmx', '.json']
        self.filter_for_dispatch = []
        self.cps_service_business = CPSServiceBusiness()
        self.aws_cascaded_node_hosts = self.cps_service_business.get_aws_node_hosts()
        self.vcloud_cascaded_node_hosts = self.cps_service_business.get_vcloud_node_hosts()
        self.openstack_cascaded_node_hosts = self.cps_service_business.get_openstack_hosts()
        self.proxy_match_region = proxy_match_region
        log.info('proxy_match_region: %s' % self.proxy_match_region)
        self.proxy_hosts = self.cps_service_business.get_all_proxy_nodes(self.proxy_match_region)
        log.info('proxy_hosts: %s' % self.proxy_hosts)

    def dispatch_patch_tool_to_host(self, host):
        path_of_patch_tool = utils.get_patches_tool_path()
        files_need_to_dispatch = utils.get_files(path_of_patch_tool, self.filter_for_dispatch)
        ssh = sshutils.SSH(host=host, user=SysUserInfo.FSP, password=SysUserInfo.FSP_PWD)
        try:
            for absolute_file, relative_path_of_file in files_need_to_dispatch:
                log.info('start to copy file <<%s>> to host <<%s>>' % (relative_path_of_file, host))
                file_copy_to = os.path.join(SysPath.HOME_FSP, SysPath.PATCHES_TOOL, relative_path_of_file)
                file_dir_copy_to = os.path.dirname(file_copy_to)
                ssh.run('mkdir -p %s' % file_dir_copy_to)
                ssh.put_file(absolute_file, file_copy_to)
                log.info('End to copy file <<%s>> to host <<%s>>' % (relative_path_of_file, host))

        except Exception, e:
            log.error('Exception occur when dispatch patches tool to host: <%s>, Exception: %s' % (host, traceback.format_exc()))
        finally:
Ejemplo n.º 3
0
def get_all_hosts():
    cps_business = CPSServiceBusiness()
    openstack_az_hosts = cps_business.get_openstack_hosts()
    aws_az_hosts = cps_business.get_aws_node_hosts()
    vcloud_az_hosts = cps_business.get_vcloud_node_hosts()
    all_proxy_host = cps_business.get_all_proxy_nodes(proxy_match_region=CONF.DEFAULT.proxy_match_region)
    return openstack_az_hosts + aws_az_hosts + vcloud_az_hosts + all_proxy_host
Ejemplo n.º 4
0
    def check_service_status(self):
        print('****Start to check service status...')

        cps_service = CPSServiceBusiness()
        for proxy in self.proxies:
            cps_service.check_all_service_template_status(proxy)

        print('****End to check service status.')
Ejemplo n.º 5
0
    def check_service_status(self):
        print('****Start to check service status...')

        cps_service = CPSServiceBusiness()
        for proxy in self.proxies:
            cps_service.check_all_service_template_status(proxy)

        print('****End to check service status.')
Ejemplo n.º 6
0
def get_all_cascaded_hosts():
    cps_business = CPSServiceBusiness()
    openstack_az_hosts = cps_business.get_openstack_hosts()
    aws_az_hosts = cps_business.get_aws_node_hosts()
    vcloud_az_hosts = cps_business.get_vcloud_node_hosts()

    # shaixun
    proxy_match_host = CONF.DEFAULT.proxy_match_host

    return openstack_az_hosts + aws_az_hosts + vcloud_az_hosts
Ejemplo n.º 7
0
def get_all_cascaded_hosts():
    cps_business = CPSServiceBusiness()
    openstack_az_hosts = cps_business.get_openstack_hosts()
    aws_az_hosts = cps_business.get_aws_node_hosts()
    vcloud_az_hosts = cps_business.get_vcloud_node_hosts()

    # shaixun
    proxy_match_host = CONF.DEFAULT.proxy_match_host

    return openstack_az_hosts + aws_az_hosts + vcloud_az_hosts
Ejemplo n.º 8
0
 def __init__(self, proxy_match_region):
     # self.filter_for_dispatch = ['.py', '.sh', '.ini', '.pem', '.txt', '.vmx', '.json']
     self.filter_for_dispatch = []
     self.cps_service_business = CPSServiceBusiness()
     self.aws_cascaded_node_hosts = self.cps_service_business.get_aws_node_hosts()
     self.vcloud_cascaded_node_hosts = self.cps_service_business.get_vcloud_node_hosts()
     self.openstack_cascaded_node_hosts = self.cps_service_business.get_openstack_hosts()
     self.proxy_match_region = proxy_match_region
     log.info('proxy_match_region: %s' % self.proxy_match_region)
     self.proxy_hosts = self.cps_service_business.get_all_proxy_nodes(self.proxy_match_region)
     log.info('proxy_hosts: %s' % self.proxy_hosts)
Ejemplo n.º 9
0
    def restart_services(self):
        print('****Start to restart services...')

        cps_service = CPSServiceBusiness()
        for proxy in self.proxies:
            cps_service.stop_all(proxy)

        for proxy in self.proxies:
            cps_service.start_all(proxy)

        print('****Finish to restart services.')
Ejemplo n.º 10
0
 def restart_service(self):
     log.info('Start to restart openstack service for nova/neutron/cinder.')
     cps_service = CPSServiceBusiness()
     for proxy in self.proxy_match_region.keys():
         cps_service.stop_all(proxy)
         cps_service.start_all(proxy)
     log.info(
         'Finish to restart openstack service for nova/neutron/cinder.')
Ejemplo n.º 11
0
def get_all_hosts():
    cps_business = CPSServiceBusiness()
    openstack_az_hosts = cps_business.get_openstack_hosts()
    aws_az_hosts = cps_business.get_aws_node_hosts()
    vcloud_az_hosts = cps_business.get_vcloud_node_hosts()
    all_proxy_host = cps_business.get_all_proxy_nodes(
        proxy_match_region=CONF.DEFAULT.proxy_match_region)
    return openstack_az_hosts + aws_az_hosts + vcloud_az_hosts + all_proxy_host
Ejemplo n.º 12
0
    def restart_services(self):
        print('****Start to restart services...')

        cps_service = CPSServiceBusiness()
        for proxy in self.proxies:
            cps_service.stop_all(proxy)

        for proxy in self.proxies:
            cps_service.start_all(proxy)

        print('****Finish to restart services.')
Ejemplo n.º 13
0
def get_all_cascaded_hosts():
    cps_business = CPSServiceBusiness()
    openstack_az_hosts = cps_business.get_openstack_hosts()
    aws_az_hosts = cps_business.get_aws_node_hosts()
    vcloud_az_hosts = cps_business.get_vcloud_node_hosts()
    return openstack_az_hosts + aws_az_hosts + vcloud_az_hosts
Ejemplo n.º 14
0
def get_os_region_name():
    cps_business = CPSServiceBusiness()
    return cps_business.get_os_region_name()
Ejemplo n.º 15
0
def get_all_proxy_hosts():
    cps_business = CPSServiceBusiness()
    all_proxy_hosts = cps_business.get_all_proxy_nodes(proxy_match_region=CONF.DEFAULT.proxy_match_region)
    return all_proxy_hosts
Ejemplo n.º 16
0
 def verify_services_status(self):
     cps_service = CPSServiceBusiness()
     for proxy in self.proxy_match_region.keys():
         cps_service.check_all_service_template_status(proxy)
Ejemplo n.º 17
0
 def patch_for_cascaded_nodes(self):
     cps = CPSServiceBusiness()
Ejemplo n.º 18
0
def get_all_proxy_hosts():
    cps_business = CPSServiceBusiness()
    all_proxy_hosts = cps_business.get_all_proxy_nodes(
        proxy_match_region=CONF.DEFAULT.proxy_match_region)
    return all_proxy_hosts
Ejemplo n.º 19
0
 def verify_services_status(self):
     cps_service = CPSServiceBusiness()
     for proxy in self.proxy_match_region.keys():
         cps_service.check_all_service_template_status(proxy)
Ejemplo n.º 20
0
def get_os_region_name():
    cps_business = CPSServiceBusiness()
    return cps_business.get_os_region_name()