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.
As the student user on workstation, install the python3-osc-placement package.
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!
As the operator9 user in the production project, list the resource providers available.
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)]$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 | +--------------------------------------+-----------------------------------+
List the traits associated with the compute1 resource provider.
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+---------------------------------------+ | 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 | +---------------------------------------+a0febbac-01aa-4580-9e91-e4d12ebc50e0
Associate the STORAGE_DISK_SSD trait with the compute1 resource provider.
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 | +------------------+
Create a new flavor using the values in the following table.
| Setting | Flavor |
|---|---|
| Flavor Name |
trait-flavor
|
| RAM |
2048
|
| Disk Size |
10
|
| vCPU |
2
|
| Property |
trait:STORAGE_DISK_SSD=required
|
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 | +----------------------------+--------------------------------------+
Set the required trait.
[student@workstation ~(operator9-production)]$openstack flavor set trait-flavor \>--property trait:STORAGE_DISK_SSD=required
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 | +----------------------------+--------------------------------------+
List all possible allocation candidates. Use two VCPUs, 2048 MB of RAM, a 10 GB disk, and the STORAGE_DISK_SSD trait as required.
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" } ]
Launch an instance named trait-server1. Use the settings in the following table:
| Setting | Instance |
|---|---|
| Instance Name |
trait-server1
|
| Image |
rhel8
|
| Flavor |
trait-flavor
|
| Network (private) |
production-network9
|
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 | | +-------------------------------------+------------------------------------------+
In the Dashboard as operator9, create an instance using the values in the following table:
Use the Dashboard to perform the following steps.
| Setting | Instance |
|---|---|
| Instance Name |
trait-server2
|
| Image |
rhel8
|
| Flavor |
trait-flavor
|
| Network (private) |
production-network9
|
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 menu at the upper-right of the windows and ensure that is the current project.
Navigate to → → and then click .
On the tab, enter trait-server2 in the field.
On the tab, select > Image from the list. Set to No. In the section, click next to rhel8 to select it as the image.
On the tab, click next to trait-flavor to select it as the flavor.
On the tab, click next to production-network9 to select it as the network.
Click to launch the trait-server2 instance. Wait a few seconds and then verify that the status in the column is Running.
Verify that both instances are running on compute1.
This concludes the lab.