This blog is part of my series on Openstack Juno. In this blog, I will cover the usage of Openstack services Nova, Cinder.
I found this blog on Openstack services good in giving a highlevel overview of services and comparing individual Openstack services with Amazon AWS services.
Nova basics:
Nova is the Openstack compute service.
Following command shows the flavors available by default. Flavors are different configurations(CPU, memory, hard disk) for the VMs that can be created from Nova.
$ nova flavor-list +-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | +-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True | | 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | | 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | | 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | | 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True | | 451 | m1.heat | 512 | 0 | 0 | | 1 | 1.0 | True | | 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | | 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True | +-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
Following command shows different images available to instantiate.
$ nova image-list +--------------------------------------+---------------------------------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+---------------------------------+--------+--------+ | 45bfe06a-554e-41ef-96c0-0357e5c1a12c | Fedora-x86_64-20-20140618-sda | ACTIVE | | | dd45d30c-ca17-4ab9-83cc-2f3ab7332ba2 | cirros-0.3.2-x86_64-uec | ACTIVE | | | afc78c04-1506-4ce1-8b11-dca860b019b9 | cirros-0.3.2-x86_64-uec-kernel | ACTIVE | | | 341a5af8-a492-41fa-8074-52b7819b7866 | cirros-0.3.2-x86_64-uec-ramdisk | ACTIVE | | | 7a976a34-edac-44ae-828c-ee54e075d00a | ubuntu_mysql | ACTIVE | | +--------------------------------------+---------------------------------+--------+--------+
Lets add a keypair that we can use to connect to the instance using ssh:
nova keypair-add heattest > ~/Downloads/heattest.pem
Now, display the keypair list.
$ nova keypair-list +----------+-------------------------------------------------+ | Name | Fingerprint | +----------+-------------------------------------------------+ | heattest | 66:7b:2a:5f:ce:c1:75:e1:fc:cb:c1:8c:66:78:d4:6d | +----------+-------------------------------------------------+
Lets update the default security group to allow ssh and icmp access.
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0
Lets look at the security group list:
$ nova secgroup-list-rules default +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | icmp | -1 | -1 | 0.0.0.0/0 | | | | | | | default | | | | | | default | | tcp | 1 | 65535 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+
Lets create 2 nano instances running Cirros image.
nova boot --flavor m1.nano --image cirros-0.3.2-x86_64-uec --security-groups default --key-name heattest --max-count 2 cirrostest
Now, list the instances:
$ nova list +--------------------------------------+-------------------------------------------------+--------+------------+-------------+------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------------------------------------------+--------+------------+-------------+------------------+ | bc8f97fd-9864-4217-a07b-fd85045f3f0b | cirrostest-bc8f97fd-9864-4217-a07b-fd85045f3f0b | ACTIVE | - | Running | private=10.0.0.3 | | ccfec6b3-57d0-4d48-8d58-c0b2b4426490 | cirrostest-ccfec6b3-57d0-4d48-8d58-c0b2b4426490 | ACTIVE | - | Running | private=10.0.0.2 | +--------------------------------------+-------------------------------------------------+--------+------------+-------------+------------------+
We should be able to ssh to the instance as well as ping across the instances:
$ ssh -i ~/Downloads/heattest.pem cirros@10.0.0.2
$ ping -c1 10.0.0.3
PING 10.0.0.3 (10.0.0.3): 56 data bytes
64 bytes from 10.0.0.3: seq=0 ttl=64 time=30.242 ms
--- 10.0.0.3 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 30.242/30.242/30.242 ms
$ ifconfig
eth0 Link encap:Ethernet HWaddr FA:16:3E:37:A1:BF
inet addr:10.0.0.2 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::f816:3eff:fe37:a1bf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:164 errors:0 dropped:0 overruns:0 frame:0
TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23210 (22.6 KiB) TX bytes:8076 (7.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Cinder:
Cinder is used for managing block storage attached to instances.
First, check Cinder availability zones.
$ cinder availability-zone-list +------+-----------+ | Name | Status | +------+-----------+ | nova | available | +------+-----------+
Create a 1GB Cinder volume and associate it with the Cirros imageid.
$ cinder create 1 --display-name my-new-volume --image-id dd45d30c-ca17-4ab9-83cc-2f3ab7332ba2 --availability-zone nova
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2015-02-16T11:33:55.000000 |
| description | None |
| encrypted | False |
| id | 585ae08f-e43b-4251-9035-519edb55cb9d |
| metadata | {} |
| name | my-new-volume |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 0fab1e00669245d189ca21d0d0023411 |
| os-volume-replication:driver_data | None |
| os-volume-replication:extended_status | None |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| user_id | 9fdd3b11fd6846f6b37d038ebd90b080 |
| volume_type | lvmdriver-1 |
+---------------------------------------+--------------------------------------+
Check that the volume is created successfully.
$ cinder list +--------------------------------------+-----------+---------------+------+-------------+----------+-------------+ | ID | Status | Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+---------------+------+-------------+----------+-------------+ | 585ae08f-e43b-4251-9035-519edb55cb9d | available | my-new-volume | 1 | lvmdriver-1 | true | | +--------------------------------------+-----------+---------------+------+-------------+----------+-------------+
Attach the volume to already running instance.
$ nova list +--------------------------------------+-------------------------------------------------+--------+------------+-------------+------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------------------------------------------+--------+------------+-------------+------------------+ | bc8f97fd-9864-4217-a07b-fd85045f3f0b | cirrostest-bc8f97fd-9864-4217-a07b-fd85045f3f0b | ACTIVE | - | Running | private=10.0.0.3 | | ccfec6b3-57d0-4d48-8d58-c0b2b4426490 | cirrostest-ccfec6b3-57d0-4d48-8d58-c0b2b4426490 | ACTIVE | - | Running | private=10.0.0.2 | +--------------------------------------+-------------------------------------------------+--------+------------+-------------+------------------+ smakam14@sreeubuntu14-VirtualBox:~/devstack$ nova volume-attach ccfec6b3-57d0-4d48-8d58-c0b2b4426490 585ae08f-e43b-4251-9035-519edb55cb9d /dev/vdb +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdb | | id | 585ae08f-e43b-4251-9035-519edb55cb9d | | serverId | ccfec6b3-57d0-4d48-8d58-c0b2b4426490 | | volumeId | 585ae08f-e43b-4251-9035-519edb55cb9d | +----------+--------------------------------------+
Mount the new volume in the Cirros instance.
$ sudo mkdir /testmnt $ sudo mount /dev/vdb /testmnt $ df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev 21768 0 21768 0% /dev /dev/vda 23797 9785 12784 43% / tmpfs 25448 0 25448 0% /dev/shm tmpfs 200 96 104 48% /run /dev/vdb 23797 1233 21336 5% /testmnt
Cinder volumes can also be used for VM snapshots.
Openstack Juno services – Nova, Cinder:
References:
1 thought on “Openstack Juno services – Nova, Cinder”