Product SiteDocumentation Site

Capitolo 8. Regole

Indice

8.1. Espressioni relative agli attributi del nodo
8.2. Espressioni basate su Ora/Data
8.2.1. Dichiarare date
8.2.2. Durate
8.3. Espressioni temporali di esempio
8.4. Utilizzare regole per determinare il posizionamento delle risorse
8.4.1. Utilizzo di score-attribute invece di score
8.5. Utilizzare regole per controllare le opzioni delle risorse
8.6. Utilizzare le regole per controllare le opzioni del cluster
8.7. Assicurarsi che le regole basate sugli orari abbiano effetto
Rules can be used to make your configuration more dynamic. One common example is to set one value for resource-stickiness during working hours, to prevent resources from being moved back to their most preferred location, and another on weekends when no-one is around to notice an outage.
Un'altra regola impostabile potrebbe essere quella di assegnare le macchine a differenti gruppi di processo (utilizzando gli attributi del nodo) basati sulle tempistiche ed utilizzare quindi questi attributi nella creazione delle constraint di tipo location.
Each rule can contain a number of expressions, date-expressions and even other rules. The results of the expressions are combined based on the rule’s boolean-op field to determine if the rule ultimately evaluates to true or false. What happens next depends on the context in which the rule is being used.

Tabella 8.1. Proprietà di una regola

Campo Descrizione
role
Limits the rule to apply only when the resource is in that role. Allowed values: Started, Slave, and Master. NOTE: A rule with role="Master" can not determine the initial location of a clone instance. It will only affect which of the active instances will be promoted.
score
The score to apply if the rule evaluates to true. Limited to use in rules that are part of location constraints.
score-attribute
The node attribute to look up and use as a score if the rule evaluates to true. Limited to use in rules that are part of location constraints.
boolean-op
How to combine the result of multiple expression objects. Allowed values: and and or.

8.1. Espressioni relative agli attributi del nodo

Gli oggetti espressione sono utilizzati per controllare una risorsa basata sugli attributi definiti da uno o più nodi. In aggiunta a qualsiasi attributo aggiunto dall'amministratore, ogni nodo possiede un attributo predefinito che può essere utilizzato chiamato #uname.

Tabella 8.2. Proprietà di un'espressione

Campo Descrizione
value
User supplied value for comparison
attribute
The node attribute to test
type
Determines how the value(s) should be tested. Allowed values: string, integer, version
operation
Il confronto da effettuare. Valori permessi:
* lt - True if the node attribute’s value is less than value
* gt - True if the node attribute’s value is greater than value
* lte - True if the node attribute’s value is less than or equal to value
* gte - True if the node attribute’s value is greater than or equal to value
* eq - True if the node attribute’s value is equal to value
* ne - True if the node attribute’s value is not equal to value
* defined - True if the node has the named attribute
* not_defined - True if the node does not have the named attribute