Ejemplo n.º 1
0
    def _initResource(self):
        """
         """
        self._loggers.stabilityObjstoreLogger.info('初始化命令行客户端')
        self._openstackClient = OpenstackClient(self._os_tenant_name,
                                                self._os_project_name,
                                                self._os_username,
                                                self._os_password)
        self._novaClient = NovaClient(self._os_project_name, self._os_username,
                                      self._os_password)

        self._loggers.stabilityObjstoreLogger.info('初始化默认安全组、外部网络、测试镜像')
        self._default_secgroup_id = getDefaultSecGroupId(
            self._accountResource.get_secgroups(),
            self._readConfig.base.default_secgroup_name)
        self._admin_float_net_id = getAdminFloatNetId(
            self._accountResource.get_adminNets(),
            self._readConfig.base.admin_float_net_name)
        self._test_image_id = getTestImageId(
            self._accountResource.get_images(),
            self._readConfig.base.test_image_name)

        self._zone_names = self._readConfig.base.zone_names.split('||')

        if self._readConfig.executeTest.is_stability_test_objstore.lower(
        ) == 'true':
            self._loggers.stabilityObjstoreLogger.info(
                '===开始初始化对象存储稳定性测试资源===')
            self._initObjectstore()

        self._loggers.stabilityObjstoreLogger.info(
            '将测试初始化资源写入到文件dbs/stabilityObjectStorageTestAccountResource.dbs')
        FileTool.writeObjectIntoFile(
            self._accountResource,
            'dbs/stabilityObjectStorageTestAccountResource.dbs')
Ejemplo n.º 2
0
    def _initResource(self):
        """
        公共资源初始化
        :return:
        """
        self._loggers.stabilitySysbenchLogger.info('初始化命令行客户端')
        self._openstackClient=OpenstackClient(self._os_tenant_name,self._os_project_name,self._os_username,self._os_password)
        self._novaClient=NovaClient(self._os_project_name,self._os_username,self._os_password)
        self._cinderClient=CinderClient(self._os_tenant_name,self._os_project_name,self._os_username,self._os_password)
        self._troveClient = TroveClient(self._os_tenant_name, self._os_project_name, self._os_username,self._os_password)

        self._loggers.stabilitySysbenchLogger.info('初始化默认安全组、测试浮动ip、测试云主机镜像')
        self._default_secgroup_id=getDefaultSecGroupId(self._accountResource.get_secgroups(),self._readConfig.base.default_secgroup_name)
        self._admin_float_net_id=getAdminFloatNetId(self._accountResource.get_adminNets(),self._readConfig.base.admin_float_net_name)
        self._test_image_id=getTestImageId(self._accountResource.get_images(),self._readConfig.base.test_image_name)

        self._zone_names = self._readConfig.base.zone_names.split('||')

        #判断需要测试的类型
        if self._readConfig.executeTest.is_stability_test_memtester.lower()=='true':
            self._loggers.stabilitySysbenchLogger.info('===开始初始化稳定性测试sysbench资源===')
            self._initSysbench()

        self._loggers.stabilitySysbenchLogger.info('将测试初始化资源写入到文件dbs/stabilitySysbenchTestAccountResource.dbs')
        FileTool.writeObjectIntoFile(self._accountResource,'dbs/stabilitySysbenchTestAccountResource.dbs')
Ejemplo n.º 3
0
    def _initResource(self):
        """
        公共资源初始化
        :return:
        """
        self._loggers.basebenchLogger.info('初始化命令行客户端')
        self._openstackClient = OpenstackClient(self._os_tenant_name,
                                                self._os_project_name,
                                                self._os_username,
                                                self._os_password)
        self._novaClient = NovaClient(self._os_project_name, self._os_username,
                                      self._os_password)
        self._cinderClient = CinderClient(self._os_tenant_name,
                                          self._os_project_name,
                                          self._os_username, self._os_password)

        self._loggers.basebenchLogger.info('初始化默认安全组、测试镜像、测试镜像')
        self._default_secgroup_id = getDefaultSecGroupId(
            self._accountResource.get_secgroups(),
            self._readConfig.base.default_secgroup_name)
        self._admin_float_net_id = getAdminFloatNetId(
            self._accountResource.get_adminNets(),
            self._readConfig.base.admin_float_net_name)
        self._test_image_id = getTestImageId(
            self._accountResource.get_images(),
            self._readConfig.base.test_image_name)

        self._loggers.basebenchLogger.info('初始化可用域' +
                                           self._readConfig.base.zone_names)
        self._zone_names = self._readConfig.base.zone_names.split('||')

        #判断需要测试的类型
        if self._readConfig.executeTest.is_basebench_test_fio.lower(
        ) == 'true':
            self._loggers.basebenchLogger.info('===开始初始化fio资源===')
            self._initFio()
        if self._readConfig.executeTest.is_basebench_test_unixbench.lower(
        ) == 'true':
            self._loggers.basebenchLogger.info('===开始初始化unixbench资源===')
            self._initUnixbench()
        if self._readConfig.executeTest.is_basebench_test_iperf.lower(
        ) == 'true':
            self._loggers.basebenchLogger.info('===开始初始化iperf资源===')
            self._initIperf()

            self._loggers.basebenchLogger.info(
                '将测试初始化资源写入到文件dbs/basebenchTestAccountResource.dbs')
        FileTool.writeObjectIntoFile(self._accountResource,
                                     'dbs/basebenchTestAccountResource.dbs')
Ejemplo n.º 4
0
 def run(self):
     testobjectstorage = TestObjectstore()
     objectstoreAccountResource = FileTool.readJsonFromFile(self._accountResourceFilePath)
     compute_array = objectstoreAccountResource['_objectstorage']
     for compute in compute_array:
         tmp_compute = Compute()
         tmp_compute.__dict__=compute
         testobjectstorage.reStart(tmp_compute)
Ejemplo n.º 5
0
 def run(self):
     testMemtester = TestMemtester()
     memtesterAccountResource = FileTool.readJsonFromFile(
         self._accountResourceFilePath)
     compute_array = memtesterAccountResource['_memtesterComputes']
     for compute in compute_array:
         tmp_compute = Compute()
         tmp_compute.__dict__ = compute
         testMemtester.reStart(tmp_compute)
Ejemplo n.º 6
0
 def run(self):
     testUnixbench = TestUnixbench()
     unixbenchAccountResource = FileTool.readJsonFromFile(
         self._accountResourceFilePath)
     compute_array = unixbenchAccountResource['_unixbenchComputes']
     for compute in compute_array:
         tmp_compute = Compute()
         tmp_compute.__dict__ = compute
         testUnixbench.stop(tmp_compute)
Ejemplo n.º 7
0
 def run(self):
     testfio = TestFio()
     fioAccountResource = FileTool.readJsonFromFile(
         self._accountResourceFilePath)
     compute_array = fioAccountResource['_fioComputes']
     for compute in compute_array:
         tmp_compute = Compute()
         tmp_compute.__dict__ = compute
         testfio.stop(tmp_compute)
Ejemplo n.º 8
0
 def run(self):
     testSysbench = TestSysbench()
     sysbenchAccountResource=FileTool.readJsonFromFile(self._accountResourceFilePath)
     sysbench_pair_array=sysbenchAccountResource['_sysbenchComputePairs']
     for sysbench_pair in sysbench_pair_array:
         compute_client=Compute()
         trove_server=Compute()
         compute_client.__dict__ = sysbench_pair[0]
         trove_server.__dict__ = sysbench_pair[1]
         testSysbench.reStart(compute_client,trove_server)
Ejemplo n.º 9
0
    def run(self):
        testLoadbalancer = TestLoadbalancer()
        loadbalancerAccountResource = FileTool.readJsonFromFile(
            self._accountResourceFilePath)
        loadbalancers = loadbalancerAccountResource['_loadbalancers']

        for loadbalancer in loadbalancers:
            loadbalancer_jmeter = LoadBalancer()
            loadbalancer_jmeter.__dict__ = loadbalancer['load_compute']
            testLoadbalancer.stop(loadbalancer_jmeter)
Ejemplo n.º 10
0
 def run(self):
     testSysbench = TestSysbench()
     sysbenchAccountResource = FileTool.readJsonFromFile(
         self._accountResourceFilePath)
     compute_pair_array = sysbenchAccountResource['_sysbenchComputePairs']
     for compute_pair in compute_pair_array:
         compute_client = Compute()
         compute_server = Compute()
         compute_client.__dict__ = compute_pair[0]
         compute_server.__dict__ = compute_pair[1]
         testSysbench.stop(compute_client)
Ejemplo n.º 11
0
 def run(self):
     testIperf = TestIperf()
     iperfAccountResource = FileTool.readJsonFromFile(
         self._accountResourceFilePath)
     compute_pair_array = iperfAccountResource['_iperfComputePairs']
     for compute_pair in compute_pair_array:
         compute_client = Compute()
         compute_server = Compute()
         compute_client.__dict__ = compute_pair[0]
         compute_server.__dict__ = compute_pair[1]
         testIperf.reStart(compute_client, compute_server)
Ejemplo n.º 12
0
    def _initResource(self):
        """
        公共资源初始化
        :return:
        """
        self._loggers.stabilityHeatLogger.info('初始化命令行客户端')
        self._openstackClient = OpenstackClient(self._os_tenant_name,
                                                self._os_project_name,
                                                self._os_username,
                                                self._os_password)
        self._novaClient = NovaClient(self._os_project_name, self._os_username,
                                      self._os_password)
        self._cinderClient = CinderClient(self._os_tenant_name,
                                          self._os_project_name,
                                          self._os_username, self._os_password)
        self._heatClient = HeatClient(self._os_tenant_name,
                                      self._os_project_name, self._os_username,
                                      self._os_password)

        self._loggers.stabilityHeatLogger.info('初始化默认安全组、测试镜像、测试镜像')
        self._default_secgroup_id = getDefaultSecGroupId(
            self._accountResource.get_secgroups(),
            self._readConfig.base.default_secgroup_name)
        self._admin_float_net_id = getAdminFloatNetId(
            self._accountResource.get_adminNets(),
            self._readConfig.base.admin_float_net_name)
        self._test_image_id = getTestImageId(
            self._accountResource.get_images(),
            self._readConfig.base.test_image_name)

        #判断是否进行memtester测试
        if self._readConfig.executeTest.is_stability_test_heat.lower(
        ) == 'true':
            self._loggers.stabilityHeatLogger.info('===开始初始化稳定性测试heat资源===')
            self._initHeat()

            self._loggers.stabilityHeatLogger.info(
                '将测试初始化资源写入到文件dbs/stabilityHeatTestAccountResource.dbs')
        FileTool.writeObjectIntoFile(
            self._accountResource, 'dbs/stabilityHeatTestAccountResource.dbs')
Ejemplo n.º 13
0
    def run(self):
        accountResource = FileTool.readJsonFromFile(
            self._accountResourceFIlePath)
        account_dict = accountResource['_account']
        computes_array = accountResource['_computes']
        volumes_array = accountResource['_volumes']
        floatIps_array = accountResource['_floatIps']
        routers_array = accountResource['_routers']
        nets_array = accountResource['_nets']
        secgroup_array = accountResource['_secgroups']
        loadbalancers_array = accountResource['_loadbalancers']
        sysbench_array = accountResource['_sysbenchComputePairs']
        heat_array = accountResource['_heatComputes']

        free = Free(account_dict)
        self._logger.info('释放数据库实例资源')
        free.freeSysbench(sysbench_array)
        self._logger.info('释放伸缩资源')
        free.freeHeat(heat_array)
        self._logger.info('释放云主机资源')
        free.freeCompute(computes_array)
        self._logger.info('释放负载均衡器资源')
        free.freeLoadbalancer(loadbalancers_array)
        self._logger.info('释放云硬盘资源')
        free.freeVolume(volumes_array)
        self._logger.info('释放浮动IP资源')
        free.freeFloatIp(floatIps_array)
        self._logger.info('释放路由器资源')
        free.freeRouter(routers_array)
        self._logger.info('释放网络资源')
        free.freeNet(nets_array)
        self._logger.info('释放安全组资源')
        free.freeSecgroup(secgroup_array)
        self._logger.info('释放对象存储资源')
        free.freeObejectstore()
        self._logger.info('释放账户')
        free.freeAccount()

        self._logger.info('删除账户资源文件' + self._accountResourceFIlePath)
        os.remove(self._accountResourceFIlePath)
Ejemplo n.º 14
0
    def free(self):
        if not os.path.exists('dbs/basebenchTestAccountResource.dbs'):
            return
        self._loggers.basebenchLogger.info(
            '读取文件' + 'dbs/basebenchTestAccountResource.dbs')
        accountResource = FileTool.readJsonFromFile(
            'dbs/basebenchTestAccountResource.dbs')
        account_dict = accountResource['_account']
        computes_array = accountResource['_computes']
        volumes_array = accountResource['_volumes']
        floatIps_array = accountResource['_floatIps']
        routers_array = accountResource['_routers']
        nets_array = accountResource['_nets']

        self._loggers.basebenchLogger.info(
            '释放账号' + account_dict['os_username'].encode('utf-8') + '资源')
        free = Free(account_dict)
        self._loggers.basebenchLogger.info(
            '释放账号' + account_dict['os_username'].encode('utf-8') + '的云主机资源')
        free.freeCompute(computes_array)
        self._loggers.basebenchLogger.info(
            '释放账号' + account_dict['os_username'].encode('utf-8') + '的云硬盘资源')
        free.freeVolume(volumes_array)
        self._loggers.basebenchLogger.info(
            '释放账号' + account_dict['os_username'].encode('utf-8') + '的浮动IP资源')
        free.freeFloatIp(floatIps_array)
        self._loggers.basebenchLogger.info(
            '释放账号' + account_dict['os_username'].encode('utf-8') + '的路由器资源')
        free.freeRouter(routers_array)
        self._loggers.basebenchLogger.info(
            '释放账号' + account_dict['os_username'].encode('utf-8') + '的网络资源')
        free.freeNet(nets_array)
        self._loggers.basebenchLogger.info(
            '释放账号' + account_dict['os_username'].encode('utf-8') + '账号')
        free.freeAccount()

        self._loggers.basebenchLogger.info(
            '删除文件dbs/basebenchTestAccountResource.dbs')
        os.remove('dbs/basebenchTestAccountResource.dbs')