Bookmark this page

Lab: Managing Application Projects in a Multitenant Cloud

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.

  1. 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.

    1. Source the /home/student/operator1-production-rc credentials file.

      [student@workstation ~]$ source operator1-production-rc
    2. Create 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        | []                               |
      +-------------+----------------------------------+
    3. 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        | []                               |
      +-------------+----------------------------------+
    4. 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        | []                               |
      +-------------+----------------------------------+
  2. Create the user user within the MyCorp domain, with a primary project of manufacturing and a password of redhat.

    1. 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                             |
      +---------------------+----------------------------------+
  3. Assign user the member and admin roles in manufacturing.

    1. 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
    2. 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
  4. 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.

    1. Source the /home/student/user-manufacturing-rc credentials file.

      [student@workstation ~(operator1-production)]$ source ~/user-manufacturing-rc
      [student@workstation ~(user-manufacturing)]$
    2. 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 |
      +-----------+-------+
    3. 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
    4. 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 |
      +-----------+-------+
    5. 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
  5. 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.

    Note

    Use the Dashboard to perform the following steps.

    1. 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.

    2. Navigate to IdentityUsers and then click Create User.

    3. Enter user2 in the User Name field, and redhat in the Password and Confirm Password fields. Select west from the Primary Project list. Set Role to admin, and leave the Enabled check box selected.

      Click Create User.

  6. As user2, modify the project quotas for the west project to only allow 5 instances.

    1. Log out of the Dashboard, and then log in as user2, using MyCorp as the domain name, and with a password of redhat.

    2. Navigate to IdentityProjects. Select Modify Quotas from the list under the Actions column for the west project.

    3. Select the Compute category, then enter 5 for Instances.

      Click Save.

Evaluation

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

[student@workstation ~]$ lab project-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 project-review finish

This concludes the lab.

Revision: cl110-16.1-4c76154