Servers refer to the cloud VM instances

command syntax: openstack server <action/operation> <--flags  vlaues> <instance-name/UUID>

#to view the list of instances

cumulus@server01:~$ openstack server list

cumulus@server01:~$

#to create an instance with the referenced flavor and image

cumulus@server01:~$ openstack server create --image firstImage flavor--firstFlavor firstServer
+-------------------------------------+---------------------------------------------------+
| Field | Value
|
+-------------------------------------+---------------------------------------------------+
| OS-DCF:diskConfig | MANUAL
|
| OS-EXT-AZ:availability_zone |
|
| OS-EXT-SRV-ATTR:host | None
|
| OS-EXT-SRV-ATTR:hypervisor_hostname | None
|
| OS-EXT-SRV-ATTR:instance_name |
|
| OS-EXT-STS:power_state | NOSTATE
|
| OS-EXT-STS:task_state | scheduling
|
| OS-EXT-STS:vm_state | building
|
| OS-SRV-USG:launched_at | None
|
| OS-SRV-USG:terminated_at | None
|
| accessIPv4 |
|
| accessIPv6 |
|
| addresses |
|
| adminPass | qrHeime9M7NM
|
| config_drive |
|
| created | 2018-07-08T10:48
:16Z |
| flavor | firstFlavor (1)
|
| hostId |
|
| id | 83a229e3-313a-48
49-9240-87aed1a7a1da |
| image | firstImage (dfe1
fe95-1518-4c7d-a036-ad1e6b80a5c6) |
| key_name | None
|
| name | firstServer
|
| progress | 0
|
| project_id | 9a4ce13914f04447
89153f632722a42a |
| properties |
|
| security_groups | name='default'
|
| status | BUILD
|
| updated | 2018-07-08T10:48
:16Z |
| user_id | 17b0c21a5161488e
85891464c77edfac |
| volumes_attached |
|
+-------------------------------------+---------------------------------------------------+

#to verify

cumulus@server01:~$ openstack server list
+--------------------------------------+-------------+--------+------------------------+------------+-------------+
| ID | Name | Status | Networks | Image | Flavor|
+--------------------------------------+-------------+--------+------------------------+------------+-------------+
| 83a229e3-313a-4849-9240-87aed1a7a1da | firstServer | ACTIVE | Provider=192.168.0.102 | firstImage | firstFlavor |
+--------------------------------------+-------------+--------+------------------------+------------+-------------+

#let's create a new server with an associated keypair as well
cumulus@server01:~$ openstack server create --image firstImage --flavor firstFlavor --key-name firstKeyPair firstServerWithKeyPair
+-------------------------------------+---------------------------------------------------+
| Field | Value |
+-------------------------------------+---------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | |
| OS-EXT-STS:power_state | NOSTATE |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | None |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | |
| adminPass | MqdQ39d9bmaE |
| config_drive | |
| created | 2018-07-08T13:02:39Z |
| flavor | firstFlavor (1) |
| hostId | |
| id | 17dd9d80-ac5d-4827-a3f7-ed85ed2edd12 |
| image | firstImage (dfe1fe95-1518-4c7d-a036-ad1e6b80a5c6) |
| key_name | firstKeyPair |
| name | firstServerWithKeyPair |
| progress | 0 |
| project_id | 9a4ce13914f0444789153f632722a42a |
| properties | |
| security_groups | name='default' |
| status | BUILD |
| updated | 2018-07-08T13:02:39Z |
| user_id | 17b0c21a5161488e85891464c77edfac |
| volumes_attached | |
+-------------------------------------+---------------------------------------------------+

#to see the details about a server using the UUID

cumulus@server01:~$ openstack server show 51b75145-defd-45cd-9e05-97280d6e668c
+-------------------------------------+----------------------------------------------------------+
| Field | Value |
+-------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | server04 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | server04 |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2018-07-09T16:53:43.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | provider=192.168.0.110 |
| config_drive | |
| created | 2018-07-09T16:53:19Z |
| flavor | m1.nano (0) |
| hostId | 7d4821dbc896dae367dbced6317c60d6edbbf18c2a42ccf35f822114 |
| id | 51b75145-defd-45cd-9e05-97280d6e668c |
| image | cirros (0b16d59f-71f4-48a6-9aef-add8f535bc7d) |
| key_name | firstKeyPair |
| name | firstServer |
| progress | 0 |
| project_id | 6d9cb60806744bbc9618963e77bda3cd |
| properties | |
| security_groups | name='default' |
| status | ACTIVE |
| updated | 2018-07-09T16:53:43Z |
| user_id | d85316e4978a4454836d21cbde99322d |
| volumes_attached | |
+-------------------------------------+----------------------------------------------------------+

#to see if the instance is running

cumulus@server01:~$ openstack server show firstServer | grep status
| status | ACTIVE|

#to stop the instance

cumulus@server01:~$ openstack server stop firstServer

#the status should now should to SHUTOFF

cumulus@server01:~$ openstack server show firstServer | grep status
| status | SHUTOFF|

#to start the server again, and subsequently check the status

cumulus@server01:~$ openstack server start firstServer
cumulus@server01:~$ openstack server show firstServer |grep status
| status | ACTIVE|

#to delete the instances - more than one instance could be deleted at the same time by mentioning instance names separated by a space

cumulus@server01:~$ openstack server delete firstServer firstSnapshotServer

cumulus@server01:~$ openstack server list

cumulus@server01:~$

--end-of-post--