need to update configuration

This commit is contained in:
Edison Su 2011-08-17 18:21:50 -07:00
parent fdedbbc00e
commit 1a82fd46b2
2 changed files with 30 additions and 2 deletions

View File

@ -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"

View File

@ -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__":