This shows you the differences between two versions of the page.
scgc:laboratoare:09 [2021/11/09 15:11] maria.mihailescu |
scgc:laboratoare:09 [2021/11/10 17:16] (current) maria.mihailescu |
||
---|---|---|---|
Line 4: | Line 4: | ||
* All the clients are already installed on ''fep8.grid.pub.ro'', so we'll use them from there. | * All the clients are already installed on ''fep8.grid.pub.ro'', so we'll use them from there. | ||
===== Tasks ====== | ===== Tasks ====== | ||
+ | <note warning> | ||
+ | All VM names must contain your username. Replace ''user.name'' with your own username (e.g. ''john.doe'') in the following tasks. If the VM name is not specified or is generic (e.g. ''scgc'', ''vm1''), append your username to them (e.g. ''john.doe.scgc'', ''john.doe.vm1''). | ||
+ | </note> | ||
==== 1. [10p] Authentication ==== | ==== 1. [10p] Authentication ==== | ||
Line 235: | Line 238: | ||
=== Security groups === | === Security groups === | ||
- | Security groups are also handled by **Neutron**, so we'll use **neutron security-group-list**. | + | Security groups are also handled by **Neutron**. We'll use **openstack security group list**. |
<code> | <code> | ||
- | $ neutron security-group-list | + | $ openstack security group list |
+--------------------------------------+---------+----------------------------------------------------------------------+ | +--------------------------------------+---------+----------------------------------------------------------------------+ | ||
| id | name | security_group_rules | | | id | name | security_group_rules | | ||
Line 256: | Line 259: | ||
</code> | </code> | ||
- | For very verbose details, use **neutron security-group-show** and the ID of the security group: | + | For very verbose details, use **openstack security group show** and the ID of the security group: |
<code> | <code> | ||
- | $ neutron security-group-show 8ef0e4b7-4543-48da-b304-00f74c6e20c4 | + | $ openstack security group show 8ef0e4b7-4543-48da-b304-00f74c6e20c4 |
+----------------------+--------------------------------------------------------------------+ | +----------------------+--------------------------------------------------------------------+ | ||
| Field | Value | | | Field | Value | | ||
Line 283: | Line 286: | ||
Finally, after listing all the parameters, we can boot the instance. We will use: | Finally, after listing all the parameters, we can boot the instance. We will use: | ||
- | * **image**: **Ubuntu 16.04 Xenial** (with ID **3672370a-af54-47c2-b2c1-d9875952415f**) | + | * **image**: **Ubuntu 16.04 Xenial** |
- | * **flavor**: **m1.tiny** (with ID **3c183fea-cea6-489e-8b6e-d34c4bf073ec**) | + | * **flavor**: **m1.tiny** |
* **keypair**: your own keypair | * **keypair**: your own keypair | ||
- | * **network**: **vlan9** (with ID **424666ed-c0e8-4d1c-96fe-c22c56262a87**) | + | * **network**: **vlan9** |
* **security-group**: **default** | * **security-group**: **default** | ||
- | * **name**: **scgc** | + | * **name**: **user.name-vm** |
- | For booting, we use **nova boot**: | + | For booting, we use **openstack server create**: |
<code> | <code> | ||
- | $ nova boot --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f \ | + | $ openstack server create --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f \ |
--nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --security-group default --key-name fep scgc | --nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --security-group default --key-name fep scgc | ||
+--------------------------------------+------------------------------------------------------------+ | +--------------------------------------+------------------------------------------------------------+ | ||
Line 338: | Line 341: | ||
=== Query === | === Query === | ||
- | We can use **nova list** for listing all instances: | + | We can use **openstack server list** for listing all instances: |
<code> | <code> | ||
- | $ nova list | + | $ openstack server list |
+--------------------------------------+------+--------+------------+-------------+--------------------+ | +--------------------------------------+------+--------+------------+-------------+--------------------+ | ||
| ID | Name | Status | Task State | Power State | Networks | | | ID | Name | Status | Task State | Power State | Networks | | ||
Line 348: | Line 351: | ||
</code> | </code> | ||
- | With **nova show**, we can get details: | + | With **openstack server show**, we can get details: |
<code> | <code> | ||
- | $ nova show acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 | + | $ openstack server show acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 |
+--------------------------------------+------------------------------------------------------------+ | +--------------------------------------+------------------------------------------------------------+ | ||
| Property | Value | | | Property | Value | | ||
Line 394: | Line 397: | ||
=== Stop === | === Stop === | ||
- | For stopping the instance, without deleting it, we can use the **nova stop** command. This is the equivalent of shutting down the instance. | + | For stopping the instance, without deleting it, we can use the **openstack server stop** command. This is the equivalent of shutting down the instance. |
<code> | <code> | ||
- | $ nova stop <INSTANCE ID> | + | $ openstack server stop <INSTANCE ID> |
Request to stop server acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 has been accepted. | Request to stop server acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 has been accepted. | ||
</code> | </code> | ||
<code> | <code> | ||
- | $ nova list | + | $ openstack server list |
+--------------------------------------+------+---------+------------+-------------+--------------------+ | +--------------------------------------+------+---------+------------+-------------+--------------------+ | ||
| ID | Name | Status | Task State | Power State | Networks | | | ID | Name | Status | Task State | Power State | Networks | | ||
Line 415: | Line 418: | ||
=== Start === | === Start === | ||
- | After being stopped, an instance can be started with the **nova start** command: | + | After being stopped, an instance can be started with the **openstack server start** command: |
<code> | <code> | ||
- | $ nova start <INSTANCE ID> | + | $ openstack server start <INSTANCE ID> |
Request to start server acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 has been accepted. | Request to start server acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 has been accepted. | ||
</code> | </code> | ||
<code> | <code> | ||
- | $ nova list | + | $ openstack server list |
+--------------------------------------+------+--------+------------+-------------+--------------------+ | +--------------------------------------+------+--------+------------+-------------+--------------------+ | ||
| ID | Name | Status | Task State | Power State | Networks | | | ID | Name | Status | Task State | Power State | Networks | | ||
Line 437: | Line 440: | ||
=== Terminate === | === Terminate === | ||
- | Terminate the instance with the **nova delete** command: | + | Terminate the instance with the **openstack server delete** command: |
<code> | <code> | ||
- | $ nova delete <INSTANCE ID> | + | $ openstack server delete <INSTANCE ID> |
Request to delete server acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 has been accepted. | Request to delete server acd0fcdd-ac58-49b5-ad04-bf34cc7af4a7 has been accepted. | ||
</code> | </code> | ||
- | After that, the instance should not appear in **nova list** any more: | + | After that, the instance should not appear in **openstack server list** any more: |
<code> | <code> | ||
- | $ nova list | + | $ openstack server list |
+----+------+--------+------------+-------------+----------+ | +----+------+--------+------------+-------------+----------+ | ||
| ID | Name | Status | Task State | Power State | Networks | | | ID | Name | Status | Task State | Power State | Networks | | ||
Line 464: | Line 467: | ||
</code> | </code> | ||
- | Then, boot a instance with **nova boot**, but specifying the **user-data** parameter: | + | Then, boot a instance with **openstack server create**, but specifying the **user-data** parameter: |
<code> | <code> | ||
- | $ nova boot --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f --nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --security-group default --key-name fep --user-data ./day0.txt myinstance | + | $ openstack server create --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f --nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --security-group default --key-name fep --user-data ./day0.txt user.name-vm |
</code> | </code> | ||
Line 481: | Line 484: | ||
<code> | <code> | ||
- | +--------+ mynetwork +--------+ | + | +--------+ user.name.network +--------+ |
- | | client |-------------------------| server | | + | | client |---------------------------------| server | |
- | +--------+ 172.16.1.0/24 +--------+ | + | +--------+ 172.16.1.0/24 +--------+ |
- | | | | + | | | |
- | | | | + | | | |
- | | vlan9 | vlan9 | + | | vlan9 | vlan9 |
</code> | </code> | ||
* **vlan9** already exists and is a **provider** (physical) network | * **vlan9** already exists and is a **provider** (physical) network | ||
- | * **mynetwork** will have to be created and will be a **self-service** network (user defined, only visible inside our own tenant) | + | * **user.name.network** will have to be created and will be a **self-service** network (user defined, only visible inside our own tenant) |
=== Creating the network === | === Creating the network === | ||
- | Create the network using the **neutron net-create** command: | + | Create the network using the **openstack net create** command: |
<code> | <code> | ||
- | $ neutron net-create mynetwork | + | $ openstack net create user.name.network |
Created a new network: | Created a new network: | ||
+-----------------+--------------------------------------+ | +-----------------+--------------------------------------+ | ||
Line 505: | Line 508: | ||
| id | 20a1cce9-9adc-48d3-bb55-3917dd3fbdea | | | id | 20a1cce9-9adc-48d3-bb55-3917dd3fbdea | | ||
| mtu | 0 | | | mtu | 0 | | ||
- | | name | mynetwork | | + | | name | user.name.network | |
| router:external | False | | | router:external | False | | ||
| shared | False | | | shared | False | | ||
Line 516: | Line 519: | ||
Verify it was successfully created using: | Verify it was successfully created using: | ||
* Horizon, in **Project -> Network -> Networks** | * Horizon, in **Project -> Network -> Networks** | ||
- | * the **neutron net-show** command: | + | * the **openstack net show** command: |
<code> | <code> | ||
- | $ neutron net-show <NETWORK ID> | + | $ openstack net show <NETWORK ID> |
+-----------------+--------------------------------------+ | +-----------------+--------------------------------------+ | ||
| Field | Value | | | Field | Value | | ||
Line 526: | Line 529: | ||
| id | 20a1cce9-9adc-48d3-bb55-3917dd3fbdea | | | id | 20a1cce9-9adc-48d3-bb55-3917dd3fbdea | | ||
| mtu | 0 | | | mtu | 0 | | ||
- | | name | mynetwork | | + | | name | user.name.network | |
| router:external | False | | | router:external | False | | ||
| shared | False | | | shared | False | | ||
Line 537: | Line 540: | ||
=== Creating the subnet === | === Creating the subnet === | ||
- | The next step is to create a subnet for **mynetwork**. We will use **neutron subnet-create** and: | + | The next step is to create a subnet for **usern.name.network**. We will use **openstack subnet create** and: |
* **172.16.1.0/24** for prefix | * **172.16.1.0/24** for prefix | ||
- | * **mysubnet** for name | + | * **user.name.subnet** for name |
* no gateway (VMs will have the gateway through **vlan9**) | * no gateway (VMs will have the gateway through **vlan9**) | ||
<code> | <code> | ||
- | $ neutron subnet-create --name mysubnet --no-gateway mynetwork 172.16.1.0/24 | + | $ openstack subnet create user.name.subnet --network user.name.network --subnet-range 172.16.1.0/24 |
Created a new subnet: | Created a new subnet: | ||
+-------------------+------------------------------------------------+ | +-------------------+------------------------------------------------+ | ||
Line 558: | Line 561: | ||
| ipv6_address_mode | | | | ipv6_address_mode | | | ||
| ipv6_ra_mode | | | | ipv6_ra_mode | | | ||
- | | name | mysubnet | | + | | name | user.name.subnet | |
| network_id | 20a1cce9-9adc-48d3-bb55-3917dd3fbdea | | | network_id | 20a1cce9-9adc-48d3-bb55-3917dd3fbdea | | ||
| subnetpool_id | | | | subnetpool_id | | | ||
Line 565: | Line 568: | ||
</code> | </code> | ||
- | Verify the subnet was successfully created using Horizon, in **Project -> Network -> Networks -> mynetwork -> Subnets** | + | Verify the subnet was successfully created using Horizon, in **Project -> Network -> Networks -> user.name.network -> Subnets** |
=== Booting the instances === | === Booting the instances === | ||
Line 571: | Line 574: | ||
We will boot the instances according to the topology. Note that each instance will have 2 vNICs: | We will boot the instances according to the topology. Note that each instance will have 2 vNICs: | ||
* the first one in **vlan9** | * the first one in **vlan9** | ||
- | * the second one in **mynetwork** | + | * the second one in **user.name.network** |
+ | * Use **Ubuntu 16.04 Xenial** as image. | ||
<code> | <code> | ||
- | $ nova boot --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f --nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --nic net-id=<mynetwork ID> --security-group default --key-name <keypair> client | + | $ openstack server create --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f --nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --nic net-id=<user.name.network ID> --security-group default --key-name <keypair> client |
- | $ nova boot --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f --nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --nic net-id=<mynetwork ID> --security-group default --key-name <keypair> server | + | $ openstack server create --flavor m1.tiny --image 3672370a-af54-47c2-b2c1-d9875952415f --nic net-id=424666ed-c0e8-4d1c-96fe-c22c56262a87 --nic net-id=<user.name.network ID> --security-group default --key-name <keypair> server |
</code> | </code> | ||
Line 597: | Line 601: | ||
* terminate the instances: | * terminate the instances: | ||
<code> | <code> | ||
- | $ nova delete <client instance ID> | + | $ openstack server delete <client instance ID> |
- | $ nova delete <server instance ID> | + | $ openstack server delete <server instance ID> |
</code> | </code> | ||
* delete the network: | * delete the network: | ||
<code> | <code> | ||
- | $ neutron net-delete <mynetwork ID> | + | $ openstack net delete <mynetwork ID> |
</code> | </code> | ||
- | Verify that the resources were deleted using **nova list** and **neutron net-list**. | + | Verify that the resources were deleted using **openstack server list** and **openstack net list**. |
==== 7. [20p] Orchestration ==== | ==== 7. [20p] Orchestration ==== | ||
Line 614: | Line 618: | ||
For this, go to **Project -> Orchestration -> Stacks** and click on **Launch Stack** | For this, go to **Project -> Orchestration -> Stacks** and click on **Launch Stack** | ||
- | For **Template source**, upload a file with the following content (substitute <KEYPAIR NAME> with your own keypair name): | + | For **Template source**, upload a file with the following content (substitute <KEYPAIR NAME> with your own keypair name). Substitute the IDs (network, image) with the correct ones: |
<code> | <code> | ||
Line 623: | Line 627: | ||
type: OS::Nova::Server | type: OS::Nova::Server | ||
properties: | properties: | ||
- | name: vm1 | + | name: user.name.vm1 |
image: 3672370a-af54-47c2-b2c1-d9875952415f | image: 3672370a-af54-47c2-b2c1-d9875952415f | ||
flavor: m1.tiny | flavor: m1.tiny | ||
Line 633: | Line 637: | ||
type: OS::Nova::Server | type: OS::Nova::Server | ||
properties: | properties: | ||
- | name: vm2 | + | name: user.name.vm2 |
image: 3672370a-af54-47c2-b2c1-d9875952415f | image: 3672370a-af54-47c2-b2c1-d9875952415f | ||
flavor: m1.tiny | flavor: m1.tiny | ||
Line 643: | Line 647: | ||
type: OS::Nova::Server | type: OS::Nova::Server | ||
properties: | properties: | ||
- | name: vm3 | + | name: user.name.vm3 |
image: 3672370a-af54-47c2-b2c1-d9875952415f | image: 3672370a-af54-47c2-b2c1-d9875952415f | ||
flavor: m1.tiny | flavor: m1.tiny |