lxd/api_cluster.go
func clusterGet(d *Daemon, r *http.Request) Response {
	name := ""
	err := d.cluster.Transaction(func(tx *db.ClusterTx) error {
		var err error
		name, err = tx.NodeName()
		return err
	})
	if err != nil {
		return SmartError(err)
	}

	// If the name is set to the hard-coded default node name, then
	// clustering is not enabled.
	if name == "none" {
		name = ""
	}

	memberConfig, err := clusterGetMemberConfig(d.cluster)
	if err != nil {
		return SmartError(err)
	}

	cluster := api.Cluster{
		ServerName:   name,
		Enabled:      name != "",
		MemberConfig: memberConfig,
	}

	return SyncResponseETag(true, cluster, cluster)
}
func clusterGet(d *Daemon, r *http.Request) Response {
	name := ""
	err := d.cluster.Transaction(func(tx *db.ClusterTx) error {
		var err error
		name, err = tx.NodeName()
		return err
	})
	if err != nil {
		return SmartError(err)
	}

	// If the name is set to the hard-coded default node name, then
	// clustering is not enabled.
	if name == "none" {
		name = ""
	}

	memberConfig, err := clusterGetMemberConfig(d.cluster)
	if err != nil {
		return SmartError(err)
	}

	cluster := api.Cluster{
		ServerName:   name,
		Enabled:      name != "",
		MemberConfig: memberConfig,
	}

	return SyncResponseETag(true, cluster, cluster)
}
func clusterGet ( d * Daemon , r * http . Request ) Response { name := " " err := d . cluster . Transaction ( func ( tx * db . ClusterTx ) error { var err error name , err = tx . NodeName ( ) return err } ) if err != nil { return SmartError ( err ) } // If the name is set to the hard-coded default node name, then // clustering is not enabled. if name == " " { name = " " } memberConfig , err := clusterGetMemberConfig ( d . cluster ) if err != nil { return SmartError ( err ) } cluster := api . Cluster { ServerName : name , Enabled : name != " " , MemberConfig : memberConfig , } return SyncResponseETag ( true , cluster , cluster ) }
// Return information about the cluster.
Return information about the cluster .