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.
As the operator1 user in the finance project, create a new flavor based on default, but with 5 GiB of ephemeral storage.
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)]$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 }
As the developer1 user in the finance project, create an instance named finance-server4 using the new flavor.
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)]$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": "" }
Verify that the ephemeral disk is attached to the finance-server4 instance.
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=...| +-------+-------------------------------------------------+
Open the console URL in a web browser and log in as root using redhat as the password.
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
Verify that the ephemeral volume has already been mounted by cloud-init. Log out when complete.
[root@finance-server4 ~]#df -hFilesystem 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% /mnttmpfs 183M 0 183M 0% /run/user/1001 [root@finance-server4 ~]#logout
Open a new terminal, log in to controller0 as heat-admin, and list the instance volumes in the Ceph vms pool.
Log in to controller0 as the heat-admin user.
[student@workstation ~]$ ssh heat-admin@controller0
[heat-admin@controller0 ~]$List the instance volumes in the vms pool.
[heat-admin@controller0 ~]$sudo podman exec -t \>ceph-mon-controller0 rbd -p vms ls8752c16f-40b8-4a5b-95ee-6c69d0efe587_disk 8752c16f-40b8-4a5b-95ee-6c69d0efe587_disk.eph0
Note the ephemeral volume with the .eph0 extension.
Switch to the first terminal and delete the finance-server4 instance.
[student@workstation ~(developer1-finance)]$openstack server delete \>finance-server4
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 ~]$
Use the Dashboard to perform the following steps.
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.
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.
Navigate to → → .
Click and enter the following details for the flavor:
| Option | Value |
|---|---|
Name
|
default-with-ephemeral2
|
VCPUs
| 2 |
RAM (MB)
| 2048 |
Root Disk (GB)
| 10 |
Ephemeral Disk (GB)
| 10 |
As developer1, launch an instance named finance-server5 using the default-with-ephemeral2 flavor, the rhel8 image, and the finance-network1 network. Click under .
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 menu in the upper-right of the window and ensure that is the current project.
Navigate to → → and then click .
On the tab, enter finance-server5 in the field.
On the tab, select in the field.
From the list of available images, click the up arrow (↑) corresponding to the rhel8 image. Click under .
On the tab, click the up arrow (↑) corresponding to the default-with-ephemeral2 flavor.
On the tab, if the finance-network1 network is not already allocated, click the up arrow (↑) corresponding to that network to allocate it.
Click to launch the finance-server5 instance.
Wait a few seconds and then review the status of the instance in the column. The status of the instance should be Running.
Click and note the instance ID.
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 ls5588b190-46b0-4746-9414-ca5f69794510_disk 5588b190-46b0-4746-9414-ca5f69794510_disk.eph0
Switch back to the Dashboard and delete the finance-server5 instance by selecting from the actions menu.
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 ~]$
This concludes the guided exercise.