func GetAllServers(w rest.ResponseWriter, r *rest.Request) {
	dbConn, err := util.GetConnection(CLUSTERADMIN_DB)
	if err != nil {
		logit.Error.Println("BackupNow: error " + err.Error())
		rest.Error(w, err.Error(), 400)
		return

	}
	defer dbConn.Close()
	err = secimpl.Authorize(dbConn, r.PathParam("Token"), "perm-read")
	if err != nil {
		logit.Error.Println("GetAllServers: authorize error " + err.Error())
		rest.Error(w, err.Error(), http.StatusUnauthorized)
		return
	}

	results, err := admindb.GetAllServers(dbConn)
	if err != nil {
		logit.Error.Println("GetAllServers: " + err.Error())
		rest.Error(w, err.Error(), http.StatusBadRequest)
	}
	servers := make([]Server, len(results))
	i := 0
	for i = range results {
		servers[i].ID = results[i].ID
		servers[i].Name = results[i].Name
		servers[i].IPAddress = results[i].IPAddress
		servers[i].DockerBridgeIP = results[i].DockerBridgeIP
		servers[i].PGDataPath = results[i].PGDataPath
		servers[i].ServerClass = results[i].ServerClass
		servers[i].CreateDate = results[i].CreateDate
		i++
	}

	w.WriteJson(&servers)
}
func Hba(dbConn *sql.DB, mode string, hostname string, port string, clusterid string, domainname string, cars []Rule) (string, error) {

	var hbaInfo HBAParameters

	hbaInfo.PG_HOST_IP = hostname + "." + domainname
	hbaInfo.BACKUP_HOST = hostname + "-backup." + domainname
	hbaInfo.MONITOR_HOST = "cpm-mon." + domainname
	hbaInfo.ADMIN_HOST = "cpm-admin." + domainname
	hbaInfo.RULES_LIST = cars

	servers, err := admindb.GetAllServers(dbConn)
	if err != nil {
		logit.Error.Println("Hba:" + err.Error())
		return "", err
	}

	i := 0
	var allservers = ""
	var allbridges = ""
	for i = range servers {
		logit.Info.Println("Hba:" + servers[i].IPAddress)
		if allservers == "" {
			allservers = servers[i].IPAddress
			allbridges = servers[i].DockerBridgeIP
		} else {
			allservers = allservers + ":" + servers[i].IPAddress
			allbridges = allbridges + ":" + servers[i].DockerBridgeIP
		}
	}
	logit.Info.Println("Hba:processing serverlist=" + allservers)
	hbaInfo.SERVER_IP_LIST = strings.Split(allservers, ":")
	hbaInfo.BRIDGE_IP_LIST = strings.Split(allbridges, ":")

	var path string
	switch mode {
	case "unassigned":
		path = util.GetBase() + "/conf/standalone/pg_hba.conf.template"
	case "standalone", "master", "standby":
		path = util.GetBase() + "/conf/" + mode + "/pg_hba.conf.template"
	default:
		return "", errors.New("invalid mode in processHba of " + mode)
	}

	if mode == "standby" || mode == "master" {
		_, pgpoolNode, standbyList, err := getMasterValues(dbConn, clusterid, domainname)
		if err != nil {
			return "", err
		}

		hbaInfo.PGPOOL_HOST = pgpoolNode.Name + "." + domainname
		hbaInfo.STANDBY_LIST = standbyList
	}

	contents, err := ioutil.ReadFile(path)
	if err != nil {
		return "", err
	}

	tmpl, err := template.New("hba").Parse(string(contents))
	if err != nil {
		return "", err
	}
	buff := bytes.NewBufferString("")

	logInfo(hbaInfo)

	err = tmpl.Execute(buff, hbaInfo)
	logit.Info.Println("Hba:" + buff.String())

	return buff.String(), nil
}