THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
import random
import marvin
from marvin.configGenerator import *
def describeResources():
zs = cloudstackConfiguration()
z = zone()
z.dns1 = '10.147.28.6'
z.internaldns1 = '10.147.28.6'
z.name = 'Sandbox-XenServer'
z.networktype = 'Advanced'
z.guestcidraddress = '10.1.1.0/24'
pn = physicalNetwork()
pn.name = "test-network"
pn.traffictypes = [traffictype("Guest"), traffictype("Management"), traffictype("Public")]
z.physical_networks.append(pn)
p = pod()
p.name = 'POD0'
p.gateway = '10.147.29.1'
p.startip = '10.147.29.150'
p.endip = '10.147.29.159'
p.netmask = '255.255.255.0'
v = iprange()
v.gateway = '10.147.31.1'
v.startip = '10.147.31.150'
v.endip = '10.147.31.159'
v.netmask = '255.255.255.0'
v.vlan = '31'
z.ipranges.append(v)
c = cluster()
c.clustername = 'C0'
c.hypervisor = 'XenServer'
c.clustertype = 'CloudManaged'
h = host()
h.username = 'root'
h.password = 'password'
h.url = 'http://10.147.29.58'
c.hosts.append(h)
ps = primaryStorage()
ps.name = 'PS0'
ps.url = 'nfs://10.147.28.6:/export/home/sandbox/primary'
c.primaryStorages.append(ps)
p.clusters.append(c)
z.pods.append(p)
secondary = secondaryStorage()
secondary.url = 'nfs://10.147.28.6:/export/home/sandbox/secondary'
z.secondaryStorages.append(secondary)
'''Add zone'''
zs.zones.append(z)
'''Add mgt server'''
mgt = managementServer()
mgt.mgtSvrIp = '10.147.29.111'
zs.mgtSvr.append(mgt)
'''Add a database'''
db = dbServer()
db.dbSvr = '10.147.29.111'
db.user = 'cloud'
db.passwd = 'cloud'
zs.dbSvr = db
'''Add some configuration'''
[zs.globalConfig.append(cfg) for cfg in getGlobalSettings()]
''''add loggers'''
testLogger = logger()
testLogger.logFolderPath = '/tmp/'
zs.logger = testLogger
return zs
def getGlobalSettings():
globals = { "storage.cleanup.interval" : "300",
"account.cleanup.interval" : "60",
}
for k, v in globals.iteritems():
cfg = configuration()
cfg.name = k
cfg.value = v
yield cfg
if __name__ == '__main__':
config = describeResources()
generate_setup_config(config, 'advanced_cloud.cfg')
|
...