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]
	except urllib2.HTTPError, e:
	   print "addCluster Failed : " + str(e.msg)
	print "Cluster " + xencluster.name + " created for " + xencluster.hypervisortype + " hypervisors"


	# Add Xen Host (Pool)
	addXen = addHost.addHostCmd()
	addXen.hypervisor = "XenServer"
	addXen.zoneid     = zone.id
	addXen.podid      = pod.id
	addXen.clusterid  = xencluster.id
	addXen.url        = "http://192.168.56.11"
	addXen.username   = "******"
	addXen.password   = "******"
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]
    except urllib2.HTTPError, e:
        print "addCluster Failed : " + str(e.msg)
    print "Cluster " + xencluster.name + " created for " + xencluster.hypervisortype + " hypervisors"

    # Add Xen Host (Pool)
    addXen = addHost.addHostCmd()
    addXen.hypervisor = "XenServer"
    addXen.zoneid = zone.id
    addXen.podid = pod.id
    addXen.clusterid = xencluster.id
    addXen.url = "http://192.168.56.10"
    addXen.username = "******"
    addXen.password = "******"
    try: