openstack 安裝常見配置和錯誤處理
問題一:重啟機器出現元件沒法互通
openstack Failed to connect to server code:1006
重啟後出現元件無法互通,很可能是因為防火牆問題。
簡單的方法:iptables-F
注:不過,還是建議學習iptables,新增相應的規則
問題二:實時檢視某些日誌的輸出:
例如檢視實時日誌nova-compute.log,以便實時除錯元件問題
cd /var/log/nova/
tail-f nova-compute.log
問題三:關閉selinux
修改/etc/selinux/config 檔案
將SELINUX=enforcing改為SELINUX=disabled
重啟機器即可
問題四:啟動虛擬機器時:
報錯資訊:
Sending discover... Sending discover... Sending discover... Usage: /sbin/cirros-dhcpc <up|down> No lease, failing WARN: /etc/rc3.d/S40-network failed cirros-ds 'net' up at 181.35 checking http://169.254.169.254/2009-04-04/instance-id failed 1/20: up 181.37. request failed failed 2/20: up 183.66. request failed failed 3/20: up 185.67. request failed failed 4/20: up 187.68. request failed failed 5/20: up 189.69. request failed failed 6/20: up 191.70. request failed failed 7/20: up 193.71. request failed failed 8/20: up 195.72. request failed |
問題無法獲得dhcp的ip
1 檢查相關服務,是否正常 neutron ext-list
2 各種服務都正常,考慮防火牆
3 具體檢視相關日誌
我在安裝時,通過檢視日誌,遇到的主要問題是
以下是日誌片段:
packages/nova/virt/libvirt/driver.py", line 4183, in _get_guest_xml 2016-04-28 11:13:55.583 1892 TRACE nova.compute.manager [instance: 0d378398-b6c1-41fd-ac25-98c9ec3c498b] context) 2016-04-28 11:13:55.583 1892 TRACE nova.compute.manager [instance: 0d378398-b6c1-41fd-ac25-98c9ec3c498b] File "/usr/lib/python2.7/site- packages/nova/virt/libvirt/driver.py", line 4054, in _get_guest_config 2016-04-28 11:13:55.583 1892 TRACE nova.compute.manager [instance: 0d378398-b6c1-41fd-ac25-98c9ec3c498b] flavor, virt_type) 2016-04-28 11:13:55.583 1892 TRACE nova.compute.manager [instance: 0d378398-b6c1-41fd-ac25-98c9ec3c498b] File "/usr/lib/python2.7/site- packages/nova/virt/libvirt/vif.py", line 374, in get_config 2016-04-28 11:13:55.583 1892 TRACE nova.compute.manager [instance: 0d378398-b6c1-41fd-ac25-98c9ec3c498b] _("Unexpected vif_type=%s") % vif_type) 2016-04-28 11:13:55.583 1892 TRACE nova.compute.manager [instance: 0d378398-b6c1-41fd-ac25-98c9ec3c498b] NovaException: Unexpected vif_type=binding_failed |
及虛擬機器在繫結虛擬tap口出了問題,考慮相關ovs的環境。
首先檢視服務
出現ovs agent起不來
systemctl status neutron-openvswitch-agent.service
.neutron-openvswitch-agent.service - OpenStack Neutron Open vSwitch Agent Loaded: loaded (/usr/lib/systemd/system/neutron-openvswitch-agent.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2016-04-29 18:59:58 CST; 6 days ago Process: 14269 ExecStart=/usr/bin/neutron-openvswitch-agent --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config- file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini --config-dir /etc/neutron/conf.d/neutron-openvswitch-agent --log-file /var/log/neutron/openvswitch- agent.log (code=exited, status=1/FAILURE) Main PID: 14269 (code=exited, status=1/FAILURE) Apr 29 18:59:58 compute2 neutron-openvswitch-agent[14269]: File "/usr/lib/python2.7/site-packages/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py", line 1731, in main Apr 29 18:59:58 compute2 neutron-openvswitch-agent[14269]: common_config.init(sys.argv[1:]) Apr 29 18:59:58 compute2 neutron-openvswitch-agent[14269]: File "/usr/lib/python2.7/site-packages/neutron/common/config.py", line 185, in init Apr 29 18:59:58 compute2 neutron-openvswitch-agent[14269]: **kwargs) Apr 29 18:59:58 compute2 neutron-openvswitch-agent[14269]: File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 1860, in __call__ Apr 29 18:59:58 compute2 neutron-openvswitch-agent[14269]: self._namespace._files_permission_denied) Apr 29 18:59:58 compute2 neutron-openvswitch-agent[14269]: oslo_config.cfg.ConfigFilesPermissionDeniedError: Failed to open some config files: /etc/neutron/neutron.conf Apr 29 18:59:58 compute2 systemd[1]: neutron-openvswitch-agent.service: main process exited, code=exited, status=1/FAILURE Apr 29 18:59:58 compute2 systemd[1]: Unit neutron-openvswitch-agent.service entered failed state. Apr 29 18:59:58 compute2 systemd[1]: neutron-openvswitch-agent.service failed. |
同時,ovs-vsctl list-br,發現沒有初始的網橋br-int 和br-tun,重新安裝openvswitch
問題五:
出現如下錯誤:
ERROR oslo_messaging.rpc.dispatcher[req-aebb7256-1ff5-46ee-a7e4-675ffc12da38 0b9a1adea1484c6e811992526d07e9616f49fbf57719406dbe14996a7f1a7a2e - - -] Exception during message handling:[Errno 13] Permission denied:u'/var/lock/cinder/cinder-d44ed535-d4f0-4e0b-83d1-f2c211397b66' 2016-05-20 14:34:24.519 12949 ERRORoslo_messaging._drivers.common [req-aebb7256-1ff5-46ee-a7e4-675ffc12da380b9a1adea1484c6e811992526d07e961 6f49fbf57719406dbe14996a7f1a7a2e - - -]Returning exception [Errno 13] Permission denied:u'/var/lock/cinder/cinder-d44ed |
關鍵字:Permission denied
mkdir /var/lock/cinder
chmod 777/var/lock/cinder/
chown -R cinder:cinder /var/lock/cinder/
在安裝openstack啟動元件時,會出現很多因為配置檔案許可權問題導致元件啟動不了,檢視相關日誌,一般都可以看到是哪個日誌的許可權問題,修改即可。
相似的問題:
glance-api服務起不來
日誌顯示:
Loaded: loaded(/usr/lib/systemd/system/openstack-glance-api.service; enabled; vendor preset:disabled
解決辦法:
chown -R glance:glance /var/log/glance/api.log
執行nova-managedb sync出錯,檢視日誌,又是許可權問題:
解決方案:
chown -R nova:nova /var/log/nova/nova-manage.log
chown -R nova:nova /etc/nova/nova.conf
問題六:
You must providea username via either --os-username or env[OS_USERNAME]
source admin-openrc.sh 一下即可
admin-openrc.sh檔案內容:
#export OS_PROJECT_DOMAIN_ID=default #export OS_USER_DOMAIN_ID=default export OS_PROJECT_NAME=admin export OS_TENANT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=admin export OS_AUTH_URL=http://controller:35357/v2.0/ #export OS_IMAGE_API_VERSION=2 export OS_TOKEN=openstack export OS_URL=http://controller:35357/v2.0/ export OS_REGION_NAME=RegionOne |
注:然而筆者在進行下面元件的安裝時,會出現AUTH_URL版本錯亂的問題,後面元件的相關配置檔案(官方文件中),認證URL均是v2版,如果source這個檔案,會出現無法找到認證服務的錯誤。
問題七:
出現資訊:
The request you have made requires authentication. (HTTP401)ERROR: openstack The request you have made requires authentication. (HTTP401) (Request-ID: req-47b824f1-61af-448b-af62-47e96d98513f)
解決辦法:
unset
OS_TOKEN OS_URL
openstack --os-auth-url http://controller:35357 \
--os-project-name admin --os-username admin--os-auth-
type
password \
token issue