From 1a82fd46b2410f201e9592108613a4d6859ca7c2 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Wed, 17 Aug 2011 18:21:50 -0700 Subject: [PATCH] need to update configuration --- tools/testClient/configGenerator.py | 18 +++++++++++++++++- tools/testClient/deployDataCenter.py | 14 +++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tools/testClient/configGenerator.py b/tools/testClient/configGenerator.py index fa4e1052143..f23f18c77ce 100644 --- a/tools/testClient/configGenerator.py +++ b/tools/testClient/configGenerator.py @@ -224,14 +224,19 @@ def describe_setup_in_basic_mode(): h = host() h.username = "root" h.password = "password" + memory = 8*1024*1024*1024 + localstorage=1*1024*1024*1024*1024 + #h.url = "http://Sim/%d%d%d%d/cpucore=1&cpuspeed=8000&memory=%d&localstorage=%d"%(l,i,j,k,memory,localstorage) h.url = "http://Sim/%d%d%d%d"%(l,i,j,k) c.hosts.append(h) '''add 2 primary storages''' for m in range(2): primary = primaryStorage() + size=1*1024*1024*1024*1024 primary.name = "primary"+str(l) + str(i) + str(j) + str(m) - primary.url = "nfs://localhost/path"+str(l) + str(i) + str(j) + str(m) + #primary.url = "nfs://localhost/path%s/size=%d"%(str(l) + str(i) + str(j) + str(m), size) + primary.url = "nfs://localhost/path%s"%(str(l) + str(i) + str(j) + str(m)) c.primaryStorages.append(primary) p.clusters.append(c) @@ -257,6 +262,17 @@ def describe_setup_in_basic_mode(): zs.dbSvr = db + '''add global configuration''' + global_settings = {'expunge.delay': '60', + 'expunge.interval': '60', + 'expunge.workers': '3', + } + for k,v in global_settings.iteritems(): + cfg = configuration() + cfg.name = k + cfg.value = v + zs.globalConfig.append(cfg) + ''''add loggers''' testClientLogger = logger() testClientLogger.name = "TestClient" diff --git a/tools/testClient/deployDataCenter.py b/tools/testClient/deployDataCenter.py index ea73c549378..3cea6062bc1 100644 --- a/tools/testClient/deployDataCenter.py +++ b/tools/testClient/deployDataCenter.py @@ -169,7 +169,7 @@ class deployDataCenters(): try: self.config = configGenerator.get_setup_config(self.configFile) except: - raise cloudstackException.InvalidParameterException("Failed to load cofig" + sys.exc_value) + raise cloudstackException.InvalidParameterException("Failed to load cofig" + sys.exc_info()) mgt = self.config.mgtSvr[0] @@ -199,9 +199,21 @@ class deployDataCenters(): dbSvr = self.config.dbSvr self.testClient.dbConfigure(dbSvr.dbSvr, dbSvr.port, dbSvr.user, dbSvr.passwd, dbSvr.db) self.apiClient = self.testClient.getApiClient() + + def updateConfiguration(self, globalCfg): + if len(globalCfg) == 0: + return None + + for config in globalCfg: + updateCfg = updateConfiguration.updateConfigurationCmd() + updateCfg.name = config.name + updateCfg.value = config.value + self.apiClient.updateConfiguration(updateCfg) + def deploy(self): self.loadCfg() self.createZones(self.config.zones) + self.updateConfiguration(self.config.globalConfig) if __name__ == "__main__":