OpenStack Juno : インスタンスを起動する2015/01/06 |
仮想マシンインスタンスを起動します。
|
|
[1] | 仮想マシンインスタンスに割り当てるメモリ容量やストレージ容量等々を指定して (flavor)、 インスタンスを作成して起動します。 |
# デフォルトの flavor 一覧 [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 | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ # 登録されているイメージ [root@dlp ~(keystone)]# nova image-list +--------------------------------------+----------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+----------+--------+--------+ | 2285e45a-6423-4f9f-a1ac-1ea1d2c757ea | Fedora21 | ACTIVE | | +--------------------------------------+----------+--------+--------+ # インスタンス作成・起動 [root@dlp ~(keystone)]# nova boot --flavor 2 --image Fedora21 --security_group default Fedora_21 +--------------------------------------+-------------------------------------------------+ | 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 | qsyEM8NBSDSn | | config_drive | | | created | 2015-01-06T12:45:35Z | | flavor | m1.small (2) | | hostId | | | id | e6801c42-e317-4b83-a6dc-0e9763b3a1b5 | | image | Fedora21 (2285e45a-6423-4f9f-a1ac-1ea1d2c757ea) | | key_name | - | | metadata | {} | | name | Fedora_21 | | os-extended-volumes:volumes_attached | [] | | progress | 0 | | security_groups | default | | status | BUILD | | tenant_id | ba9a9493fcd34512bf09108e455dc17e | | updated | 2015-01-06T12:45:35Z | | user_id | 7a4b7e535b2044d0a0a673ebd33c96da | +--------------------------------------+-------------------------------------------------+ # 動作確認 (起動直後しばらくは「BUILD」ステータスとなっている) [root@dlp ~(keystone)]# nova list +-----------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-------------+--------+------------+-------------+--------------------+ | ee692a0f- | Fedora_21 | BUILD | spawning | NOSTATE | network01=10.1.0.2 | +-----------+-------------+--------+------------+-------------+--------------------+ |
[2] | 起動した仮想マシンインスタンスにログインできるか確認してみます。 |
# 起動後しばらくすると以下のように「ACTIVE」ステータスとなる [root@dlp ~(keystone)]# nova list +-----------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-------------+--------+------------+-------------+--------------------+ | ee692a0f- | Fedora_21 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-------------+--------+------------+-------------+--------------------+ # 以下のように応答が返ってくればOK [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=1.38 ms 64 bytes from 10.1.0.2: icmp_seq=2 ttl=64 time=1.07 ms ^C --- 10.1.0.2 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 1.070/1.228/1.386/0.158 ms # 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 8d:e0:58:4b:6e:e1:4e:f2:fc:e9:42:7d:2f:5d:c0:d0. 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: # インストール時に設定した root パスワード Last login: Tue Jan 6 19:55:56 2015 [root@localhost ~]# # ログインできた
|
[3] | 一旦作成して起動した仮想マシンインスタンスを停止/起動する場合は、以下のように nova コマンドで制御できます。 |
[root@dlp ~(keystone)]# nova list +-----------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-------------+--------+------------+-------------+--------------------+ | ee692a0f- | Fedora_21 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-------------+--------+------------+-------------+--------------------+ # インスタンス停止 [root@dlp ~(keystone)]# nova stop Fedora_21 [root@dlp ~(keystone)]# nova list +-----------+-----------+---------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+---------+------------+-------------+--------------------+ | 29d99611- | Fedora_21 | SHUTOFF | - | Shutdown | network01=10.1.0.2 | +-----------+-----------+---------+------------+-------------+--------------------+ # インスタンスを再度起動する [root@dlp ~(keystone)]# nova start Fedora_21 [root@dlp ~(keystone)]# nova list +-----------+-----------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+--------+------------+-------------+--------------------+ | 29d99611- | Fedora_21 | ACTIVE | - | Running | network01=10.1.0.2 | +-----------+-----------+--------+------------+-------------+--------------------+ |
Sponsored Link |