問題說明:
在openstack上建立虛擬機,以前已順利建立了n個centos6.8鏡像的vm
如今用ubuntu14.04鏡像建立vm,發現vm建立後的狀態爲ERROR!node
1)終端命令行操做vm建立python
[root@linux-node2 src]# nova boot --flavor kvm002 --image ubuntu-14.04 --nic net-id=3a5cef6e-2c12-4f26-938c-5d343edc91b3 --security-group default --key-name mykey kvm-ubuntu01
+--------------------------------------+-----------------------------------------------------+
| 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 | 97FNEj25qDHw |
| config_drive | |
| created | 2016-10-31T06:01:15Z |
| flavor | kvm002 (38d2c062-3fc5-4fc8-9bef-3cf16a7cf6d0) |
| hostId | |
| id | 898363d4-b5df-4603-80f3-299bba76f79c |
| image | ubuntu-14.04 (25fa5e72-5e10-4500-905a-82eda30dca21) |
| key_name | mykey |
| metadata | {} |
| name | kvm-ubuntu01 |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | default |
| status | BUILD |
| tenant_id | 0cd3632df93d48d6b2c24c67f70e56b8 |
| updated | 2016-10-31T06:01:15Z |
| user_id | 52ba7917bb284af7ad6ac313b7e8e948 |
+--------------------------------------+-----------------------------------------------------+mysql
建立後,發現vm的狀態是ERRORlinux
[root@linux-node2 src]# nova list
+--------------------------------------+--------------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------------+--------+------------+-------------+----------+
| 898363d4-b5df-4603-80f3-299bba76f79c | kvm-ubuntu01 | ERROR | - | NOSTATE | |
+--------------------------------------+--------------+--------+------------+-------------+----------+sql
2)嘗試在openstack的dashboard界面裏建立vm(即:「計算」->「實例"->"啓動雲主機"),若是vm建立失敗,則會顯示錯誤信息。ubuntu
如上圖,報錯信息:
Flavor's disk is too small for requested image. Flavor disk is 16106127360 bytes, image is 21474836480 bytes.].centos
說明建立vm時所使用的Flavor(雲主機類型)的磁盤空間不知足image鏡像要求!本案例是說kvm002(15G)的根磁盤不知足ubuntu-14.04(openstack界面-「鏡像」查看此鏡像大小是25G)鏡像大小。網絡
查看建立vm所使用的Flavor的類型python2.7
解決辦法:ui
調整對應Flavor類型的跟磁盤大小(即:"系統"->"雲主機類型"->"編輯雲主機類型"->"主機類型信息")。以下,由原來的15G調整到30G!
最後,再次嘗試建立vm:
[root@linux-node2 src]# nova boot --flavor kvm002 --image ubuntu-14.04 --nic net-id=3a5cef6e-2c12-4f26-938c-5d343edc91b3 --security-group default --key-name mykey kvm-ubuntu01
+--------------------------------------+-----------------------------------------------------+
| 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 | 97FNEj25qDHw |
| config_drive | |
| created | 2016-10-31T06:01:15Z |
| flavor | kvm002 (38d2c062-3fc5-4fc8-9bef-3cf16a7cf6d0) |
| hostId | |
| id | 898363d4-b5df-4603-80f3-299bba76f79c |
| image | ubuntu-14.04 (25fa5e72-5e10-4500-905a-82eda30dca21) |
| key_name | mykey |
| metadata | {} |
| name | kvm-ubuntu01 |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | default |
| status | BUILD |
| tenant_id | 0cd3632df93d48d6b2c24c67f70e56b8 |
| updated | 2016-10-31T06:01:15Z |
| user_id | 52ba7917bb284af7ad6ac313b7e8e948 |
+--------------------------------------+-----------------------------------------------------+
建立虛擬機後,發現vm能夠正常啓動了!
[root@linux-node2 src]# nova list
+--------------------------------------+--------------+--------+------------+-------------+--------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------------+--------+------------+-------------+--------------------+
| 729dd327-3447-42b9-b9cb-e7ef4a38b725 | kvm-ubuntu01 | ACTIVE | - | Running | flat=192.168.1.120 |
+--------------------------------------+--------------+--------+------------+-------------+--------------------+
------------------------------------------------------------------------------------------------------------------------------
問題:在一個計算節點上建立虛擬機,建立前幾個虛擬機都沒問題,可是再建立第n個虛擬機時就失敗,報錯以下:
建立雲主機,狀態錯誤,沒法啓動,提示NoValidHost: No valid host was found. There are not enough hosts available.
查看nova-conductor.log,以下:
[root@linux-node2 nova]# pwd
/var/log/nova
[root@linux-node2 nova]# tail -100 nova-conductor.log
...................
2016-11-01 01:28:38.889 51843 WARNING nova.scheduler.utils [req-9eb2b8ec-216b-4073-95bd-1fbb51844faf 52ba7917bb284af7ad6ac313b7e8e948 0cd3632df93d48d6b2c24c67f70e56b8 - - -] Failed to compute_task_build_instances: No valid host was found. There are not enough hosts available.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 142, in inner
return func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/nova/scheduler/manager.py", line 84, in select_destinations
filter_properties)
File "/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py", line 90, in select_destinations
raise exception.NoValidHost(reason=reason)
NoValidHost: No valid host was found. There are not enough hosts available.
2016-11-01 01:28:38.889 51843 WARNING nova.scheduler.utils [req-9eb2b8ec-216b-4073-95bd-1fbb51844faf 52ba7917bb284af7ad6ac313b7e8e948 0cd3632df93d48d6b2c24c67f70e56b8 - - -] [instance: 2211eeb4-9d06-4b15-ac15-69cdabe280ff] Setting instance to ERROR state.
這個問題產生的很大緣由有:
1)計算節點的內存不足、CPU資源不夠、硬盤空間資源不足形成的;將雲主機類型規格調小點,發現就能建立成功。
2)網絡配置不正確,形成建立虛擬機的時候獲取ip失敗;網絡不通或防火牆引發。
3)openstack-nova-compute服務狀態問題。能夠嘗試重啓控制節點的nova相關服務和計算節點的openstack-nova-compute服務;詳細檢查控制節點和計算節點的nova.conf配置是否有不當配置。
4)這個報錯問題的緣由不少,具體要查看/var/log/nova下的日誌詳細分析。重點是nova-compute.log、nova-conductor.log日誌
----------------------------------------------------------------------------------------------------
在部署openstack虛擬機的時候,要注意如下幾點:(1)控制節點和計算節點在部署前,須要在/etc/hosts裏面對主機映射,而且後面不能輕易更改,不然會出問題!(2)mysql的鏈接數要調大!不然在操做過程當中會因爲mysql鏈接數過多而中斷!好比設置mysql鏈接數爲1000,mysql命令爲set GLOBAL max_connections=1000; (3)在建立vm的時候,要保證openstack節點的內存夠用。(4)所使用的Flavor雲主機類型配置的根磁盤要知足image鏡像的空間。