OpenStack应用、报错
镜像制作
OpenStack镜像文档:https://docs.openstack.org/image-guide/index.html
官方制作好的镜像:https://docs.openstack.org/image-guide/obtain-images.html
Win镜像制作
在自己的本地环境中制作的镜像,时常遇到硬盘空间大小的问题,或者制作的镜像磁盘大小是80G,但是到了openstack上会分配100G的情况。这里要用到根次磁盘自动扩容的软件:cloudbaseinit
https://docs.openstack.org/image-guide/windows-image.html
Linux镜像制作
CentOS
https://docs.openstack.org/image-guide/centos-image.html
Ubuntu
https://docs.openstack.org/image-guide/ubuntu-image.html
官方镜像、密码
http://www.chenshake.com/openstack-official-mirrors-and-password/
自动扩展(Auto-scaling)
https://www.cnblogs.com/sammyliu/p/5181992.html
Open vSwitch
https://www.linuxidc.com/Linux/2015-10/123787.htm
嵌套虚拟化的配置
该设置使创建的实例可最大程度的使用物理CPU的指令集,因此可以实现二次虚拟化。
cat /sys/module/kvm_intel/parameters/nested
Y
如果上面的显示结果不是 Y 的话需要开启 nested:
modinfo kvm_intel | grep nested #查看是否加载模块
modprobe -r kvm-intel
modprobe kvm-intel nested=1
参考:https://www.cnblogs.com/myiaas/p/4161308.html
报错(以下还没测试)
openstack-nova-metadata-api服务起不来,无法SSH
自己解决了无法SSH的问题,为啥会出现这个问题暂时还没搞的很清楚,但是修改了两个地方就可以SSH了。
1)将compute节点中nova.conf的libvirt_type从qemu改为kvm
2)制作镜像时修改/boot/grub/grub.conf然后在kernel的quiet后面加上enforcing=0
然后就可以了SSH了。
撒下花,卡在这儿很久了,终于搞定了。
Nova无法Attach Cinder Volume, Caught error: 'volume'
http://bbs.csdn.net/topics/390375483
InternalError: Nova requires QEMU version 2.1.0 or greater.
看日志:tail -f /var/log/nova/nova-compute.log
解决办法是升级qemu,参考:http://blog.sina.com.cn/s/blog_8ea8e9d50102xpgc.html
注意,我是在原有KVM的基础上升级,原有qemu是yum安装的,可能你的位置不同。
yum -y install gcc gcc-c++ automake libtool bzip2-devel libuuid-devel spice-protocol spice-server-devel usbredir-devel bison flex libaio-devel libcap-devel libiscsi-devel
可选yum -y install git glib2-devel libfdt-devel pixman-devel zlib-devel
wget https://download.qemu.org/qemu-2.10.1.tar.xz
tar xvJf qemu-2.10.1.tar.xz
cd qemu-2.10.1
./configure --enable-usb-redir --enable-libusb --enable-spice --enable-kvm --enable-bzip2 --prefix=/opt/qemu --enable-linux-aio --enable-system --target-list=x86_64-softmmu,x86_64-linux-user
make -j4 && make install
备份原始qemu
mv -f /usr/libexec/qemu-kvm{,.bak}
mv -f /usr/bin/qemu-system-x86_64{,.bak}
mv -f /usr/bin/qemu-img{,.bak}
mv -f /usr/bin/qemu-io{,.bak}
mv -f /usr/bin/qemu-nbd{,.bak}
mv -f /usr/bin/qemu-ga{,.bak}
3.建软链
ln -s /opt/qemu/bin/qemu-system-x86_64 /usr/libexec/qemu-kvm
ln -s /opt/qemu/bin/qemu-system-x86_64 /usr/bin/
ln -s /opt/qemu/bin/qemu-ga /usr/bin/
ln -s /opt/qemu/bin/qemu-img /usr/bin/
ln -s /opt/qemu/bin/qemu-io /usr/bin/
ln -s /opt/qemu/bin/qemu-nbd /usr/bin/
重启nova-compute,libvirtd
systemctl restart libvirtd.service openstack-nova-compute.service
检查
qemu-img --version
qemu-kvm -version
Error: Host 'XXXX' is not mapped to any cell
严格按照安装文档安装后,确保计算节点都连接上了。在控制端执行下面命令
nova-manage cell_v2 discover_hosts
参考:https://ask.openstack.org/en/question/104029/how-can-i-solve-this-issue-when-i-create-instance/
https://ask.openstack.org/en/question/102256/how-to-configure-placement-service-for-compute-node-on-ocata/
修改节点主机名
因为开始没注意到主机名不能有下划线,于是修改主机名:hostnamectl set-hostname XXXX
然后重新登录终端,可以看到主机名已经变了,再修改:hostname和hosts文件中的主机名也要为新的。
然后登录控制节点,删除节点
openstack compute service list
openstack compute service delete [ID]
重启节点(刚修改主机名的节点)上的服务:systemctl restart openstack-nova-compute.service neutron-linuxbridge-agent.service
再次在控制节点,上执行:openstack compute service list
就发现已经更新了。
nova-console服务无法启动
/var/log/nova/nova-console.log报错:
2017-11-16 18:39:59.519 29358 ERROR nova.servicegroup.drivers.db DBConnectionError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'controller' ([Errno 111] ECONNREFUSED)") [SQL: u'SELECT 1']
2017-11-16 18:39:59.519 29358 ERROR nova.servicegroup.drivers.db
2017-11-16 18:39:59.853 29358 ERROR oslo.messaging._drivers.impl_rabbit [-] [3047ae81-c127-40c6-a578-556be379fd30] AMQP server on controller:5672 is unreachable: [Errno 111] ECONNREFUSED. Trying again in 6 seconds. Client port: None: error: [Errno 111] ECONNREFUSED
解决:
cd /etc/nova/
chown nova:nova nova.conf
systemctl restart openstack-nova-console.service openstack-nova-consoleauth.service
# 再次检查就OK了。
nova service-list
No valid host was found. There are not enough hosts available.
如果你发现CPU,内存,硬盘都是有的,都还是报这个错;一般出现在已运行多个虚拟机的KVM机子上,默认是一个CPU一台虚拟机,所以才会不够用。
# 计算节点上操作
vim /etc/nova/nova.conf
# CPU倍数
cpu_allocation_ratio=4.0
systemctl restart libvirtd.service openstack-nova-compute.service neutron-linuxbridge-agent.service
# 控制节点上操作
systemctl restart openstack-nova-os-compute-api.service openstack-nova-console.service openstack-nova-api.service openstack-nova-conductor.service
Windows虚拟机时间同步
#标记镜像为windows,通过qemu-ga与虚拟机进行数据交互
glance image-update --property os_type="windows" <IMAGE-ID>
openstack创建云主机时界面报错:
No valid host was found. There are not enough hosts available.
Filter DiskFilter returned 0 hosts
解决办法:
设置comtroller nov-config-file
增加:scheduler_default_filters=AllHostsFilter