Create Server
Openstack supports creating virtual machines from command line interface(CLI).
Requirements
Openstack Server Create
To create the server we need the following command that receives the parameters below:
openstack server create
(--image <image> | --volume <volume>)
--flavor <flavor>
[--security-group <security-group>]
[--key-name <key-name>]
[--property <key=value>]
[--file <dest-filename=source-filename>]
[--user-data <user-data>]
[--availability-zone <zone-name>]
[--block-device-mapping <dev-name=mapping>]
[--nic <net-id=net-uuid,v4-fixed-ip=ip-addr,v6-fixed-ip=ip-addr,port-id=port-uuid,auto,none>]
[--network <network>]
[--port <port>]
[--hint <key=value>]
[--config-drive <config-drive-volume>|True]
[--min <count>]
[--max <count>]
[--wait]
<server-name>
All parameters are explained here #server-create
Listing flavors and images
A virtual machine image is a single file which contains a virtual disk that has a bootable operating system installed on it.
openstack image list
+--------------------------------------+-------------------------+--------+
| ID | Name | Status |
+--------------------------------------+-------------------------+--------+
| d0fbaac9-d324-4418-a28e-4d2b7ad09be9 | base-almalinux-8 | active |
| 28d2f16d-734c-487b-8ede-8ef235e44c0f | base-centos-8 | active |
| 86108dee-01cb-4158-af29-3801be9c6145 | base-debian-10 | active |
| 6fa7b013-6650-4338-9fe7-47f09fc23d07 | base-fedora-34 | active |
| b21ea7ad-dc54-44b6-8383-e44156ba7bbb | docker-ubuntu-20.04 | active |
| b8a6ad74-f160-47cc-9ec0-e115e44a6da6 | minimal-ubuntu-20.04 | active |
...
Flavors define the compute, memory, and storage capacity of virtual machine. To put it simply, a flavor is an available hardware configuration for a server.
openstack flavor list
+-------------+--------------+--------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+-------------+--------------+--------+------+-----------+-------+-----------+
| 10.51501 | m1.g1.0 | 512 | 15 | 0 | 1 | True |
| 101220001 | m1.c10.12 | 12288 | 200 | 0 | 10 | True |
| 101624001 | m1.c10.16 | 16384 | 240 | 0 | 10 | True |
| 104080011 | eds1.g10.40 | 40960 | 800 | 0 | 10 | True |
| 104080012 | eds1.c10.40 | 40960 | 800 | 0 | 10 | True |
...
Authentication
You can also create a private key for access to your server.
openstack keypair list
+------------+-------------------------------------------------+
| Name | Fingerprint |
+------------+-------------------------------------------------+
| your-key | 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 |
...
Networking
The OpenStack Networking service provides an API that allows you to set up and define network connectivity and addressing in the cloud.
openstack network list
+--------------------------------------+--------------------+---------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+--------------------+---------------------------------------+
| 0a92fd7a-9d60-4dcf-ba3f-cdc7ba86e551 | public | 19450ea5-3afb-4e17-a839-e6f11a442b97 |
| 9b7e464a-a60e-4015-ad4b-c1bde655b1d7 | private | faa33cff-2b91-4f85-b6c2-daf184e503a8 |
...
You can choose the network on which to create your server.
Create
openstack server create \
--image b21ea7ad-dc54-44b6-8383-e44156ba7bbb \
--flavor m1.c3.3 \
--key-name your-key \
--network public \
server-development-001
+-----------------------------+------------------------------------------------------------+
| Field | Value |
+-----------------------------+------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| 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 | |
| config_drive | |
| created | 2021-09-29T11:28:02Z |
| flavor | m1.c3.3 (336001) |
| hostId | |
| id | 389512f5-fa80-447a-9742-a6e4e7f96051 |
| image | docker-ubuntu-20.04 (b21ea7ad-dc54-44b6-8383-e44156ba7bbb) |
| key_name | None |
| name | server-development-001 |
| progress | 0 |
| project_id | 60ed74df25964615886b64d33dbaee7f |
| properties | |
| security_groups | name='default' |
| status | BUILD |
| updated | 2021-09-29T11:28:02Z |
| user_id | 063459e21cd4432e86cf376c34e2b9ed |
| volumes_attached | |
+-----------------------------+------------------------------------------------------------+
- Server contains a status attribute that indicates the current server state.
- BUILD: The server has not yet finished the original build process.
openstack server show server-development-001
+-----------------------------+------------------------------------------------------------+
| Field | Value |
+-----------------------------+------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2021-09-29T11:29:01.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | public=185.104.48.30 |
| config_drive | |
| created | 2021-09-29T11:28:02Z |
| flavor | m1.c3.3 (336001) |
| hostId | b0b6275f55fa9d8e86ae6e74a5bbb5572d7e7de78d846753302e72e2 |
| id | 389512f5-fa80-447a-9742-a6e4e7f96051 |
| image | docker-ubuntu-20.04 (b21ea7ad-dc54-44b6-8383-e44156ba7bbb) |
| key_name | None |
| name | server-development-001 |
| progress | 0 |
| project_id | 60ed74df25964615886b64d33dbaee7f |
| properties | |
| security_groups | name='default' |
| status | ACTIVE |
| updated | 2021-09-29T11:29:01Z |
| user_id | 063459e21cd4432e86cf376c34e2b9ed |
| volumes_attached | |
+-----------------------------+------------------------------------------------------------+
Connect to your server
Cloudify Dashboard
The server will appear in the Cloudify.ro dashboard within minutes of creation.
The full documentation can be found on the openstack website