您的位置:首页 > 运维架构

OPENSTACK常见问题及注意事项汇总

2016-06-24 21:06 375 查看
OPENSTACK常见问题及注意事项汇总

QU: [Errno 2] No suchfile or directory: '/var/lib/nova/instances/1cb4f7b3-de96
-42ff-a395-26d97c26dc53/disk

RE:这种情况一般是错误操作导致虚拟机删除不完全引起的:

virsh list --all ##此处1cb4f7b3-de96-42ff-a395-26d97c26dc53对应instance-00000001##
virsh undefine instance-00000001 ##删除错误的虚拟机

QU: Cinder-scheduler报错:Failed toschedule_create_volume: No valid host was found.

RE:这一般是在配置Cinder的多存储后端时,后端名和类型对应错误引起的,后端名由配置文件指定,俩者一定要对应,不然驱动启动不起来,
# cinder type-createGLUSTERFS_cinder_volume1 // 创建类型;
# cinder type-createGLUSTERFS_cinder_volume2

# cinder type-keyglusterfs_cinder_volume1 set // 创建对应关系 volume_backend_name=glusterfs_cinder_volume1
# cinder type-keyglusterfs_cinder_volume2 set volume_backend_name=glusterfs_cinder_volume2

# cinder extra-specs-list
+--------------------------------------+--------------------------+-------------------------------------------------------+
| ID |Name | extra_specs |
+--------------------------------------+--------------------------+-------------------------------------------------------+
|50b7f795-29c0-4fe8-8ca3-cf66e2f34886 | glusterfs_cinder_volume1 |{u'volume_backend_name': u'glusterfs_cinder_volume1'} |
|cea39f0e-cb83-4c13-b712-ae29551da19f | glusterfs_cinder_volume2 |{u'volume_backend_name': u'glusterfs_cinder_volume2'} |
+--------------------------------------+--------------------------+-------------------------------------------------------+

QU: 虚拟机启动时,获取不到元数据,日志显示连接不上169.254.169.254,没有这个主机:

RE:[Havana]虚拟机要正确连接元数据服务,需要在计算节点执行以下命令:
iptables -t nat -APREROUTING -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT--to-destination $NOVA_API_IP:8775
然后:重启相应的计算节点(必须)
(该规则重启不保存,需要保存的话应该使用“iptables-save> 文件” 进行保存,用 iptables-apply 进行规则文件的重新添加

QU: Could not open disk image/var/lib/nova/mnt/45ee3d2256f5770856db5600
c80cbb59/volume-96185621-0f37-4690-a272-2e429aa3afdf:Invalid argument

RE: 1、如果使用glusterfs的话,这一般是由于fuse不支持虚拟机以“cache=none”的缓存模式直接启动glusterfs中的虚拟机镜像和卷:
openstack默认虚拟机和卷缓存模式的修改:
镜像缓存修改:/usr/lib/python2.7/dist-package/nova/virt/libvirt/driver.py (Line 380) 'cache_model' 默认为 writethough,改为一般使用writeback的缓存模式
卷缓存修改 :/usr/lib/python2.7/dist-package/nova/virt/libvirt/volume.py (Line 105) 'cache_model' 默认为 none,改为一般使用writeback的缓存模式。
默认glusterfs卷的挂载路径也可以在volume.py中进行修改(当使用glusterfs作为镜像和卷存储时,启动虚拟机前要先行挂载);
2、如果没有使用glusterfs的话,那么一般是镜像格式错误,用qemu-img info 检查镜像和xml配置文件中指定的type是否一致。

QU: 采用Neutron的GRE模式,默认配置下,VM出网的性能极其低下
RE:BUG列表: https://bugs.launchpad.net/neutron/+bug/1252900
QU:2013-12-0519:13:11.732 2625 WARNING keystone.common.controller [-] RBAC:Invalid token
2013-12-05 19:13:11.732 2625 WARNINGkeystone.common.wsgi [-]Authorization failed. The request youhave made requires
authentication. from 192.168.1.165

RE:这一般是Token数据过期问题,keystone把Token数据存放在数据库token表中,在使用过程中不会删除过期的Token数据,导致Token数据量异常。
可参考:https://bugs.launchpad.net/ubuntu/+source/keystone/+bug/1032633 http://www.sebastien-han.fr/blog/2012/12/12/cleanup-keystone-tokens/
QU: 启动nova-compute报错
\** (process:11739): WARNING **: Error connecting to bus:org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket/var/run/dbus/system_bus_socket:No
such file or directory

process 11739: arguments to dbus_connection_get_data() were incorrect,assertion "connection != NULL" failed in file dbus-connection.c
line5804

RE:重启messagebus服务
[root@compute1 ~]# /etc/init.d/messagebus start
Starting system message bus: [ OK ]

QU: 启动ovs-agent出错
"/usr/lib/python2.6/site-packages/neutron/agent/linux/utils.py",line 62, in execute
2014-01-26 00:58:07.074 29610 TRACE neutron raiseRuntimeError(m)
2014-01-26 00:58:07.074 29610 TRACE neutronRuntimeError:
2014-01-26 00:58:07.074 29610 TRACE neutron Command: ['ip', '-o','link', 'show', 'br-int']
2014-01-26 00:58:07.074 29610 TRACE neutron Exit code: 255
2014-01-26 00:58:07.074 29610 TRACE neutron Stdout: ''
2014-01-26 00:58:07.074 29610 TRACE neutron Stderr: 'Device"br-int" does not exist.\n'
2014-01-26 00:58:07.074 29610 TRACE neutron

RE:这是因为缺少内部br-int网桥,只要增加br-int就可以了
[root@controller1 neutron]# ovs-vsctl add-br br-int
[root@controller1 neutron]# ovs-vsctl show
acb40cab-1fa0-48a0-a48c-56c89e1acfcd
Bridge br-int
Port br-int
Interface br-int
type: internal
ovs_version:"1.10.2"
[root@controller1 neutron]# ip -o link show br-int
5: br-int: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue stateUNKNOWN \ link/ether 3e:d6:38:4e:28:43brd ff:ff:ff:ff:ff:ff

QU: qemu-kvm: failed toinitialize spice server
spice配置问题,nova-compute节点的listen参数有问题!
RE:# SPICE # server_listen=0.0.0.0

QU: qemu-kvm error
2014-03-13 18:01:11.312 12413 WARNING nova.virt.disk.api[req-4cb3d0ef-d70b-4383-a122-c070a62f757f 6965226966304bd5a3ae07587d5ef958d2390e6dd4ce4b48866be0d3d1417c01]
Ignoring error injecting data into image(Error mounting /share/instances/be363098-6749-42ea-84e0-824fdb1c8e59/disk withlibguestfs (command failed: LC_ALL=C '/usr/libexec/qemu-kvm' -nographic -help
errno: File exists
RE:[root@controller1 ~]# ln -s /usr/bin/qemu-kvm /usr/libexec/qemu-kvm
[root@controller1 ~]# ls -l /usr/libexec/qemu-kvm
lrwxrwxrwx 1 root root 17 Mar 27 17:15 /usr/libexec/qemu-kvm ->/usr/bin/qemu-kvm

QU: windows镜像注入问题
[root@compute2 /data/nova/instances/0071e60b-a0b6-41fa-b484-ede5448d87b9]#guestmount-a disk -i --ro /mnt/
guestmount: no operating system was found on this disk
未安装libguestfs-winsupport,需要安装libguestfs-winsupport。
RE:[root@compute2 /root] yum install libguestfs-winsupport

QU: havana 2013.2.1 BUG
UnboundLocalError: local variable ‘instance_dir’ when live migration

RE:修改对应代码,在函数头加入instance_dir全局变量:nova/virt/libvirt/driver.py
def pre_live_migration(self, context, instance,block_device_info,((Havana 2013.2.1))
#这个函数内增加instance_dir变量!
instance_dir = None

QU: UnboundLocalError:local variable ‘network_name’ in nova/virt/network/neutr
onv2/api.py,line 964

RE:修改对应代码,在函数头加入network_name全局变量:
def _nw_info_build_network(self, port,networks, subnets):
network_name = None(加入这个环境变量)

QU: 快照无法显示在dashboard上

RE:修改代码/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py
大概在1307行处
metadata = {'is_public': False, 这里的False改为True

QU: Libvirt error summaryFailed to start domain错误
[root@node1 ~]# virsh start vm01
error: Failed to start domain vm01
error: internal error process exitedwhile
connecting to monitor: Could not access KVM kernel module: Nosuch file or directory
failed to initialize KVM: No such file or directory
No accelerator found!
RE:上面的提示信息就是因为QEMU在初始化阶段因为无法找到kvm内核模块,确保内核支持KVM模块,硬件打开CPU VT技术。
[root@node1 ~]# modprobe kvm #载入kvm模块
重启电脑,进入bios界面,设置advance(cpu)选项里面的virtualization标签为Enabled
[root@node1 ~]# lsmod |grepkvm #显示已载入的模块
kvm_intel 54394 3
kvm 317536 1 kvm_intel

虚拟机迁移错误
QU:[root@node1 ~]# v# virsh migrate --live 1 qemu+tcp://192.168.0.121 --p2p --tunnelled--unsafe

error: operation failed: Failed to connect to remote libvirt URIqemu+tcp://192.168.0.121(在URI后面加上/system,‘system’相当于root用户的访问权限)

RE:在URI后面加上/system,‘system’相当于root用户的访问权限。

QU:[root@node1 ~]# virsh migrate --live 2qemu+tcp://node2/system --p2p --tunnelled
error: Unsafe migration: Migration may lead to data corruption if disks use cache != none
RE:加上–unsafe参数进行迁移。

QU:[root@node1 ~]# virsh migrate --live 2 qemu+tcp://192.168.0.121/system--p2p --tunnelled --unsafe
error: Timed out during operation: cannot acquire state change lock
RE:启动虚拟机有时也会遇此错误,需要重启libvirtd 进程,service libvirt-bin restart。

QU:$ virsh -c qemu:///systemlist

error: Failed to connect socket to'/var/run/libvirt/libvirt-sock': Permission denied

error: failed to connect to the hypervisor

RE:当前用户没有权限,修改/etc/libvirt/libvirtd.conf,unix_sock_rw_perms= 0777,使所有用户都有权限读写;

QU:#virsh

error: Failed to connect socket to'/var/run/libvirt/libvirt-sock': Connection refused

RE:(libvirtd 进程没有启动,libvirtd是一个监听客户端请求的进程,service libvirt-bin start)

QU:[root@node1 ~]# virsh migrate 5 --liveqemu+tcp://node2/system
error: Unable to read from monitor: Connection reset by peer
RE:OpenStack nova.confvncserver_listen的配置是否正确。

QU:virsh start vm-0000000a1

error: Failed to start domain vm-0000000a1

error: Unable to read from monitor: Connectionreset by peer

还有可能是这样提示:

error: internal error process exited whileconnecting to monitor: Failed to allocate 16332619776 B: Cannot allocate memory

RE:这个问题可能是因为为VM分配的内存过大(甚至超过的物理主机的内存大小)

QU:error: internal error Attempt to migrate guest tothe same host 00020003-0004-0005-0006-000700080009
RE:查看两个节点的system-uuid是否一样,如果一样需要修改libvirt的配置文件。可以通过如下的命令查看:
[root@controller1 ~]# dmidecode -s system-uuid
63897446-817B-0010-B604-089E01B33744
查看/etc/libvirt/libvirtd.conf 中的host_uuid发现该行被注释,将该注释去掉,并需要对host_uuid的值进行修改!
在两台机器上分别用 cat /proc/sys/kernel/random/uuid的值来替换原来host_uuid的值!

QU: ssh-agent无法自启动
CentOS中ssh-agent无法自动启动,可以通过在/etc/profile.d/ssh-agent.sh,启动脚本的方式启动agent。
RE:[root@test~]# vim /etc/profile.d/ssh-agent.sh
#!/bin/sh
if [ -f ~/.agent.env ]; then
. ~/.agent.env >/dev/null
if ! kill -0 $SSH_AGENT_PID >/dev/null2>&1; then
echo “Stale agent file found.Spawning new agent…”
eval `ssh-agent |tee ~/.agent.env`
ssh-add
fi
else
echo “Starting ssh-agent…”
eval `ssh-agent |tee ~/.agent.env`
ssh-add
fi

QU: nova-manage servicelist出现多余的主机名,服务状态为XXX,如果删除
RE:通过清除nova数据库中的services表的binary字段对应的记录,(注意有外键约束,需要把services表和compute_nodes表的deleted字段都改为1)。

QU: 控制台显示:noVNC ready: nativeWebSockets, canvas renderin...
问题描述:[OpenStack Grizzly]openstack安装完成后,从dashboard里进入instance的控制台时,控制台里没有什么内容只是黑色的窗口,也不能点击那个
重启按钮,窗口上方显示:noVNC ready: native WebSockets, canvas rendering,如图:
RE:把/usr/share/novnc/include/rfb.js里的nova_token = token; 注释掉,OK

QU:[OpenStack Grizzly]在openstack里启动openvswitch-switch服务service openvswitch-switch
start的时候可能会出现ovs-brcompatdis not running的错误,
RE:解决方法如下:

apt-get installopenvswitch-controller openvswitch-brcompat openvswitch-switch
apt-get install -yopenvswitch-datapath-source
apt-get installmodule-assistant
module-assistantauto-install openvswitch-datapath

在这个过程中可能还会出现如下错误:
Bad luck, the kernel headers for thetarget kernel version could not be found and you did not specify othervalid kernel headers
to use...
这是头文件的问题, the kernelgeneric headers is missing the version.h file.
解决方法如下:ln -s/usr/src/linux-headers-`uname -r`/include/generated/uapi/linux/version.h/lib/modules/`uname -r`/build/include/linux/
编辑/etc/default/openvswitch-switch

BRCOMPAT=yes

在这过后如果还是启动不了就强制加载:
先移除网桥模块:rmmod bridge

/etc/init.d/openvswitch-switchforce-reload-kmod
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  openstack