createPod.startip = "192.168.56.100"
createPod.endip   = "192.168.56.119"
createPod.gateway = "192.168.56.2"
createPod.netmask = "255.255.255.0"
try:
    pod = apiclient.createPod(createPod)
except urllib2.HTTPError, e:
   print "createPodCmd Failed : " + str(e.msg)
print "Pod " + pod.name + " created"

# Add secondary storage
addSecondary = addSecondaryStorage.addSecondaryStorageCmd()
addSecondary.zoneid = zone.id
addSecondary.url    = "nfs://192.168.56.9/export/secondary"
try:
    secstor = apiclient.addSecondaryStorage(addSecondary)
except urllib2.HTTPError, e:
   print "addCluster Failed : " + str(e.msg)
print "Secondary storage added : " + secstor.name

if (config.get('hypervisor_type') == "XenServer") :
	# Add XenCluster
	addCluster = addCluster.addClusterCmd()
	addCluster.clustername = "XenCluster"
	addCluster.clustertype = "CloudManaged"
	addCluster.hypervisor  = "XenServer"
	addCluster.podid       = pod.id
	addCluster.zoneid      = zone.id
	try:
		resp = apiclient.addCluster(addCluster)
		xencluster = resp[0]
createPod.startip = "192.168.56.100"
createPod.endip = "192.168.56.119"
createPod.gateway = "192.168.56.2"
createPod.netmask = "255.255.255.0"
try:
    pod = apiclient.createPod(createPod)
except urllib2.HTTPError, e:
    print "createPodCmd Failed : " + str(e.msg)
print "Pod " + pod.name + " created"

# Add secondary storage
addSecondary = addSecondaryStorage.addSecondaryStorageCmd()
addSecondary.zoneid = zone.id
addSecondary.url = "nfs://192.168.56.5/exports/secondary"
try:
    secstor = apiclient.addSecondaryStorage(addSecondary)
except urllib2.HTTPError, e:
    print "addCluster Failed : " + str(e.msg)
print "Secondary storage added : " + secstor.name

if (config.get('hypervisor_type') == "XenServer"):
    # Add XenCluster
    addCluster = addCluster.addClusterCmd()
    addCluster.clustername = "XenCluster"
    addCluster.clustertype = "CloudManaged"
    addCluster.hypervisor = "XenServer"
    addCluster.podid = pod.id
    addCluster.zoneid = zone.id
    try:
        resp = apiclient.addCluster(addCluster)
        xencluster = resp[0]