Ubuntu 14.04
Sponsored Link

OpenStack Liberty : インスタンスを起動する2015/12/23

 
仮想マシンインスタンスを起動します。
[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 |
+--------------------------------------+------------+--------+--------+
| d5b3b32b-e90c-4253-80e1-ce30ba29d06a | Ubuntu1404 | ACTIVE |        |
+--------------------------------------+------------+--------+--------+

# インスタンス作成・起動

root@dlp ~(keystone)#
nova boot --flavor 2 --image Ubuntu1404 --security_group default Ubuntu_1404

+--------------------------------------+---------------------------------------------------+
| Property                             | Value                                             |
+--------------------------------------+---------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                            |
| OS-EXT-AZ:availability_zone          |                                                   |
| OS-EXT-SRV-ATTR:host                 | -                                                 |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                 |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000006                                 |
| 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                            | oR9ABqTNk53f                                      |
| config_drive                         |                                                   |
| created                              | 2015-12-24T15:48:12Z                              |
| flavor                               | m1.small (2)                                      |
| hostId                               |                                                   |
| id                                   | 33bbc090-c86a-4811-8d1c-ce5c66320006              |
| image                                | Ubuntu1404 (d5b3b32b-e90c-4253-80e1-ce30ba29d06a) |
| key_name                             | -                                                 |
| metadata                             | {}                                                |
| name                                 | Ubuntu_1404                                       |
| os-extended-volumes:volumes_attached | []                                                |
| progress                             | 0                                                 |
| security_groups                      | default                                           |
| status                               | BUILD                                             |
| tenant_id                            | fa7d34414b8c45c4a2fdc29403fb5cd2                  |
| updated                              | 2015-12-24T15:48:12Z                              |
| user_id                              | 5efb3edfd2f347eea6258068a06cb9f1                  |
+--------------------------------------+---------------------------------------------------+

# 動作確認 (起動直後しばらくは「BUILD」ステータスとなっている)

root@dlp ~(keystone)#
nova list

+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks           |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| 33bbc090-c86a-4811-8d1c-ce5c66320006 | Ubuntu_1404 | BUILD  | spawning   | NOSTATE     | network01=10.1.0.3 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+
[2] 起動した仮想マシンインスタンスにログインできるか確認します。
# 起動後しばらくすると以下のように「ACTIVE」ステータスとなる

root@dlp ~(keystone)#
nova list

+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks           |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| 33bbc090-c86a-4811-8d1c-ce5c66320006 | Ubuntu_1404 | ACTIVE | -          | Running     | network01=10.1.0.3 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+

# 以下のように応答が返ってくればOK

root@dlp ~(keystone)#
ping 10.1.0.3

PING 10.1.0.3 (10.1.0.3) 56(84) bytes of data.
64 bytes from 10.1.0.3: icmp_seq=1 ttl=64 time=0.617 ms
64 bytes from 10.1.0.3: icmp_seq=2 ttl=64 time=0.458 ms

--- 10.1.0.3 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.458/0.537/0.617/0.082 ms

# インストール中に追加したユーザーで SSH ログイン

root@dlp ~(keystone)#
ssh trusty@10.1.0.3

The authenticity of host '10.1.0.3 (10.1.0.3)' can't be established.
ECDSA key fingerprint is 6f:89:a8:54:00:e4:41:65:ba:5a:a3:b4:f5:a9:69:fa.
Are you sure you want to continue connecting (yes/no)?
yes

Warning: Permanently added '10.1.0.3' (ECDSA) to the list of known hosts.
trusty@10.1.0.3's password:
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-74-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Thu Dec 24 23:34:16 2015
trusty@ubuntu-1404:~$    
# ログインできた

[3] 一旦作成して起動した仮想マシンインスタンスを停止/起動する場合は、以下のように nova コマンドで制御できます。
root@dlp ~(keystone)#
nova list

+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks           |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| 33bbc090-c86a-4811-8d1c-ce5c66320006 | Ubuntu_1404 | ACTIVE | -          | Running     | network01=10.1.0.3 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+

# インスタンス停止

root@dlp ~(keystone)#
nova stop Ubuntu_1404

Request to stop server Ubuntu_1404 has been accepted.
root@dlp ~(keystone)#
nova list

+--------------------------------------+-------------+---------+------------+-------------+--------------------+
| ID                                   | Name        | Status  | Task State | Power State | Networks           |
+--------------------------------------+-------------+---------+------------+-------------+--------------------+
| 33bbc090-c86a-4811-8d1c-ce5c66320006 | Ubuntu_1404 | SHUTOFF | -          | Shutdown    | network01=10.1.0.3 |
+--------------------------------------+-------------+---------+------------+-------------+--------------------+

# インスタンスを再度起動する

root@dlp ~(keystone)#
nova start Ubuntu_1404

Request to start server Ubuntu_1404 has been accepted.
root@dlp ~(keystone)#
nova list

+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks           |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| 33bbc090-c86a-4811-8d1c-ce5c66320006 | Ubuntu_1404 | ACTIVE | -          | Running     | network01=10.1.0.3 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+
[4] VNC コンソールを取得して Web ブラウザでのアクセスも可能です。
root@dlp ~(keystone)#
nova list

+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| ID                                   | Name        | Status | Task State | Power State | Networks           |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+
| 33bbc090-c86a-4811-8d1c-ce5c66320006 | Ubuntu_1404 | ACTIVE | -          | Running     | network01=10.1.0.3 |
+--------------------------------------+-------------+--------+------------+-------------+--------------------+

root@dlp ~(keystone)#
nova get-vnc-console Ubuntu_1404 novnc

+-------+--------------------------------------------------------------------------------+
| Type  | Url                                                                            |
+-------+--------------------------------------------------------------------------------+
| novnc | http://10.0.0.30:6080/vnc_auto.html?token=9c39b3de-e4cd-4bbd-b1e8-c5ddebbe0d2e |
+-------+--------------------------------------------------------------------------------+
[5] get-vnc-console で表示された URL にアクセスすると、インスタンスにアクセスして操作可能です。
関連コンテンツ