CLOUDSTACK-3074: include support for vmwaredc mapping to zone

vmware dc can be mapped to the zone after CLOUDSTACK-1963. include
support in marvin for adding the vmwaredc.

vmwaredc : {
    name:
    username:
    vcenter:
    password:
    zoneid:
}

Will be sent during pod creation before cluster creation.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
Prasanna Santhanam 2013-06-29 00:38:52 +05:30
parent 87c401aaaf
commit f3e3048682
2 changed files with 24 additions and 2 deletions

View File

@ -105,10 +105,20 @@ class pod(object):
self.endip = None
self.zoneid = None
self.clusters = []
self.vmwaredc = []
'''Used in basic network mode'''
self.guestIpRanges = []
class VmwareDc(object):
def __init__(self):
self.zoneid = None
self.name = None
self.vcenter = None
self.username = None
self.password = None
class cluster(object):
def __init__(self):
self.clustername = None

View File

@ -54,10 +54,22 @@ specify a valid config file" % cfgFile)
hostcmd.hypervisor = hypervisor
self.apiClient.addHost(hostcmd)
def createClusters(self, clusters, zoneId, podId):
def addVmWareDataCenter(self, vmwareDc):
vdc = addVmwareDc.addVmwareDcCmd()
vdc.zoneid = vmwareDc.zoneid
vdc.name = vmwareDc.name
vdc.vcenter = vmwareDc.vcenter
vdc.username = vmwareDc.username
vdc.password = vmwareDc.password
self.apiClient.addVmwareDc(vdc)
def createClusters(self, clusters, zoneId, podId, vmwareDc=None):
if clusters is None:
return
if vmwareDc:
self.addVmWareDataCenter(vmwareDc)
for cluster in clusters:
clustercmd = addCluster.addClusterCmd()
clustercmd.clustername = cluster.clustername
@ -108,7 +120,7 @@ specify a valid config file" % cfgFile)
self.createVlanIpRanges("Basic", pod.guestIpRanges, zoneId,
podId, networkId)
self.createClusters(pod.clusters, zoneId, podId)
self.createClusters(pod.clusters, zoneId, podId, vmwareDc=pod.vmwaredc)
def createVlanIpRanges(self, mode, ipranges, zoneId, podId=None,
networkId=None, forvirtualnetwork=None):