Example #1
0
    def deploy_patch(self, patch_on_off, patch_name, install_file_filter, config_file_filter):
        """

        :param patch_on_off: boolean, option value of specified patch in configuration.conf
        :param patch_name: string, name of patch
        :param install_file_filter: [], array of suffix of files which will be install. for example: ['.py']
        :param config_file_filter: [], suffix array of files which will be config. for example: ['.conf', '.ini']
        :return:
        """
        if  patch_on_off== False:
            logger.info('*********************************************************')
            logger.info('**** Config for %s is False, no need to install. ****' % patch_name)
            logger.info('*********************************************************')
            return False
        elif patch_on_off == True:
            absolute_path_of_patch = os.path.join(utils.get_hybrid_cloud_badam_parent_path(), PathTriCircle.PATCH_TO_PATH[patch_name])
            openstack_install_path = utils.get_openstack_installed_path()
            installer = PatchInstaller(absolute_path_of_patch, openstack_install_path, install_file_filter)
            configurator = PatchConfigurator(absolute_path_of_patch, config_file_filter)
            patch_deploy_factory = EnginneringFactory(patch_name,
                                                      installer=installer,
                                                      configurator=configurator)
            patch_deploy_factory.execute()
        else:
            logger.error('Config for cascading node <%s> is invalid, value is: %s' % (patch_name, patch_on_off))
            return False
Example #2
0
    def _init_paths_need_to_backup(self):
        nova = 'nova'
        self.openstack_installed_path = utils.get_openstack_installed_path()
        nova_path = os.path.join(self.openstack_installed_path, nova)
        neutron = 'neutron'
        neutron_path = os.path.join(self.openstack_installed_path, neutron)
        cinder = 'cinder'
        cinder_path = os.path.join(self.openstack_installed_path, cinder)

        self.paths_need_to_backup = [nova_path, neutron_path, cinder_path]
        log.info('paths_need_to_backup: %s' % str(self.paths_need_to_backup))
Example #3
0
    def _init_paths_need_to_backup(self):
        nova = 'nova'
        self.openstack_installed_path = utils.get_openstack_installed_path()
        nova_path = os.path.join(self.openstack_installed_path, nova)
        neutron = 'neutron'
        neutron_path = os.path.join(self.openstack_installed_path, neutron)
        cinder = 'cinder'
        cinder_path = os.path.join(self.openstack_installed_path, cinder)

        self.paths_need_to_backup = [nova_path, neutron_path, cinder_path]
        log.info('paths_need_to_backup: %s' % str(self.paths_need_to_backup))
Example #4
0
 def patch_for_cascading_and_proxy_node(self):
     host_list = RefCPSService.host_list()
     for host in host_list['hosts']:
         roles_list = host['roles']
         proxy_host_ip = host['manageip']
         region = self._get_region_by_roles_list(roles_list)
         if region is not None:
             print('Start to patch for region - <%s>' % region)
             absolute_patch_path = self._get_path_by_region(region)
             PatchInstaller(absolute_patch_path, utils.get_openstack_installed_path(), ['.py'], proxy_host_ip).install()
             print('Finish to patch for region - <%s>' % region)
         else:
             print('Region of ip <%s> is None, can not patch for this proxy' % proxy_host_ip)
Example #5
0
 def patch_for_cascading_and_proxy_node(self):
     host_list = RefCPSService.host_list()
     for host in host_list['hosts']:
         roles_list = host['roles']
         proxy_host_ip = host['manageip']
         region = self._get_region_by_roles_list(roles_list)
         if region is not None:
             print('Start to patch for region - <%s>' % region)
             absolute_patch_path = self._get_path_by_region(region)
             PatchInstaller(absolute_patch_path,
                            utils.get_openstack_installed_path(), ['.py'],
                            proxy_host_ip).install()
             print('Finish to patch for region - <%s>' % region)
         else:
             print(
                 'Region of ip <%s> is None, can not patch for this proxy' %
                 proxy_host_ip)
Example #6
0
    def deploy_python_patches(self):
        try:
            patch_name = 'hybrid_python_patches'
            install_file_filter = ['.py']
            config_file_filter = ['.conf', '.filters']

            absolute_path_of_patch = os.path.join(utils.get_hybrid_cloud_badam_path(), PathHybridCloud.PATH_PATCHES_PYTHON)
            openstack_install_path = utils.get_openstack_installed_path()
            installer = PatchInstaller(absolute_path_of_patch, openstack_install_path, install_file_filter)

            configurator = PatchConfigurator(absolute_path_of_patch, config_file_filter)
            patch_deploy_factory = EnginneringFactory(patch_name,
                                                      installer=installer,
                                                      configurator=configurator)
            patch_deploy_factory.execute()
        except:
            err_info = 'Exception occur when deploy python patches for hybrid cloud, Exception: %s' %traceback.format_exc()
            logger.error(err_info)
Example #7
0
    def deploy_python_patches(self):
        try:
            patch_name = 'hybrid_python_patches'
            install_file_filter = ['.py']
            config_file_filter = ['.conf', '.filters']

            absolute_path_of_patch = os.path.join(
                utils.get_hybrid_cloud_badam_path(),
                PathHybridCloud.PATH_PATCHES_PYTHON)
            openstack_install_path = utils.get_openstack_installed_path()
            installer = PatchInstaller(absolute_path_of_patch,
                                       openstack_install_path,
                                       install_file_filter)

            configurator = PatchConfigurator(absolute_path_of_patch,
                                             config_file_filter)
            patch_deploy_factory = EnginneringFactory(
                patch_name, installer=installer, configurator=configurator)
            patch_deploy_factory.execute()
        except:
            err_info = 'Exception occur when deploy python patches for hybrid cloud, Exception: %s' % traceback.format_exc(
            )
            logger.error(err_info)
Example #8
0
    def deploy_patch(self, patch_on_off, patch_name, install_file_filter,
                     config_file_filter):
        """

        :param patch_on_off: boolean, option value of specified patch in configuration.conf
        :param patch_name: string, name of patch
        :param install_file_filter: [], array of suffix of files which will be install. for example: ['.py']
        :param config_file_filter: [], suffix array of files which will be config. for example: ['.conf', '.ini']
        :return:
        """
        if patch_on_off == False:
            logger.info(
                '*********************************************************')
            logger.info(
                '**** Config for %s is False, no need to install. ****' %
                patch_name)
            logger.info(
                '*********************************************************')
            return False
        elif patch_on_off == True:
            absolute_path_of_patch = os.path.join(
                utils.get_hybrid_cloud_badam_parent_path(),
                PathTriCircle.PATCH_TO_PATH[patch_name])
            openstack_install_path = utils.get_openstack_installed_path()
            installer = PatchInstaller(absolute_path_of_patch,
                                       openstack_install_path,
                                       install_file_filter)
            configurator = PatchConfigurator(absolute_path_of_patch,
                                             config_file_filter)
            patch_deploy_factory = EnginneringFactory(
                patch_name, installer=installer, configurator=configurator)
            patch_deploy_factory.execute()
        else:
            logger.error(
                'Config for cascading node <%s> is invalid, value is: %s' %
                (patch_name, patch_on_off))
            return False