Ejemplo n.º 1
0
    if hosts:
      for host in hosts:
        print "host name={}, id={}".format(host.name, host.id)
        if host.type == 'Routing':
          if host.resourcestate == 'PrepareForMaintenance' \
              or host.resourcestate == 'Maintenance':
            print "delete host"
            cmd = deleteHost.deleteHostCmd()
            cmd.id = host.id
#            cmd.forced = 'True'
            apiClient.deleteHost(cmd)
          else:
            print "Delete host"
            h = Host(tmp_dict)
#            h.forced = 'True'
            h.id = host.id
            h.delete(apiClient)

    clusters = Cluster.list(apiClient)
    if clusters:
      for cluster in clusters:
        print "cluster name={}, id={}".format(cluster.name, cluster.id)
        if cluster.allocationstate == 'Enabled':
          print "Delete Cluster"
          c = Cluster(tmp_dict)
          c.id = cluster.id
          c.delete(apiClient)

    ipranges = PublicIpRange.list(apiClient)
    if ipranges:
      for iprange in ipranges: