In this lab, you will manage a project and its users, and set quotas for the project. You can perform the tasks in this lab using either the Dashboard or the OpenStack unified CLI.
Outcomes
You should be able to:
Create and delete a project.
Create, delete, and add a user to a project.
Set project quotas.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command ensures that all resources required for the exercise are present.
[student@workstation ~]$ lab project-review start
Procedure 2.4. Instructions
This guided exercise is in two parts. In part 1 you use the CLI and in part 2 you use the Dashboard.
Source the /home/student/operator1-production-rc credentials file. Create the manufacturing project in the MyCorp domain. Create the projects east and west as children of the manufacturing project.
Source the /home/student/operator1-production-rc credentials file.
[student@workstation ~]$ source operator1-production-rcCreate the manufacturing project with the openstack project create command.
[student@workstation ~(operator1-production)]$openstack project create \>--domain MyCorp manufacturing+-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | | | domain_id | f0bd72d8acfe4cd9842b476caa7bf269 | | enabled | True | | id | a0b16a70581d40aaac1801ab30916cd0 | | is_domain | False | | name | manufacturing | | options | {} | | parent_id | f0bd72d8acfe4cd9842b476caa7bf269 | | tags | [] | +-------------+----------------------------------+
Create the east project with the parent project set to manufacturing.
[student@workstation ~(operator1-production)]$openstack project create \>--domain MyCorp --parent manufacturing east+-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | | | domain_id | f0bd72d8acfe4cd9842b476caa7bf269 | | enabled | True | | id | cecd922d022c44d28d02f2965d1af5f1 | | is_domain | False | | name | east | | options | {} | | parent_id | a0b16a70581d40aaac1801ab30916cd0 | | tags | [] | +-------------+----------------------------------+
Create the west project with the parent project set to manufacturing.
[student@workstation ~(operator1-production)]$openstack project create \>--domain MyCorp --parent manufacturing west+-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | | | domain_id | f0bd72d8acfe4cd9842b476caa7bf269 | | enabled | True | | id | e53426c5adac4a1f95ce7f8e2946eeca | | is_domain | False | | name | west | | options | {} | | parent_id | a0b16a70581d40aaac1801ab30916cd0 | | tags | [] | +-------------+----------------------------------+
Create the user user within the MyCorp domain, with a primary project of manufacturing and a password of redhat.
Create the user user with redhat as the password in the Domain domain.
[student@workstation ~(operator1-production)]$openstack user create \>--project-domain MyCorp \>--project manufacturing \>--domain MyCorp \>--password redhat \>user+---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | default_project_id | a0b16a70581d40aaac1801ab30916cd0 | | domain_id | MyCorp | | enabled | True | | id | fc1a097f1e4c4d738364334d768f7dc4 | | name | user | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
Assign user the member and admin roles in manufacturing.
Assign the member role to the user user for the manufacturing project.
[student@workstation ~(operator1-production)]$openstack role add \>--user-domain MyCorp \>--user user \>--project-domain MyCorp \>--project manufacturing \>member
Assign the admin role to the user user for the manufacturing project.
[student@workstation ~(operator1-production)]$openstack role add \>--user-domain MyCorp \>--user user \>--project-domain MyCorp \>--project manufacturing \>admin
As user, verify the existing quotas on east, and then restrict the amount of RAM available to 40000 MiB and the number of cores to 10. Verify the existing quotas on west, and then restrict the number of instances to 10 and the number of cores to 16.
Source the /home/student/user-manufacturing-rc credentials file.
[student@workstation ~(operator1-production)]$ source ~/user-manufacturing-rc
[student@workstation ~(user-manufacturing)]$Use the openstack quota show command to list the quotas for the east project.
[student@workstation ~(user-manufacturing)]$openstack quota show \>-c cores -c ram -c instances east+-----------+-------+ | Field | Value | +-----------+-------+ | cores | 20 | | instances | 10 | | ram | 51200 | +-----------+-------+
Modify the quotas for the east project to set the cores to 10, and the memory to 40000 MiB. Use the openstack quota set command with the options --cores and --ram.
[student@workstation ~(user-manufacturing)]$openstack quota set \>--cores 10 --ram 40000 east
Use the openstack quota show command to list the quotas for the west project:
[student@workstation ~(user-manufacturing)]$openstack quota show \>-c cores -c ram -c instances west+-----------+-------+ | Field | Value | +-----------+-------+ | cores | 20 | | instances | 10 | | ram | 51200 | +-----------+-------+
Modify the quotas for the west project to set the cores to 16 and the instances to 10. Use the openstack quota set command with the --cores and --instances options.
[student@workstation ~(user-manufacturing)]$openstack quota set \>--cores 16 --instances 10 west
As user user, create the user2 user in the Dashboard, setting the password to redhat and the primary project to west. Give user2 the admin role in the west project.
Use the Dashboard to perform the following steps.
On workstation, open Firefox and browse to http://dashboard.overcloud.example.com. Log in to Dashboard using MyCorp as the domain, user as the user name, and redhat as the password.
Navigate to → and then click .
Enter user2 in the field, and redhat in the and fields. Select from the list. Set to , and leave the check box selected.
Click .
As user2, modify the project quotas for the west project to only allow 5 instances.
This concludes the lab.