18 Feb Practice Tasks - Satish

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

1.

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

vii. nova flavor-access-remove eDB.mini promotion (towards the end)


3. Task: Spin-up 3 DB instance of eDB.mini flavor
Ans:
i. Openstack image list (check if cirros image exists)
ii. If no image, download cirros. glance image-create --name "new-cirros" --file
cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --
visibility public --progress
iii. nova boot --flavor eDB1.mini --image new-cirros cirros-instance001
iv. Nova list
iv. Task: The architect of "promotion" team indicates that we need to change the flavor of
existing instances (cirros-instance001 to cirros-instance003) from eDB.mini to
m1.medium
Ans: nova resize cirros-instance001 m1.medium

5. Task: End of season, we delete all the instances


Ans: nova delete cirros-instance001 # run nova list to check if the instances are
deleted

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

nova secgroup-list-rules promo-webserver

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

12. Task: Login using SSH to the system


Create a pem file -

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.

Ans: service memcached status ; # if not running ; service memcached start

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
#

15. Task: Create a snapshot of existing Cinder Volume.


# cinder snapshot-create --force True --display-name snap1 b864a22a-d625-4440-af3f-
a19c85a9c9 c7
+-------------+--------------------------------------+
| Property | Value |
+-------------+--------------------------------------+
| created_at | 2017-02-09T20:15:05.759104 |
| description | None |
| id | b6bada5d-3050-46b4-a167-e3e9a17aba5e |
| metadata | {} |
| name | snap1 |
| size | 1 |
| status | creating |
| volume_id | b864a22a-d625-4440-af3f-a19c85a9c9c7 |
+-------------+--------------------------------------+
root@ip-172-31-16-10:/home/ubuntu# cinder snapshot-list
+--------------------------------------+--------------------------------------+-----------+-------+------+
| ID | Volume ID | Status | Name | Size |
+--------------------------------------+--------------------------------------+-----------+-------+------+
| b6bada5d-3050-46b4-a167-e3e9a17aba5e | b864a22a-d625-4440-af3f-a19c85a9c9c7
| available | snap1 | 1 |
+--------------------------------------+--------------------------------------+-----------+-------+------+

# cinder snapshot-show b6bada5d-3050-46b4-a167-e3e9a17aba5e


+--------------------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------------------+--------------------------------------+
| created_at | 2017-02-09T20:15:05.000000 |
| description | None |
| id | b6bada5d-3050-46b4-a167-e3e9a17aba5e |
| metadata | {} |
| name | snap1 |
| os-extended-snapshot-attributes:progress | 100% |
| os-extended-snapshot-attributes:project_id | 58a9a26c2d5b4a609895951fa131c7c7
|
| size | 1 |
| status | available |
| volume_id | b864a22a-d625-4440-af3f-a19c85a9c9c7 |
+--------------------------------------------+--------------------------------------+

# 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 |
+--------------------------------------+--------+------------------+----------+------+-------------+----------+-
------------+--------------------------------------+

16. Cinder Backup # Could not test


17. Cinder Encrypted Volume # Could not test
18. Swift Container and set an expiry time # Could not test
19. Task:Create a Network named Promo-Private-Net01
# neutron net-create Promo-Private-Net01

20. Task: Create a subnet within Promo-Private-Net with 10.2.0.0/24 IP range


# neutron subnet-create --name Promo-Private-Subnet01 Promo-Private-Net01
10.2.0.0/24

21. Task: Boot a new instance of Cirros connected to Promo-Private-Net01 network


# nova net-list
+--------------------------------------+-------+------+
| ID | Label | CIDR |
+--------------------------------------+-------+------+
| 04ecb691-411c-473c-a576-ec8923f675b3 | Promo-Private-Net01 | None |
| 31ce92cb-1189-4f7c-8476-fdf8ab5743ea | n1 | None |
+--------------------------------------+-------+------+
root@ip-172-31-16-10:/home/ubuntu#
root@ip-172-31-16-10:/home/ubuntu#
root@ip-172-31-16-10:/home/ubuntu# glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| f408a319-5753-4ba1-ba2a-d8a4735b7242 | cirros |
+--------------------------------------+--------+
root@ip-172-31-16-10:/home/ubuntu# nova boot --flavor m1.tiny --image f408a319-
5753-4ba1-ba2a-d8a4735b7242 --nic net-id=04ecb691-411c-473c-a576-ec8923f675b3
Cirros-instance200
+--------------------------------------+-----------------------------------------------+
| Property | Value |
+--------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-SRV-ATTR:host |- |
| OS-EXT-SRV-ATTR:hypervisor_hostname | - |
| OS-EXT-SRV-ATTR:instance_name | instance-00000002 |
| OS-EXT-STS:power_state |0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at |- |
| OS-SRV-USG:terminated_at |- |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | rPrtMAz6njQm |
| config_drive | |
| created | 2017-02-09T20:45:30Z |
| flavor | m1.tiny (1) |
| hostId | |
| id | 187732d6-6001-4bdc-9e03-ff5e51726d70 |
| image | cirros (f408a319-5753-4ba1-ba2a-d8a4735b7242) |
| key_name |- |
| metadata | {} |
| name | Cirros-instance200 |
| os-extended-volumes:volumes_attached | [] |
| progress |0 |
| security_groups | default |
| status | BUILD |
| tenant_id | 58a9a26c2d5b4a609895951fa131c7c7 |
| updated | 2017-02-09T20:45:31Z |
| user_id | 5b5b351bae6244c7b0439c62dd546bf4 |
+--------------------------------------+-----------------------------------------------+

22.

You might also like