Changing placement assignment

Limitations

  • After adding a node to a placement, VMs already hosted on the node will not be automatically assigned this placement.
  • A virtual machine that is assigned a placement can only be migrated between nodes in this placement. When adding nodes to placements, make sure to provide migration options for various scenarios, including high availability and maintenance. Avoid situations when VMs cannot migrate because of limitations imposed by placements. In this case, a VM placement can be edited, as described in Managing virtual machines in placements.

Prerequisites

To assign a placement to a node

Admin panel

  1. On the Compute > Nodes > Placements tab, click the required placement.
  2. Go to the Nodes tab, and then click Add.
  3. Select the nodes to assign the placement to, and then click Add.

Command-line interface

Use the following command:

vinfra service compute placement assign --nodes <nodes> <placement>
--nodes <nodes>
A comma-separated list of compute node IDs or hostnames to assign a compute placement to
<placement>
Placement ID or name

For example, to assign the placement placement1 to the node node005.vstoragedomain, run:

# vinfra service compute placement assign --nodes node005 placement1

To assign a placement to an image

Admin panel

  1. Open the Compute > Nodes > Placements tab, and then click the required placement.
  2. On the Properties tab, click Add in the Images section.
  3. Select one or more images to assign the placement to, and then click Add.

When you select this image while creating a VM, the corresponding placement will be selected automatically.

Command-line interface

Use the following command:

vinfra service compute placement assign --images <images> <placement>
--images <images>
A comma-separated list of image IDs or names to assign a compute placement to
<placement>
Placement ID or name

For example, to assign the placement placement1 to the image cirros, run:

# vinfra service compute placement assign --images cirros placement1

To assign a placement to a flavor

Admin panel

  1. Open the Compute > Nodes > Placements tab, and then click the required placement.
  2. On the Properties tab, click Add in the Flavors section.
  3. Select one or more flavors to assign the placement to, and then click Add.

When you select this flavor while creating a VM, the corresponding placement will be selected automatically.

Command-line interface

Use the following command:

vinfra service compute placement assign --flavors <images> <placement>
--flavors <flavors>
A comma-separated list of flavor IDs or names to assign a compute placement to
<placement>
Placement ID or name

For example, to assign the placement placement1 to the flavor 102, run:

# vinfra service compute placement assign --flavors 102 placement1

To remove placement assignments

Admin panel

  1. On the Compute > Nodes > Placements tab, click the required placement.
  2. On the Properties tab, click the bin icon next to an image or a flavor to remove it.
  3. Go to the Nodes tab, and click the bin icon next to a node to remove it.

Command-line interface

  1. View the placement details, to check if the placement is assigned to any images, flavors, or nodes. For example:

    # vinfra service compute placement show placement1
    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | description |                                      |
    | flavors     | 0                                    |
    | id          | e4230b75-a858-404c-be3b-4b3f2dedb057 |
    | images      | 1                                    |
    | name        | placement1                           |
    | nodes       | 3                                    |
    | servers     | 0                                    |
    +-------------+--------------------------------------+
    
  2. List objects that the placement is assigned to, if any, to find out their names. For example:

    # vinfra service compute node list --long -c id -c placements
    +------------------------+----------------------------------------+
    | host                   | placements                             | 
    +------------------------+----------------------------------------+
    | node001.vstoragedomain | - e4230b75-a858-404c-be3b-4b3f2dedb057 |
    | node002.vstoragedomain | - e4230b75-a858-404c-be3b-4b3f2dedb057 |
    | node003.vstoragedomain | - e4230b75-a858-404c-be3b-4b3f2dedb057 |
    | node004.vstoragedomain | []                                     |
    | node005.vstoragedomain | []                                     |
    +------------------------+----------------------------------------+
    # vinfra service compute image list --long -c name -c placements
    +--------------------------+----------------------------------------+
    | name                     | placements                             |
    +--------------------------+----------------------------------------+
    | fedora-coreos-x64-k8saas | []                                     |
    | amphora-x64-haproxy      | []                                     |
    | cirros                   | - e4230b75-a858-404c-be3b-4b3f2dedb057 |
    +--------------------------+----------------------------------------+
    
  3. Remove all of the placement assignments. For example:

    # vinfra service compute placement delete-assign --node node001 placement1
    # vinfra service compute placement delete-assign --node node002 placement1
    # vinfra service compute placement delete-assign --node node003 placement1
    # vinfra service compute placement delete-assign --image cirros placement1