Bookmark this page

Lab: Managing Cloud Application Placement

In this lab, you will create an instance and use the Placement service to control where it runs.

Outcomes

You should be able to:

  • Install the Placement service package on workstation.

  • List resource providers.

  • Add some traits to one of the compute nodes.

  • Create a flavor with trait properties.

  • Launch instances.

As the student user on the workstation machine, use the lab command to prepare your system for this lab.

This command ensures that all resources required for the exercise are present.

[student@workstation ~]$ lab placement-review start

Procedure 9.1. Instructions

This guided exercise is in two parts. In part 1 you use the CLI, and in part 2 you use the Dashboard.

  1. As the student user on workstation, install the python3-osc-placement package.

    1. Use the dnf command to install the python3-osc-placement package.

      [student@workstation ~]$ sudo dnf install python3-osc-placement
      [sudo] password for student: student
      ...output omitted...
      Install  1 Package
      
      Total download size: 47 k
      Installed size: 145 k
      Is this ok [y/N]: y
      ...output omitted...
      Installed:
        python3-osc-placement-1.7.0-0.20190923165353.8bbca01.el8ost.noarch
      
      Complete!
  2. As the operator9 user in the production project, list the resource providers available.

    1. On workstation, source the identity environment file for the operator9 user in the production project.

      [student@workstation ~]$ source operator9-production-rc
      [student@workstation ~(operator9-production)]$
    2. Use the openstack resource provider command to manage resource providers.

      [student@workstation ~(operator9-production)]$ openstack resource provider \
      > list -c uuid -c name
      +--------------------------------------+-----------------------------------+
      | uuid                                 | name                              |
      +--------------------------------------+-----------------------------------+
      | b923f2aa-7e69-4de5-8c05-632924ed7467 | computehci0.overcloud.example.com |
      | eef8c2ae-7245-4721-8eb5-25e33394e775 | compute0.overcloud.example.com    |
      | a0febbac-01aa-4580-9e91-e4d12ebc50e0 | compute1.overcloud.example.com    |
      +--------------------------------------+-----------------------------------+
  3. List the traits associated with the compute1 resource provider.

    1. Use the openstack resource provider trait command to list the traits associated with the compute1 resource provider. Use the UUID from the previous step.

      [student@workstation ~(operator9-production)]$ openstack resource provider \
      > trait list a0febbac-01aa-4580-9e91-e4d12ebc50e0
      +---------------------------------------+
      | name                                  |
      +---------------------------------------+
      | HW_CPU_X86_MMX                        |
      | COMPUTE_IMAGE_TYPE_ARI                |
      | COMPUTE_IMAGE_TYPE_AMI                |
      | COMPUTE_VOLUME_ATTACH_WITH_TAG        |
      | COMPUTE_TRUSTED_CERTS                 |
      | HW_CPU_X86_SSE                        |
      | COMPUTE_IMAGE_TYPE_ISO                |
      | COMPUTE_VOLUME_MULTI_ATTACH           |
      | COMPUTE_IMAGE_TYPE_QCOW2              |
      | COMPUTE_NET_ATTACH_INTERFACE_WITH_TAG |
      | HW_CPU_X86_SVM                        |
      | HW_CPU_X86_SSE2                       |
      | COMPUTE_VOLUME_EXTEND                 |
      | COMPUTE_IMAGE_TYPE_AKI                |
      | COMPUTE_DEVICE_TAGGING                |
      | COMPUTE_IMAGE_TYPE_RAW                |
      | COMPUTE_NET_ATTACH_INTERFACE          |
      +---------------------------------------+
  4. Associate the STORAGE_DISK_SSD trait with the compute1 resource provider.

    1. Use the openstack resource provider trait command to associate the STORAGE_DISK_SSD trait with the compute1 resource provider.

      [student@workstation ~(operator9-production)]$ openstack resource provider trait \
      > set --trait STORAGE_DISK_SSD \
      > a0febbac-01aa-4580-9e91-e4d12ebc50e0
      +------------------+
      | name             |
      +------------------+
      | STORAGE_DISK_SSD |
      +------------------+
  5. Create a new flavor using the values in the following table.

    SettingFlavor
    Flavor Name trait-flavor
    RAM 2048
    Disk Size 10
    vCPU 2
    Property trait:STORAGE_DISK_SSD=required
    1. Use the openstack flavor create command to create a new flavor using the specified values.

      [student@workstation ~(operator9-production)]$ openstack flavor create \
      > --ram 2048 \
      > --disk 10 \
      > --vcpus 2 \
      > trait-flavor
      +----------------------------+--------------------------------------+
      | Field                      | Value                                |
      +----------------------------+--------------------------------------+
      | OS-FLV-DISABLED:disabled   | False                                |
      | OS-FLV-EXT-DATA:ephemeral  | 0                                    |
      | disk                       | 10                                   |
      | id                         | 347d0490-50e9-464a-8c0a-935ebc95bdb8 |
      | name                       | trait-flavor                         |
      | os-flavor-access:is_public | True                                 |
      | properties                 |                                      |
      | ram                        | 2048                                 |
      | rxtx_factor                | 1.0                                  |
      | swap                       |                                      |
      | vcpus                      | 2                                    |
      +----------------------------+--------------------------------------+
    2. Set the required trait.

      [student@workstation ~(operator9-production)]$ openstack flavor set trait-flavor \
      > --property trait:STORAGE_DISK_SSD=required
    3. Verify that the properties have been created.

      [student@workstation ~(operator9-production)]$ openstack flavor show trait-flavor
      +----------------------------+--------------------------------------+
      | Field                      | Value                                |
      +----------------------------+--------------------------------------+
      | OS-FLV-DISABLED:disabled   | False                                |
      | OS-FLV-EXT-DATA:ephemeral  | 0                                    |
      | access_project_ids         | None                                 |
      | disk                       | 10                                   |
      | id                         | 347d0490-50e9-464a-8c0a-935ebc95bdb8 |
      | name                       | trait-flavor                         |
      | os-flavor-access:is_public | True                                 |
      | properties                 | trait:STORAGE_DISK_SSD='required'    |
      | ram                        | 2048                                 |
      | rxtx_factor                | 1.0                                  |
      | swap                       |                                      |
      | vcpus                      | 2                                    |
      +----------------------------+--------------------------------------+
  6. List all possible allocation candidates. Use two VCPUs, 2048 MB of RAM, a 10 GB disk, and the STORAGE_DISK_SSD trait as required.

    1. Use the openstack allocation candidate list command to list all possible allocation candidates.

      [student@workstation ~(operator9-production)]$ openstack allocation candidate \
      > list \
      > --resource VCPU=2 \
      > --resource DISK_GB=64 \
      > --resource MEMORY_MB=2048 \
      > --required STORAGE_DISK_SSD \
      > -c "resource provider" \
      > -c "inventory used/capacity" \
      > -f json
      [
        {
          "resource provider": "a0febbac-01aa-4580-9e91-e4d12ebc50e0",
          "inventory used/capacity": "VCPU=0/32,MEMORY_MB=0/13600,DISK_GB=0/912"
        }
      ]
  7. Launch an instance named trait-server1. Use the settings in the following table:

    SettingInstance
    Instance Name trait-server1
    Image rhel8
    Flavor trait-flavor
    Network (private) production-network9
    1. Launch an instance named trait-server1. If you get the message Error creating server: trait-server1, wait one or two minutes before relaunching the instance.

      [student@workstation ~(operator9-production)]$ openstack server create \
      > --flavor trait-flavor \
      > --image rhel8 \
      > --nic net-id=production-network9 \
      > --wait \
      > trait-server1
      
      +-------------------------------------+------------------------------------------+
      | Field                               | Value                                    |
      +-------------------------------------+------------------------------------------+
      | OS-DCF:diskConfig                   | MANUAL                                   |
      | OS-EXT-AZ:availability_zone         | nova                                     |
      | OS-EXT-SRV-ATTR:host                | compute1.overcloud.example.com           |
      | OS-EXT-SRV-ATTR:hypervisor_hostname | compute1.overcloud.example.com           |
      ...output omitted...
      | status                              | ACTIVE                                   |
      | updated                             | 2020-08-10T23:00:56Z                     |
      | user_id                             | 810c5c9525a3dd4f34c19c79e8b3bee452904955 |
      |                                     | 57a6fc525c6b4cf943d22c42                 |
      | volumes_attached                    |                                          |
      +-------------------------------------+------------------------------------------+
  8. In the Dashboard as operator9, create an instance using the values in the following table:

    Note

    Use the Dashboard to perform the following steps.

    SettingInstance
    Instance Name trait-server2
    Image rhel8
    Flavor trait-flavor
    Network (private) production-network9
    1. Log in to the Dashboard at http://dashboard.overcloud.example.com using Example as the domain, operator9 as the user, and redhat as the password. Click the Project menu at the upper-right of the windows and ensure that production is the current project.

    2. Navigate to ProjectComputeInstances and then click Launch Instance.

    3. On the Details tab, enter trait-server2 in the Instance Name field.

    4. On the Source tab, select > Image from the Select Boot Source list. Set Create New Volume to No. In the Available section, click next to rhel8 to select it as the image.

    5. On the Flavor tab, click next to trait-flavor to select it as the flavor.

    6. On the Networks tab, click next to production-network9 to select it as the network.

    7. Click Launch Instance to launch the trait-server2 instance. Wait a few seconds and then verify that the status in the Power State column is Running.

  9. Verify that both instances are running on compute1.

    1. Navigate to AdminComputeHypervisors.

      Verify that the Instances column in the compute1.overcloud.example.com row indicates that two instances are running.

Evaluation

Grade your work by running the lab placement-review grade command from your workstation machine. Correct any reported failures and rerun the script until successful.

[student@workstation ~]$ lab placement-review grade

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab placement-review finish

This concludes the lab.

Revision: cl110-16.1-4c76154