OpenStack Kilo : Run Instances2015/11/12 |
Create and Start Virtual Machine Instance.
|
|
[1] | Specify the flavor (memory or disk) and create an instance and boot it. |
# default flavor list [root@dlp ~(keystone)]# 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 | | 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ # show the list of images [root@dlp ~(keystone)]# nova image-list +--------------------------------------+----------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+----------+--------+--------+ | c5386add-42ae-457a-9e59-62051d986064 | Fedora23 | ACTIVE | | +--------------------------------------+----------+--------+--------+ # create and boot an instance [root@dlp ~(keystone)]# nova boot --flavor 2 --image Fedora23 --security_group default Fedora_23 +--------------------------------------+-------------------------------------------------+ | Property | Value | +--------------------------------------+-------------------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | nova | | OS-EXT-SRV-ATTR:host | - | | OS-EXT-SRV-ATTR:hypervisor_hostname | - | | OS-EXT-SRV-ATTR:instance_name | instance-00000001 | | 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 | FHTe6HGpL6xc | | config_drive | | | created | 2015-11-13T16:33:06Z | | flavor | m1.small (2) | | hostId | | | id | b4904b94-ae1f-47aa-88cc-39ae83afe171 | | image | Fedora23 (c5386add-42ae-457a-9e59-62051d986064) | | key_name | - | | metadata | {} | | name | Fedora_23 | | os-extended-volumes:volumes_attached | [] | | progress | 0 | | security_groups | default | | status | BUILD | | tenant_id | 90543cc39f274925985200d669e305d7 | | updated | 2015-11-13T16:33:06Z | | user_id | dfe9cafaf69546178eecae7be138d0f1 | +--------------------------------------+-------------------------------------------------+ # show status [root@dlp ~(keystone)]# nova list +-----------+-----------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+--------+------------+-------------+--------------------+ | b4904b94- | Fedora_23 | BUILD | spawning | NOSTATE | network01=10.1.0.2 | +-----------+-----------+--------+------------+-------------+--------------------+ |
[2] | Login to the Instance just booted. |
# after few minutes later, the Status turns "ACTIVE" like follows [root@dlp ~(keystone)]# nova list +----------------+-----------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +----------------+-----------+--------+------------+-------------+--------------------+ | b4904b94-ae1f- | Fedora_23 | ACTIVE | - | Running | network01=10.1.0.2 | +----------------+-----------+--------+------------+-------------+--------------------+ # it's OK if ICMP answer replys like follows [root@dlp ~(keystone)]# ping 10.1.0.2 [root@dlp ~(keystone)]# ping 10.1.0.2 PING 10.1.0.2 (10.1.0.2) 56(84) bytes of data. 64 bytes from 10.1.0.2: icmp_seq=1 ttl=64 time=0.608 ms 64 bytes from 10.1.0.2: icmp_seq=2 ttl=64 time=0.501 ms --- 10.1.0.2 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 0.501/0.554/0.608/0.058 ms # login with SSH [root@dlp ~(keystone)]# ssh 10.1.0.2 The authenticity of host '10.1.0.2 (10.1.0.2)' can't be established. ECDSA key fingerprint is SHA256:VlCNMce+VN8tL0WpeaodWcoCPTyWOevGdCzVRKUngpQ. ECDSA key fingerprint is MD5:03:e7:c2:50:b7:10:57:cc:dc:37:7b:d0:8d:a4:38:aa. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.1.0.2' (ECDSA) to the list of known hosts. root@10.1.0.2's password: Last login: Sat Nov 14 01:21:44 2015 [root@fedora-23 ~]# # just logined normally |
[3] | If you'd like to stop an instance, it's also possible to control with nova command like follows. |
[root@dlp ~(keystone)]# nova list +-----------+-----------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+--------+------------+-------------+--------------------+ | b4904b94- | Fedora_23 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-----------+--------+------------+-------------+--------------------+ # stop instance [root@dlp ~(keystone)]# nova stop Fedora_23 Request to stop server Fedora_23 has been accepted. [root@dlp ~(keystone)]# nova list +-----------+-----------+---------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+---------+------------+-------------+--------------------+ | b4904b94- | Fedora_23 | SHUTOFF | - | Shutdown | network01=10.1.0.2 | +-----------+-----------+---------+------------+-------------+--------------------+ # start instance [root@dlp ~(keystone)]# nova start Fedora_23 Request to start server CentOS_7 has been accepted. [root@dlp ~(keystone)]# nova list +-----------+-----------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+--------+------------+-------------+--------------------+ | b4904b94- | Fedora_23 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-----------+--------+------------+-------------+--------------------+ |
Sponsored Link |
|