def run(self, options):
     if self.__should_deploy_data_center(options):
         configuration = configGenerator.getSetupConfig(options.input)
         test_client = self.create_test_client(configuration)
         deploy = DeployDataCenters(test_client, configuration)
         if deploy.deploy() == FAILED:
             raise Exception("Deploy data center failed")
     elif self.__should_remove_data_center(options):
         configuration = configGenerator.getSetupConfig(options.remove)
         test_client = self.create_test_client(configuration)
         remove = DeleteDataCenters(test_client, configuration)
         if remove.removeDataCenter() == FAILED:
             raise Exception("Removing DataCenter Failed")
     else:
         raise Exception("Can't decide on what to do")
Пример #2
0
 def run(self, options):
     if self.__should_deploy_data_center(options):
         configuration = configGenerator.getSetupConfig(options.input)
         test_client = self.create_test_client(configuration)
         deploy = DeployDataCenters(test_client, configuration)
         if deploy.deploy() == FAILED:
             raise Exception("Deploy data center failed")
     elif self.__should_remove_data_center(options):
         configuration = configGenerator.getSetupConfig(options.remove)
         test_client = self.create_test_client(configuration)
         remove = DeleteDataCenters(test_client, configuration)
         if remove.removeDataCenter() == FAILED:
             raise Exception("Removing DataCenter Failed")
     else:
         raise Exception("Can't decide on what to do")
Пример #3
0
    def loadCfg(self):
        try:
            self.config = configGenerator.getSetupConfig(self.configFile)
        except:
            raise cloudstackException.InvalidParameterException(
                "Failed to load config %s" % self.configFile)
        ''' Retrieving Management Server Connection Details '''
        mgtDetails = self.config.mgtSvr[0]
        ''' Retrieving Database Connection Details'''
        dbSvrDetails = self.config.dbSvr
        loggers = self.config.logger
        testClientLogFile = None
        self.testCaseLogFile = None
        self.testResultLogFile = None
        if loggers is not None and len(loggers) > 0:
            for log in loggers:
                if log.name == "TestClient":
                    testClientLogFile = log.file
                elif log.name == "TestCase":
                    self.testCaseLogFile = log.file
                elif log.name == "TestResult":
                    self.testResultLogFile = log.file

        testClientLogger = None
        if testClientLogFile is not None:
            testClientLogger = logging.getLogger("testclient.testengine.run")
            fh = logging.FileHandler(testClientLogFile)
            fh.setFormatter(
                logging.Formatter(
                    "%(asctime)s - %(levelname)s - %(name)s\ - %(message)s"))
            testClientLogger.addHandler(fh)
            testClientLogger.setLevel(logging.INFO)
        self.testClientLogger = testClientLogger

        self.testClient = \
            cloudstackTestClient.\
            cloudstackTestClient(mgtDetails,
                                 dbSvrDetails,
                                 logging=self.testClientLogger)

        if mgtDetails.apiKey is None:
            mgtDetails.apiKey, mgtDetails.securityKey = self.registerApiKey()
            mgtDetails.port = 8080
            self.testClient = \
                cloudstackTestClient.cloudstackTestClient(
                    mgtDetails,
                    dbSvrDetails,
                    logging=
                    self.testClientLogger)

        self.apiClient = self.testClient.getApiClient()
        """set hypervisor"""
        if mgtDetails.hypervisor:
            self.apiClient.hypervisor = mgtDetails.hypervisor
        else:
            self.apiClient.hypervisor = "XenServer"  # Defaults to Xenserver
Пример #4
0
    def deploy(self):
        self.loadCfg()
        self.updateConfiguration(self.config.globalConfig)
        self.createZones(self.config.zones)
        self.configureS3(self.config.s3)

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-i", "--input", action="store",
                      default="./datacenterCfg", dest="input", help="the path \
                      where the json config file generated, by default is \
                      ./datacenterCfg")

    (options, args) = parser.parse_args()
    from marvin.marvinLog import MarvinLog
    cfg = configGenerator.getSetupConfig(options.input)
    log_obj = MarvinLog("CSLog")
    tcRunLogger = log_obj.setLogHandler("/tmp/debug.log")
    deploy = deployDataCenters(cfg, tcRunLogger)
    deploy.deploy()

    """
    create = createStoragePool.createStoragePoolCmd()
    create.clusterid = 1
    create.podid = 2
    create.name = "fdffdf"
    create.url = "nfs://jfkdjf/fdkjfkd"
    create.zoneid = 2

    deploy = deployDataCenters("./datacenterCfg")
    deploy.loadCfg()
Пример #5
0

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-i",
                      "--input",
                      action="store",
                      default="./datacenterCfg",
                      dest="input",
                      help="the path \
                      where the json config file generated, by default is \
                      ./datacenterCfg")

    (options, args) = parser.parse_args()
    from marvin.marvinLog import MarvinLog
    cfg = configGenerator.getSetupConfig(options.input)
    log_obj = MarvinLog("CSLog")
    tcRunLogger = log_obj.setLogHandler("/tmp/debug.log")
    deploy = deployDataCenters(cfg, tcRunLogger)
    deploy.deploy()
    """
    create = createStoragePool.createStoragePoolCmd()
    create.clusterid = 1
    create.podid = 2
    create.name = "fdffdf"
    create.url = "nfs://jfkdjf/fdkjfkd"
    create.zoneid = 2

    deploy = deployDataCenters("./datacenterCfg")
    deploy.loadCfg()
    deploy.apiClient.createStoragePool(create)