You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Existing Global configuration parameter settings:

CloudStack provides a variety of settings you can use to set values, limits, configure features, and enable or disable features in the cloud.

Once your Management Server is running, you might need to set some of these global configuration parameters, depending on configuration you want at the global level, which will be in effect throughout the cloud and we need to restart the Management server after changing the values to get effected.

New Framework to allow lower level configuration settings:

Our new framework allows us to define some configuration parameters at lower level (account, zone, cluster, or primary storage), which will override the global configuration parameter values.

We provide some methods in ConfigurationServer interface using which we can get the value of configuration parameter from the DB based on the scope.

Change in Interface:

New methods are introduced getConfigValue() and getConfigListByScope()

public interface ConfigurationServer {
    public static final String Name = "configuration-server";

    /**
     * Persists default values for the configuration table, pods/zones, and VLANs
     *
     * @return
     */
    public void persistDefaultValues() throws InternalErrorException;
    public void updateKeyPairs();

    /**
     * get the value of configuration parameter at the scope given for the corresponding resource level (account, zone, cluster, or primary storage)
     * If either scope or resourceId is not specified then get the global value
     * @param name
     *             configuration parameter name
     * @param scope
     *             Scope at which parameter value is defined (account, zone, cluster, or primary storage)
     * @param resourceId
     *             id of the resource (account, zone, cluster, or primary storage)
     * @return value of the configuration parameter 
     */
    public String getConfigValue(String name, String scope, Long resourceId);

    /**
     * get the list of configuration parameters and values at the scope given for the corresponding resource level (account, zone, cluster, or primary storage)
     * If either scope or resourceId is not specified then get the global value
     * @param scope
     *             Scope at which parameter value is defined (account, zone, cluster, or primary storage)
     * @param resourceId
     *             id of the resource (account, zone, cluster, or primary storage)
     * @return list of the configuration parameters and values 
     */
    public List<ConfigurationVO> getConfigListByScope(String scope, Long resourceId);
}

To get the value of a parameter at particular scope

                      @Inject ConfigurationServer _configServer;

1) Get the value of "mem.overprovisioning.factor" defined at cluster (id=3)

                      overProvisioinigFactor = Float.parseFloat(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), clusterId));

2) Get the value of "mem.overprovisioning.factor" defined at global level

                      overProvisioinigFactor = Float.parseFloat(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), null, null));

How to define Scope of a configuration parameter:

We have defined an enum to mention the scope in Config.java

public static enum ConfigurationParameterScope {
    global,
    zone,
    cluster,
    storagepool,
    account
}

Just add the corresponding scope at the end of the configuration parameter enum value.

Example: MemOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "mem.overprovisioning.factor", "1", "Used for memory overprovisioning calculation", null, ConfigurationParameterScope.cluster.toString()),

Update value of configuration parameter:

To update a configuration parameter at particular scope

API name

Existing API Parameters

New optional API Parameters

API Response

updateConfiguration

name: the name of the configuration
value: the value of the configuration

zoneid: ID of the zone
clusterid: ID of the cluster
storageid: ID of the storagepool
accountid: ID of the acount

updateconfigurationresponse with scope and updated value 

Example: http://localhost:8096/client/api?command=updateConfiguration&name=mem.overprovisioning.factor&value=2&clusterid=a69d292a-c1e7-4630-8acf-58e955859ab6

To list configuration parameter at particular scope

API name

Existing API Parameters

New optional API Parameters

API Response

listConfiguration

category: lists configurations by category
name: lists configuration by name

zoneid: ID of the zone
clusterid: ID of the cluster
storageid: ID of the storagepool
accountid: ID of the acount

listconfigurationsresponse with scope and value at the corresponding scope of the parameters.

Example: To list the parameter values defined at zone id b7aa7e8c-78b1-49f2-9876-aa25a728276d

                http://localhost:8096/client/api?command=listConfigurations&zoneid=b7aa7e8c-78b1-49f2-9876-aa25a728276d

TO DO:

1) Improve the framework to support defining a parameter at multiple scopes (account, zone, cluster, or primary storage)

2) To maintain a local cache of configuration parameter values. All consumers of config parameters should access config values from this cache. Cache should get updated whenever the value in DB is gets updated.

  • No labels