Enabling and disabling resource policies
Limitations
- In rare cases, enabling both policies may cause a VM to be migrated twice. The fewer VMs participate in dynamic consolidation, the less frequently double migrations will occur.
- Non-tagged VMs may occasionally remain on the same node as tagged VMs, even when segregation is enabled. This can occur because segregation migrations are scheduled as the final step in policy application. For example, if no other nodes have sufficient resources to host a non-tagged VM, it will stay on a node with tagged VMs.
- With dynamic consolidation enabled, the system avoids placing non-tagged VMs on nodes that host tagged VMs, when possible.
Prerequisites
- The resource policy service is installed, as described in Using resource policies.
- A clear understanding of the resource policy settings, which are explained in Resource policy examples.
To enable dynamic consolidation
Admin panel
- On the Compute > Resource policies > Policies screen, click the line with the Dynamic consolidation policy.
-
In the Settings field, click the pencil icon and edit the policy settings according to the desired goal:
-
Choose the policy mode:
- Manual mode implies that you will apply recommendations manually.
- Automatic mode allows applying recommendations automatically once they are found.
- Change the time interval between analysis runs. The default interval is 1440 minutes, that is one day.
- Enable or disable segregation of tagged and non-tagged VMs across the nodes.
-
- Click Enable and specify a list of comma-separated tags that will be used for VM consolidation. For example: windows, oracle. Note that the tag order indicates priority.
Now, you can start creating virtual machines and assign tags to them.
Command-line interface
-
Enable the
Dynamic consolidationpolicy and specify VM tags. For example:# vinfra service compute resource-policies policy enable "Dynamic consolidation" --tags windows,oracle
-
Edit the policy parameters by using the following command:
vinfra service compute resource-policies policy set [--auto-trigger <auto-trigger>] [--interval <interval>] [--max-migrations <max_migrations>] [--max-freed-host-tags <max_freed_host_tags>] [--min-freed-host-tags <min_freed_host_tags>] [--enable-distribution] [--randomize] <policy>--auto-trigger <auto-trigger>- Automatically apply recommendations when the policy succeeds (yes or no).
--interval <interval>- Time interval between analysis runs (in seconds).
--max-migrations <max_migrations>- Maximum number of migrations per analysis.
--max-freed-host-tags <max_freed_host_tags>- Maximum number of tags to free.
--min-freed-host-tags <min_freed_host_tags>- Minimum number of tags to free.
--enable-distribution- Enable VM distribution.
--randomize- Handle tags in random order. If not specified, the tag order indicates priority.
<policy>- Policy name or ID
For example, to change the policy mode to automatic and the interval to five hours, and also enable segregation, run:
# vinfra service compute resource-policies policy set "Dynamic consolidation" --auto-trigger yes --interval 18000 --enable-distribution
-
Check the policy parameters by running:
# vinfra service compute resource-policies policy show "Dynamic consolidation" +---------------+-----------------------------------------------------------------------+ | Field | Value | +---------------+-----------------------------------------------------------------------+ | auto_trigger | True | | created_at | 2025-03-19T14:05:28.926096+00:00 | | description | Ensures marked VMs run on the minimum necessary set of compute nodes. | | enabled | True | | hostname | node001.vstoragedomain | | id | 23f3e4e5-780f-4384-b308-0660f6710b94 | | interval | 18000 | | name | Dynamic consolidation | | next_run_time | 2025-03-21T19:34:07.738879 | | parameters | enable_distribution: true | | | max_freed_host_tags: 100 | | | max_migrations: 250 | | | min_freed_host_tags: 0 | | | randomize: false | | paused | False | | policy_type | tagged_server_consolidation | | state | ONGOING | | updated_at | 2025-03-21T14:34:07.753151+00:00 | +---------------+-----------------------------------------------------------------------+
Now, you can start creating VMs and assigning them the windows or oracle tags. For example:
# vinfra service compute server create windows_vm --network id=public,fixed-ip=10.10.10.100 \ --volume source=image,id=windows,size=64 --flavor medium --tags windows
To enable dynamic distribution
Admin panel
- On the Compute > Resource policies > Policies screen, click the line with the Dynamic distribution policy.
-
In the Settings field, click the pencil icon and edit the policy settings according to the desired goal:
-
Choose the policy mode:
- Manual mode implies that you will apply recommendations manually.
-
Automatic mode allows applying recommendations automatically once they are found.
Enabling the dynamic distribution policy in automatic mode may trigger a large number of VM migrations, potentially affecting service levels.
- Change the time interval between analysis runs. The default interval is 1440 minutes, that is one day.
- Set the desired values to the remaining parameters.
-
- Click Enable to enable the policy.
Command-line interface
-
Enable the
Dynamic distributionpolicy:# vinfra service compute resource-policies policy enable "Dynamic distribution"
-
Edit the policy parameters by using the following command:
vinfra service compute resource-policies policy set [--auto-trigger <auto-trigger>] [--interval <interval>] [--max-migrations <max_migrations>] [--period <period>] [--aggregation-method <aggregation_method>] [--granularity <granularity>] [--resource <resource>] [-static-load-ratio <static_load_ratio>] [--deviation-threshold <deviation_threshold>] [--lower-mean-threshold <lower_mean_threshold>] [--upper-mean-threshold <upper_mean_threshold>] [--skip-consolidation-objects <skip_consolidation_objects>] <policy>--auto-trigger auto-trigger- Automatically apply recommendations when the policy succeeds (
yesorno). --interval <interval>- Time interval between analysis runs (in seconds).
--max-migrations <max_migrations>- Maximum number of migrations per analysis.
--period <period>- Time period that is used to get statistic aggregation for instance and host metrics.
--aggregation-method <aggregation_method>- Function used to aggregate multiple measures into an aggregate.
--granularity <granularity>- The time, in seconds, between two measures in an aggregated timeseries of a metric.
--resource <resource>- Resources to take into account. Values: [
cpu,ram] --static-load-ratio <static_load_ratio>- Static over dynamic load ratio in the resource load calculation. Values: [0, 1].
--deviation-threshold <deviation_threshold>- Allowed deviation of a node's load from the average cluster load. Lower values result in more aggressive VM distribution. Values: [0, 1]
--lower-mean-threshold <lower_mean_threshold>- If the average cluster load is below this threshold, the policy will not attempt to distribute VMs. Lower values result in more aggressive distribution. Values: (0, 1).
--upper-mean-threshold <upper_mean_threshold>- If the average cluster load exceeds this threshold, the policy will not attempt to distribute VMs. Higher values result in more aggressive distribution. Values: (0, 1).
--skip-consolidation-objects <skip_consolidation_objects>- Specify objects to skip when assessing load distribution across compute nodes.
<policy>- Policy name or ID
For example, to change the policy mode to manual and configure the settings for aggressive dynamic distribution to prevent resource contention, run:
# vinfra service compute resource-policies policy set "Dynamic distribution" --auto-trigger no --static-load-ratio 0 \ --deviation-threshold 0.1 --lower-mean-threshold 0.2 --upper-mean-threshold 0.95
-
Check the policy parameters by running:
# vinfra service compute resource-policies policy show "Dynamic distribution" +---------------+----------------------------------------------------------------------------------+ | Field | Value | +---------------+----------------------------------------------------------------------------------+ | auto_trigger | False | | created_at | 2025-03-19T14:05:23.565540+00:00 | | description | Analyzes resource load and attempts to evenly distribute available...<truncated> | | enabled | True | | hostname | node001.vstoragedomain | | id | 89f766b3-ba8b-47c3-ae04-2c0527c3ec0b | | interval | 3600 | | name | Dynamic distribution | | next_run_time | 2025-03-21T16:23:57.730782 | | parameters | aggregation_method: | | | compute_node: mean | | | instance: mean | | | granularity: 300 | | | max_migrations: 100 | | | periods: | | | compute_node: 600 | | | instance: 600 | | | resources: | | | - cpu | | | - ram | | | skip_consolidation_objects: host | | | static_load_ratio: 0.0 | | | thresholds: | | | cpu: | | | mean: | | | lower: 0.2 | | | upper: 0.95 | | | sd: 0.1 | | | ram: | | | mean: | | | lower: 0.2 | | | upper: 0.95 | | | sd: 0.1 | | paused | False | | policy_type | workload_stabilization | | state | ONGOING | | updated_at | 2025-03-21T16:03:19.784166+00:00 | +---------------+----------------------------------------------------------------------------------+
To disable a policy
Admin panel
- On the Compute > Resource policies > Policies screen, click the line with the required policy.
- On the policy right pane, click Disable.
- In the confirmation window, click Disable.
Command-line interface
Use the following command:
vinfra service compute resource-policies policy disable <policy>
<policy>- Policy name or ID
For example, to disable the dynamic distribution policy, run:
# vinfra service compute resource-policies policy disable "Dynamic distribution"