lxd/api_cluster.go
func clusterGetMemberConfig(cluster *db.Cluster) ([]api.ClusterMemberConfigKey, error) {
	var pools map[string]map[string]string
	var networks map[string]map[string]string

	keys := []api.ClusterMemberConfigKey{}

	err := cluster.Transaction(func(tx *db.ClusterTx) error {
		var err error

		pools, err = tx.StoragePoolsNodeConfig()
		if err != nil {
			return errors.Wrapf(err, "Failed to fetch storage pools configuration")
		}

		networks, err = tx.NetworksNodeConfig()
		if err != nil {
			return errors.Wrapf(err, "Failed to fetch networks configuration")
		}

		return nil
	})
	if err != nil {
		return nil, err
	}

	for pool, config := range pools {
		for key := range config {
			if strings.HasPrefix(key, "volatile.") {
				continue
			}

			key := api.ClusterMemberConfigKey{
				Entity:      "storage-pool",
				Name:        pool,
				Key:         key,
				Description: fmt.Sprintf("\"%s\" property for storage pool \"%s\"", key, pool),
			}
			keys = append(keys, key)
		}
	}

	for network, config := range networks {
		for key := range config {
			if strings.HasPrefix(key, "volatile.") {
				continue
			}

			key := api.ClusterMemberConfigKey{
				Entity:      "network",
				Name:        network,
				Key:         key,
				Description: fmt.Sprintf("\"%s\" property for network \"%s\"", key, network),
			}
			keys = append(keys, key)
		}
	}

	return keys, nil
}
func clusterGetMemberConfig(cluster *db.Cluster) ([]api.ClusterMemberConfigKey, error) {
	var pools map[string]map[string]string
	var networks map[string]map[string]string

	keys := []api.ClusterMemberConfigKey{}

	err := cluster.Transaction(func(tx *db.ClusterTx) error {
		var err error

		pools, err = tx.StoragePoolsNodeConfig()
		if err != nil {
			return errors.Wrapf(err, "Failed to fetch storage pools configuration")
		}

		networks, err = tx.NetworksNodeConfig()
		if err != nil {
			return errors.Wrapf(err, "Failed to fetch networks configuration")
		}

		return nil
	})
	if err != nil {
		return nil, err
	}

	for pool, config := range pools {
		for key := range config {
			if strings.HasPrefix(key, "volatile.") {
				continue
			}

			key := api.ClusterMemberConfigKey{
				Entity:      "storage-pool",
				Name:        pool,
				Key:         key,
				Description: fmt.Sprintf("\"%s\" property for storage pool \"%s\"", key, pool),
			}
			keys = append(keys, key)
		}
	}

	for network, config := range networks {
		for key := range config {
			if strings.HasPrefix(key, "volatile.") {
				continue
			}

			key := api.ClusterMemberConfigKey{
				Entity:      "network",
				Name:        network,
				Key:         key,
				Description: fmt.Sprintf("\"%s\" property for network \"%s\"", key, network),
			}
			keys = append(keys, key)
		}
	}

	return keys, nil
}
func clusterGetMemberConfig ( cluster * db . Cluster ) ( [ ] api . ClusterMemberConfigKey , error ) { var pools map [ string ] map [ string ] string var networks map [ string ] map [ string ] string keys := [ ] api . ClusterMemberConfigKey { } err := cluster . Transaction ( func ( tx * db . ClusterTx ) error { var err error pools , err = tx . StoragePoolsNodeConfig ( ) if err != nil { return errors . Wrapf ( err , " " ) } networks , err = tx . NetworksNodeConfig ( ) if err != nil { return errors . Wrapf ( err , " " ) } return nil } ) if err != nil { return nil , err } for pool , config := range pools { for key := range config { if strings . HasPrefix ( key , " " ) { continue } key := api . ClusterMemberConfigKey { Entity : " " , Name : pool , Key : key , Description : fmt . Sprintf ( " \" \" \" \" " , key , pool ) , } keys = append ( keys , key ) } } for network , config := range networks { for key := range config { if strings . HasPrefix ( key , " " ) { continue } key := api . ClusterMemberConfigKey { Entity : " " , Name : network , Key : key , Description : fmt . Sprintf ( " \" \" \" \" " , key , network ) , } keys = append ( keys , key ) } } return keys , nil }
// Fetch information about all node-specific configuration keys set on the
// storage pools and networks of this cluster.
Fetch information about all node - specific configuration keys set on the storage pools and networks of this cluster .