Bookmark this page

Guided Exercise: Implementing Object Storage

In this exercise, you will create and configure object containers and directories and perform object management operations.

Outcomes

You should be able to:

  • Create a container.

  • Load objects into the container.

  • Explore the contents of a container.

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 storage-objects start

Procedure 6.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 operator1 user in the finance project, create a new object container called finance-container1. Create a folder in the container called finance-data.

    1. On workstation source the identity environment file for the operator1 user in the finance project.

      [student@workstation ~]$ source ~/operator1-finance-rc
      [student@workstation ~(operator1-finance)]$
    2. Use the openstack container create command to create the container.

      [student@workstation ~(operator1-finance)]$ openstack container create \
      > finance-container1
      +-------------------+--------------------+-------------+
      | account           | container          | x-trans-id  |
      +-------------------+--------------------+-------------+
      | AUTH_c0cbb...e5cd | finance-container1 | tx41...4d72 |
      +-------------------+--------------------+-------------+
    3. Determine the ID for the finance project.

      [student@workstation ~(operator1-finance)]$ openstack project show finance \
      > -c id -f value
      61f55d02112e4f76ab5ecd16c4a8b9f0
    4. Determine the ID for the default security group for the finance project.

      [student@workstation ~(operator1-finance)]$ openstack security group \
      > list -f json
      ...output omitted...
        {
          "ID": "d85c3cb2-31ff-4324-8188-6a93d0e18b4d",
          "Name": "default",
          "Description": "Default security group",
          "Project": "61f55d02112e4f76ab5ecd16c4a8b9f0",
          "Tags": []
        }
      ]
    5. Export the rule list for the default security group in the finance project to /home/student/finance-rules. There is a default security group for each project, so use the ID of the default security group for the finance project determined in the last step.

      [student@workstation ~(operator1-finance)]$ openstack security group \
      > rule list -f json d85c3cb2-31ff-4324-8188-6a93d0e18b4d > finance-rules
    6. Use the openstack object create command to upload the /home/student/finance-rules file into the finance-data folder.

      [student@workstation ~(operator1-finance)]$ openstack object create \
      > finance-container1/finance-data finance-rules
      +---------------+---------------------------------+-------------+
      | object        | container                       | etag        |
      +---------------+---------------------------------+-------------+
      | finance-rules | finance-container1/finance-data | d41d...427e |
      +---------------+---------------------------------+-------------+
  2. As the domain operator, operator1, locate the finance-cdr container and list its contents. Show the details of the object, then download it locally and explore the contents of the object.

    1. Use the openstack container list command to list all available containers.

      [student@workstation ~(operator1-finance)]$ openstack container list
      +--------------------+
      | Name               |
      +--------------------+
      | finance-cdr        |
      | finance-container1 |
      +--------------------+
    2. List the objects in the finance-cdr container.

      [student@workstation ~(operator1-finance)]$ openstack object list \
      > finance-cdr
      +----------------------+
      | Name                 |
      +----------------------+
      | cdr//tmp/cdr.19Jun20 |
      +----------------------+
    3. Show the details of the cdr//tmp/cdr.object object.

      [student@workstation ~(operator1-finance)]$ openstack object show \
      > finance-cdr cdr//tmp/cdr.19Jun20
      +----------------+----------------------------------------+
      | Field          | Value                                  |
      +----------------+----------------------------------------+
      | account        | AUTH_c0cbb4890bcd45828bf31dc1d64fe5cd  |
      | container      | finance-cdr                            |
      | content-length | 10610                                  |
      | content-type   | application/octet-stream               |
      | etag           | 598d1e6b4f0a3583244e1b4e09b49fe5       |
      | last-modified  | Fri, 19 Jun 2020 08:44:54 GMT          |
      | object         | cdr//tmp/cdr.19Jun20                   |
      +----------------+----------------------------------------+
    4. Download the cdr//tmp/cdr.19Jun20 object to a file called /tmp/cdr.txt and explore the contents.

      [student@workstation ~(operator1-finance)]$ openstack object save \
      > --file /tmp/cdr.txt finance-cdr cdr//tmp/cdr.19Jun20
      [student@workstation ~(operator1-finance)]$ cat /tmp/cdr.txt
      725bed67-0293-41c7-bc5a-eff9115108f6|7805589022|4115767947|2016-03-04T02:06:49.795+05:30|2016-03-04T02:09:08.950+05:30|VOICE|0.78949857|ANSWERED
      ...output omitted...
  3. Upload /tmp/cdr.txt into finance-container1.

    1. Use the openstack object create command to upload /tmp/cdr.txt into finance-container1.

      [student@workstation ~(operator1-finance)]$ openstack object create \
      > finance-container1/cdr /tmp/cdr.txt
      +--------------+------------------------+----------------------------------+
      | object       | container              | etag                             |
      +--------------+------------------------+----------------------------------+
      | /tmp/cdr.txt | finance-container1/cdr | 598d1e6b4f0a3583244e1b4e09b49fe5 |
      +--------------+------------------------+----------------------------------+
    2. Confirm that /tmp/cdr.txt has the same attributes as /tmp/cdr.19Jun20

      [student@workstation ~(operator1-finance)]$ openstack object list \
      > finance-container1
      +----------------------------+
      | Name                       |
      +----------------------------+
      | cdr//tmp/cdr.txt           |
      | finance-data/finance-rules |
      +----------------------------+
      [student@workstation ~(operator1-finance)]$ openstack object show \
      > finance-container1 cdr//tmp/cdr.txt
      +----------------+---------------------------------------+
      | Field          | Value                                 |
      +----------------+---------------------------------------+
      | account        | AUTH_c0cbb4890bcd45828bf31dc1d64fe5cd |
      | container      | finance-container1                    |
      | content-length | 10610                                 |
      | content-type   | text/plain                            |
      | etag           | 598d1e6b4f0a3583244e1b4e09b49fe5      |
      | last-modified  | Wed, 24 Jun 2020 10:19:24 GMT         |
      | object         | cdr//tmp/cdr.txt                      |
      +----------------+---------------------------------------+

      Note

      Use the Dashboard to perform the following steps.

  4. In the Dashboard as operator1, create a container called finance-cdr2. Upload the /tmp/cdr.txt file into a directory called 19Jun. Change the name of the file to 19Jun20.txt.

    1. Log in to the Dashboard at http://dashboard.overcloud.example.com using Example for the domain, operator1 for the user, and redhat as the password. Click Project in the upper right corner and select finance.

    2. Navigate to ProjectObject StoreContainers. Click +Container. In Container Name enter finance-cdr2. Ensure the Container Access is Not public. Click Submit.

    3. To create a folder in finance-cdr2, click finance-cdr2, then click +Folder. In Folder Name enter 19Jun and click +Create Folder. Note that in the Dashboard a folder can be created without an object. This differs from the command line where the object must be specified in order to create the folder.

    4. Now upload an object into the container. Click the 19Jun folder, then click the up arrow next to +Folder. Click Browse. Locate /tmp/cdr.txt, click Open. In File Name change the name of the file to 19Jun20.txt, then click Upload File.

  5. Confirm that the Hash ID is equivalent to the etag ID shown when the object show command was used. Download the object to your local directory.

    1. Click the actions menu and select View Details. Note the hash ID. Go back to the terminal window and confirm that the hash in the Dashboard matches the etag value. In Dashboard, click Close.

      Hash               92d044e0db6eda67e80a7e8e582d8aad
      | etag           | 92d044e0db6eda67e80a7e8e582d8aad      |
    2. Click Download for object 19Jun20.txt. Click Save. In a terminal window, confirm that the object has been downloaded.

      [student@workstation ~(operator1-finance)]$ ll Downloads/
      total 28
      -rw-------. 1 student student 10610 Jun 24 15:17 19Jun20.txt
      ...output omitted...

      Note the file size. It is the same size as the original object.

    3. Sign out from Dashboard.

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 storage-objects finish

This concludes the guided exercise.

Revision: cl110-16.1-4c76154