OpenStack Icehouse : Boot Instance2014/06/23 |
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 virtual images list [root@dlp ~(keystone)]# nova image-list +--------------------------------------+---------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+---------+--------+--------+ | e410fef2-4387-43f6-bedc-5a9f81ee6ac6 | CentOS6 | ACTIVE | | +--------------------------------------+---------+--------+--------+ # create and boot an instance [root@dlp ~(keystone)]# nova boot --flavor 2 --image CentOS6 --security_group default CentOS_65 +--------------------------------------+------------------------------------------------+ | 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 | 5tuTuA499z7L | | config_drive | | | created | 2014-05-07T12:52:03Z | | flavor | m1.small (2) | | hostId | | | id | 88734aa5-926f-4cea-b347-0a90452a989b | | image | CentOS6 (e410fef2-4387-43f6-bedc-5a9f81ee6ac6) | | key_name | - | | metadata | {} | | name | CentOS_65 | | os-extended-volumes:volumes_attached | [] | | progress | 0 | | security_groups | default | | status | BUILD | | tenant_id | 35f01938c8fc4021ab8e9710512a1201 | | updated | 2014-05-07T12:52:04Z | | user_id | 1d24294fc26f46e3b60c0fbe637c4d08 | +--------------------------------------+------------------------------------------------+ # show status [root@dlp ~(keystone)]# nova list +-----------+-----------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+--------+------------+-------------+--------------------+ | 88734aa5- | CentOS_65 | 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 | +-----------+-----------+--------+------------+-------------+--------------------+ | 88734aa5- | CentOS_65 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-----------+--------+------------+-------------+--------------------+ # it's OK if ICMP answer replys like follows [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.674 ms 64 bytes from 10.1.0.2: icmp_seq=2 ttl=64 time=0.549 ms ^C --- 10.1.0.2 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1789ms rtt min/avg/max/mdev = 0.549/0.611/0.674/0.067 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. RSA key fingerprint is 29:11:42:68:a2:e0:84:02:d3:93:5c:90:17:22:8f:81. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.1.0.2' (RSA) to the list of known hosts. root@10.1.0.2's password: Last login: Mon May 5 17:44:11 2014 [root@centos-65 ~]# # 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 | +-----------+-----------+--------+------------+-------------+--------------------+ | 88734aa5- | CentOS_65 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-----------+--------+------------+-------------+--------------------+ # stop instance [root@dlp ~(keystone)]# nova stop CentOS_65 [root@dlp ~(keystone)]# nova list +-----------+-----------+---------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+---------+------------+-------------+--------------------+ | 88734aa5- | CentOS_65 | SHUTOFF | - | Shutdown | network01=10.1.0.2 | +-----------+-----------+---------+------------+-------------+--------------------+ # start instance again [root@dlp ~(keystone)]# nova start CentOS_65 [root@dlp ~(keystone)]# nova list +-----------+-----------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+--------+------------+-------------+--------------------+ | 88734aa5- | CentOS_65 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-----------+--------+------------+-------------+--------------------+ |
Sponsored Link |