18 Feb Practice Tasks - Satish
18 Feb Practice Tasks - Satish
18 Feb Practice Tasks - Satish
Keystone
a. An e-commerce company decides to run heavy promotions during peak seasons
(e.g. X-Mas) for which they have a 4 member project team in place and will be
running their promotion application. Task: a) Create a new Tenant named
"promotion" with description as "peak seasons promotion project". B) Create a
role named "devops" c) Create users (Mike, John, Don and Pat) within the tenant
named Promotion and assign devops role to them. Password for each user will be
"temppass"
Ans:
1. Source creds
2. Openstack project list Check existing projects
3. Openstack project create --description "peak seasons promotion project"
promotion
4. openstack role create devops
5. Openstack user create --project promotion --password temppass mike
6. Openstack role add --project promotion user mike --user don --user pat --
user john devops
7. Openstack role list --user mike --project promotion
8. Login on Horizon with mike/temppass to confirm
2. Project "promotion" requires spinning up Database systems (ExcellentDB) which has low
CPU usage but needs 4GB RAM. Task: Create a new flavor (eDB.mini) with 1 vCPU + 4 GB
RAM + 10 GB Disk. Allow access to project promotion.
Ans:
i. Openstack flavor list to check if the flavor exists
ii. openstack flavor create --ram 4096 --disk 10 --vcpus 1 --private eDB.mini
iii. openstack flavor list --private
iv. nova flavor-access-add eDB.mini promotion
v. Login into promotion tenant and check if the new flavor is visible
vi. Add eDB.mini to public flavor repository
1. [root@centos7-rdo-liberty06022017-105702 ~]# openstack flavor
create --ram 4096 --disk 10 --vcpus 1 --public eDB.mini
Flavor with name eDB.mini already exists. (HTTP 409) (Request-ID:
req-e71cd1ab-3c22-4446-be33-c7ca14de87b8)
ii. Same name of flavor cannot exist. So,
openstack flavor create --ram 4096 --disk 10 --vcpus 1 --public
eDB1.mini
6. Block storage
a. One of the DB instances in Promotion tenant running Database needs to take local
backup. Task: Add a 20 GB Block or Object Storage to instance
7. Task: Mike has downloaded the Trusty image from the internet. Task: Create a glance
image from recently downloaded Ubuntu image
# glance image-create --name Ubuntu1504 --file trusty-servercloudimg-amd64-
disk1.img --disk-format qcow2 --container-format bare --visibility public --progress
8. Mike, the Promotion Dev-Ops engineer wrongly named the glance image as
Ubuntu1504 instead of Ubuntu1404
Task: Change the name of the glance image
root@ubuntu:~# glance image-update 880473d7-c947-4849-b2ee-dd8196cc48cf --
property name="new cirros"
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2017-02-08T16:35:38Z |
| disk_format | qcow2 |
| id | 880473d7-c947-4849-b2ee-dd8196cc48cf |
| min_disk |0 |
| min_ram |0 |
| name | new cirros |
| owner | 7af5cca23d4b43dbaf87b59bd376e72b |
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2017-02-08T16:44:24Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+
9. Promotion team wants to use the latest Ubuntu release for spawning-up web servers.
Some of the forums have been reporting that the latest Ubuntu is not stable to run Web
services.
Task: Delete Ubuntu17.17 from the Glance Image repository
10. Promotion Team has provisioned 1 web-server instance running Apache on port 80, 443
and port 9000 for administration of portal. Task: assign Security Groups to have a)
access to this web-server for all 3 TCP ports accessible from anywhere b) Open Port TCP
22 for SSH administration also c) ICMP to ping the server.
Ans:
nova secgroup-create promo-webserver "Security group for web servers running
Promotion"
nova secgroup-add-rule promo-webserver tcp 80 80 0.0.0.0/0
nova secgroup-add-rule promo-webserver tcp 443 443 0.0.0.0/0
nova secgroup-add-rule promo-webserver tcp 9000 9000 0.0.0.0/0
nova secgroup-add-rule promo-webserver tcp 22 22 0.0.0.0/0
nova secgroup-add-rule promo-webserver icmp -1 -1 0.0.0.0/0
Task: Delete a security group (named, secgroup-tightly-coupled) that's not needed any
longer.
Ans:
11. Run (boot) new-cirros image as an instance with m1.tiny flavor for experimental
purposes
Ans: nova boot --image new-cirros --flavor m1.tiny new-cirros-instance001
13. Troubleshooting - There's authentication problem with Openstack. You login and type #
openstack token issue and get following error
An unexpected error prevented the server from fulfilling your request. (HTTP 500)
(Request-ID: req-620fd0c5-5653-422b-be01-6b2bc046fa7f)
Task: Troubleshoot and fix the problem.
14. Task: Controller has a Cinder Volume named myVolume already created that needs to
be mounted on running instance of Cirros (instance: instance100 )
ANS:
root@ip-172-31-16-10:/home/ubuntu# cinder list
+--------------------------------------+-----------+------------------+----------+------+-------------+----------
+-------------+------------ -+
| ID | Status | Migration Status | Name | Size | Volume Type |
Bootable | Multiattach | Attached to |
+--------------------------------------+-----------+------------------+----------+------+-------------+----------
+-------------+------------ -+
| b864a22a-d625-4440-af3f-a19c85a9c9c7 | available | - | myVolume | 1 |
- | false | False | |
+--------------------------------------+-----------+------------------+----------+------+-------------+----------
+-------------+------------ -+
root@ip-172-31-16-10:/home/ubuntu# cinder show b864a22a-d625-4440-af3f-
a19c85a9c9c7
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2017-02-09T09:12:38.000000 |
| description | None |
| encrypted | False |
| id | b864a22a-d625-4440-af3f-a19c85a9c9c7 |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | myVolume |
| os-vol-host-attr:host | ip-172-31-16-10@lvm#LVM |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 58a9a26c2d5b4a609895951fa131c7c7 |
| os-volume-replication:driver_data | None |
| os-volume-replication:extended_status | None |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | available |
| user_id | 5b5b351bae6244c7b0439c62dd546bf4 |
| volume_type | None |
+---------------------------------------+--------------------------------------+
nova list
+--------------------------------------+-------------+--------+------------+-------------+-----------------------
-----+
| ID | Name | Status | Task State | Power State | Networks
|
+--------------------------------------+-------------+--------+------------+-------------+-----------------------
-----+
| a5c9194f-e315-4006-9e8b-bc4158f847c1 | instance100 | ACTIVE | - | Running
| n1=10.0.0.3, 172.31.49.192 |
+--------------------------------------+-------------+--------+------------+-------------+-----------------------
-----+
root@ip-172-31-16-10:/home/ubuntu# nova volume-attach a5c9194f-e315-4006-9e8b-
bc4158f847c1 b864a22a-d625-4440-af3f-a19c85a9c9c7 /dev/vdb
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| device | /dev/vdb |
| id | b864a22a-d625-4440-af3f-a19c85a9c9c7 |
| serverId | a5c9194f-e315-4006-9e8b-bc4158f847c1 |
| volumeId | b864a22a-d625-4440-af3f-a19c85a9c9c7 |
+----------+--------------------------------------+
root@ip-172-31-16-10:/home/ubuntu# cinder list
+--------------------------------------+--------+------------------+----------+------+-------------+----------+-
------------+--------------------------------------+
| ID | Status | Migration Status | Name | Size | Volume Type |
Bootable | Multiattach | Attached to |
+--------------------------------------+--------+------------------+----------+------+-------------+----------+-
------------+--------------------------------------+
| b864a22a-d625-4440-af3f-a19c85a9c9c7 | in-use | - | myVolume | 1 | -
| false | False | a5c9194f-e315-4006-9e8b-bc4158f847c1 |
+--------------------------------------+--------+------------------+----------+------+-------------+----------+-
------------+--------------------------------------+
[email protected]'s password:
$ sudo su -
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 1G 0 disk
`-vda1 253:1 0 1011.9M 0 part /
vdb 253:16 0 1G 0 disk
#
# cinder list
+--------------------------------------+--------+------------------+----------+------+-------------+----------+-
------------+--------------------------------------+
| ID | Status | Migration Status | Name | Size | Volume Type |
Bootable | Multiattach | Attached to |
+--------------------------------------+--------+------------------+----------+------+-------------+----------+-
------------+--------------------------------------+
| b864a22a-d625-4440-af3f-a19c85a9c9c7 | in-use | - | myVolume | 1 | -
| false | False | a5c9194f-e315-4006-9e8b-bc4158f847c1 |
+--------------------------------------+--------+------------------+----------+------+-------------+----------+-
------------+--------------------------------------+
22.