# Placement Rules

## Overview

Zadara Cloud Services supports the creation of placement rules which determines
how a VM Instance is placed on physical nodes.

Defining a rule is a 3-stage process:

1. Use the tags attached to the VM instances and nodes to choose the placement
   rule type and set its parameters. There are three placement rule types:
   1. **Same-tagged VM rule** - VM instances with the same tag can be configured
      to be placed on either the same or different nodes.
   2. **Different-tagged VM rule** - VM instances with a specific tag can be
      configured to be placed on either the same nodes or different nodes as
      VM instances with a different tag.
   3. **VM and Node tags** - VM instances with a specific tag can be configured
      to be placed on a node with the same or different tag.
2. Define the level of rule enforcement. There are two options:
   1. **Hard** - VM instance placement will only be performed if the rule
      constraints can be satisfied.
   2. **Soft** - If possible, VM instance placement will be performed
      according to the rules.  If the rules cannot be satisfied, the placement
      will be done anyway.
3. Define the scope of this rule as either system-wide or for a specific project.

<a id="vmplacementrulesoverview-vmplacementrules"></a>

## Placement Rule Main Window Display

1. Navigate to the **Compute** > **Rules** view. A list of all placement rules
   is displayed.
   <!-- note:
   For 'Admin' users, the list will include all of the rules in
   the cluster.
   For 'Member', 'Tenant Admin' or 'Read Only Admin' users, only
   those rules associated with the currently displayed project will be listed. -->
2. The following information is displayed for each rule:
   1. **Description** of rule type.
   2. **Tags** used within rule.
   3. **Enforcement** level of rule (hard/soft).
   4. **Scope** of rule (system/project).
   5. **Enabled**
   6. **Creation Date**

## Add a Placement Rule

**To add a Placement Rule**:

1. Navigate to the **Compute**> **Rules** view and select **Add Rule**.
   The **Create VM Placement Rule** window is displayed.
2. Select the rule type (same-tagged, different-tagged, or VM and Node tagged).
3. Select **Hard** or **Soft** enforcement.
4. Select system or project scope.
5. Select **OK**. The new VM Placement Rule will appear in the Rules view.

## Simulating a Placement Rule

1. Navigate to the **Compute**> **Rules** view. A list of the placement rules
   is displayed.
2. Select the row of the desired placement rule. A **Simulate Rule** icon
   appears in the top menu bar.
3. Select **Simulate Rule**.
4. The **Simulate Rule** information window will appear showing a list of VM
   instances potentially affected by the rule.
5. Click **OK**.

## Applying a Placement Rule

**To apply a Placement Rule to a VM instance**:

1. Navigate to the **Compute**> **Rules** view. A list of the placement rules
   is displayed.
2. Select the row of the desired placement rule. An **Apply Rule** icon appears
   in the top menu bar.
3. Select **Apply Rule**.
4. The **Apply Rule** confirmation window will appear showing a list of VM
   instances potentially affected by the rule.
5. For VM instances which are covered by the rule, but which cannot be placed
   accordingly, select one of the following options:
   1. Stop the VM instance
   2. Leave the VM instance running in its current placement
6. Click **OK**. A message confirming the application of the placement rule
   will pop-up in the upper right corner of the screen.

## Removing a Placement Rule

1. Navigate to the **Compute**> **Rules** view. A list of the placement rules
   is displayed.
2. Select the row of the placement rule to be removed. A **Remove** icon appears
   in the top menu bar.
3. Click **Remove**. The **Remove Rule** confirmation window appears.
4. Click **OK**. A message confirming the removal of the placement rule will
   pop-up in the upper right corner of the screen.
