Bookmark this page

Guided Exercise: Configuring Ephemeral Disks

In this exercise, you will configure a flavor with ephemeral storage, deploy an instance using that flavor, and verify that the volumes are removed when the instance is deleted.

Outcomes

You should be able to:

  • Create a flavor that includes ephemeral storage.

  • Launch an instance with ephemeral storage.

  • Verify that ephemeral volumes are removed when the instance is deleted.

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 vmdisks-ephemeral start

Procedure 5.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 flavor based on default, but with 5 GiB of ephemeral storage.

    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. Create a new public flavor named default-with-ephemeral with the same resources as default, but with a 5 GiB ephemeral disk.

      [student@workstation ~(operator1-finance)]$ openstack flavor create \
      > --ram 2048 \
      > --disk 10 \
      > --ephemeral 5 \
      > --vcpus 2 \
      > --public default-with-ephemeral -f json
      {
        "OS-FLV-DISABLED:disabled": false,
        "OS-FLV-EXT-DATA:ephemeral": 5,
        "disk": 10,
        "id": "ae1de0aa-1ae6-45ec-9a56-d22cfc82174a",
        "name": "default-with-ephemeral",
        "os-flavor-access:is_public": true,
        "properties": "",
        "ram": 2048,
        "rxtx_factor": 1.0,
        "swap": "",
        "vcpus": 2
      }
  2. As the developer1 user in the finance project, create an instance named finance-server4 using the new flavor.

    1. Source the identity environment file for the developer1 user in the finance project.

      [student@workstation ~(operator1-finance)]$ source ~/developer1-finance-rc
      [student@workstation ~(developer1-finance)]$
    2. Create an instance named finance-server4 using the default-with-ephemeral flavor.

      [student@workstation ~(developer1-finance)]$ openstack server create \
      > --flavor default-with-ephemeral \
      > --image rhel8 \
      > --network finance-network1 \
      > --wait finance-server4 -f json
      {
        "OS-DCF:diskConfig": "MANUAL",
        "OS-EXT-AZ:availability_zone": "nova",
        "OS-EXT-STS:power_state": "Running",
        "OS-EXT-STS:task_state": null,
        "OS-EXT-STS:vm_state": "active",
        "OS-SRV-USG:launched_at": "2020-06-11T12:24:44.000000",
        "OS-SRV-USG:terminated_at": null,
        "accessIPv4": "",
        "accessIPv6": "",
        "addresses": "finance-network1=192.168.1.172",
        "adminPass": "5FwjEgi8aLn4",
        "config_drive": "",
        "created": "2020-06-11T12:24:17Z",
        "flavor": "default-with-ephemeral (ae1de0aa-1ae6-45ec-9a56-d22cfc82174a)",
        "hostId": "f06dcefd5be888ce29b55f5442429b161239ca3a81ad5a6e7b54b62e",
        "id": "8752c16f-40b8-4a5b-95ee-6c69d0efe587",
        "image": "rhel8 (b33fca9a-3c85-40b3-86bf-466eeaccbf6b)",
        "key_name": "",
        "name": "finance-server4",
        "progress": 0,
        "project_id": "0788fd9277ae45218475557206f37a40",
        "properties": "",
        "security_groups": "name='default'",
        "status": "ACTIVE",
        "updated": "2020-06-11T12:24:44Z",
        "user_id": "b3bf...3570",
        "volumes_attached": ""
      }
  3. Verify that the ephemeral disk is attached to the finance-server4 instance.

    1. Determine the console URL for the finance-server4 instance.

      [student@workstation ~(developer1-finance)]$ openstack console url \
      > show finance-server4
      +-------+-------------------------------------------------+
      | Field | Value                                           |
      +-------+-------------------------------------------------+
      | type  | novnc                                           |
      | url   | http://172.25.250.50:6080/vnc_auto.html?path=...|
      +-------+-------------------------------------------------+
    2. Open the console URL in a web browser and log in as root using redhat as the password.

    3. List the block devices to verify that the ephemeral disk is present.

      [root@finance-server4 ~]# fdisk -l
      ...output omitted...
      Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 sectors
      Units: sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disklabel type: dos
      Disk identifier: 0x00000000
    4. Verify that the ephemeral volume has already been mounted by cloud-init. Log out when complete.

      [root@finance-server4 ~]# df -h
      Filesystem      Size  Used Avail Use% Mounted on
      devtmpfs        900M     0  900M   0% /dev
      tmpfs           915M     0  915M   0% /dev/shm
      tmpfs           915M   17M  899M   2% /run
      tmpfs           915M     0  915M   0% /sys/fs/cgroup
      /dev/vda1        10G  2.0G  8.1G  20% /
      /dev/vdb        5.0G  4.0K  5.0G   1% /mnt
      tmpfs           183M     0  183M   0% /run/user/1001
      [root@finance-server4 ~]# logout
  4. Open a new terminal, log in to controller0 as heat-admin, and list the instance volumes in the Ceph vms pool.

    1. Log in to controller0 as the heat-admin user.

      [student@workstation ~]$ ssh heat-admin@controller0
      [heat-admin@controller0 ~]$
    2. List the instance volumes in the vms pool.

      [heat-admin@controller0 ~]$ sudo podman exec -t \
      > ceph-mon-controller0 rbd -p vms ls
      8752c16f-40b8-4a5b-95ee-6c69d0efe587_disk
      8752c16f-40b8-4a5b-95ee-6c69d0efe587_disk.eph0

      Note the ephemeral volume with the .eph0 extension.

  5. Switch to the first terminal and delete the finance-server4 instance.

    [student@workstation ~(developer1-finance)]$ openstack server delete \
    > finance-server4
  6. Switch to the second terminal and list the volumes again. Confirm that the system disk and ephemeral disk for the finance-server4 instance are both absent.

    [heat-admin@controller0 ~]$ sudo podman exec -t \
    > ceph-mon-controller0 rbd -p vms ls
    [heat-admin@controller0 ~]$

    Note

    Use the Dashboard to perform the following steps.

  7. In the Dashboard as operator1, create a flavor named default-with-ephemeral2 as a copy of the default flavor, but with a 10 GiB ephemeral disk. On workstation, open Firefox and browse to http://dashboard.overcloud.example.com. Log in to the Dashboard as operator1, in the Example domain using redhat as a password.

    Create a flavor named default-with-ephemeral2 as a copy of the default flavor, but with a 10GiB ephemeral disk.

    1. Log in to the Dashboard using Example for the domain, operator1 for the user, and redhat as the password. Confirm that the selected project is finance.

    2. Navigate to AdminComputeFlavors.

    3. Click Create Flavor and enter the following details for the flavor:

      OptionValue
      Name default-with-ephemeral2
      VCPUs 2
      RAM (MB) 2048
      Root Disk (GB) 10
      Ephemeral Disk (GB) 10
  8. As developer1, launch an instance named finance-server5 using the default-with-ephemeral2 flavor, the rhel8 image, and the finance-network1 network. Click No under Create New Volume.

    1. Log out of the Dashboard, and then log in again using Example for the domain, developer1 for the user, and redhat as the password. Click the Project menu in the upper-right of the window and ensure that finance is the current project.

    2. Navigate to ProjectComputeInstances and then click Launch Instance.

    3. On the Details tab, enter finance-server5 in the Instance Name field.

    4. On the Source tab, select Image in the Select Boot Source field.

      From the list of available images, click the up arrow (↑) corresponding to the rhel8 image. Click No under Create New Volume.

    5. On the Flavor tab, click the up arrow (↑) corresponding to the default-with-ephemeral2 flavor.

    6. On the Networks tab, if the finance-network1 network is not already allocated, click the up arrow (↑) corresponding to that network to allocate it.

    7. Click Launch Instance to launch the finance-server5 instance.

    8. Wait a few seconds and then review the status of the instance in the Power State column. The status of the instance should be Running.

    9. Click finance-server5 and note the instance ID.

  9. Switch to the terminal logged in to controller0 and list the instance volumes in the vms pool.

    [heat-admin@controller0 ~]$ sudo podman exec -t \
    > ceph-mon-controller0 rbd -p vms ls
    5588b190-46b0-4746-9414-ca5f69794510_disk
    5588b190-46b0-4746-9414-ca5f69794510_disk.eph0
  10. Switch back to the Dashboard and delete the finance-server5 instance by selecting Delete Instance from the actions menu.

  11. Switch to the controller0 terminal again, and list the volumes again. Confirm that the system disk and ephemeral disk for the finance-server5 instance are both absent.

    [heat-admin@controller0 ~]$ sudo podman exec -t \
    > ceph-mon-controller0 rbd -p vms ls
    [heat-admin@controller0 ~]$

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 vmdisks-ephemeral finish

This concludes the guided exercise.

Revision: cl110-16.1-4c76154