参考 军卫的 http://blog.chinaunix.net/uid-20940095-id-4061153.html 里的配置文件,
以及 陈沙克的 http://www.chenshake.com/devstack-installation-and-testing/ 这篇博文,
还有官方文档http://devstack.org/guides/single-machine.html
Devstack 使得我们能够一键部署 Openstack,核心是配置文件 localrc (新版的用一个local.conf来配置,不过用localrc也是可以的)。
首先下载稳定版本的 devstack
sudo apt-get install git -y || yum install -y git
cd /home
git clone -b stable/icehouse https://github.com/openstack-dev/devstack.git
新版的devstack不允许用root用户启动,因此新建一个stack用户
切换devstack目录用户,进入目录 (注意,后面的操作都应该下stack用户下进行)
cd /home/devstack/tools/
./create-stack-user.sh
chown -R stack:stack /home/devstack
cd /home/devstack
su stack
进到目录后发现 并没有localrc文件,只有一个stackrc文件,
打开stackrc文件大概看一下,发现stackrc回去尝试打开localrc文件,如果localrc文件有用户配置的选项,则用用户配置覆盖掉stackrc里的默认配置,
因此,不知道localrc中的配置项是什么意思的时候,可以在stackrc里搜索一下,看一下说明。
localrc的配置主要参考了军为的博文,另外因为我的电脑之前手动配过Openstack,因此必须停掉所有openstack服务,数据库的root密码要先清空(方法自己百度)
要把/etc/下的所有openstack项目文件夹删掉,例如/etc/nova等等,不然会出错。我在配Openstack的时候,创建了cinder-volumes,因此在localrc中,
用 cinder-volumes替代了stack-volumes.
配置文件如下:
- # Misc
- HOST_IP = xxx.xxx.xxx.xxx
-
- DATABASE_PASSWORD=123456
- ADMIN_PASSWORD=123456
- SERVICE_PASSWORD=123456
- SERVICE_TOKEN=123456
- RABBIT_PASSWORD=123456
-
- # Reclone each time
- RECLONE=true
-
- # Python enviroments
- #OFFLINE=true
-
- ## For Keystone
- KEYSTONE_TOKEN_FORMAT=PKI
-
- ## For Swift
- #SWIFT_REPLICAS=1
- #SWIFT_HASH=011688b44136573e209e
-
- # Enable Logging
- LOGFILE=/opt/stack/logs/stack.sh.log
- VERBOSE=True
- LOG_COLOR=True
- SCREEN_LOGDIR=/opt/stack/logs
-
- # Pre-requisite
- ENABLED_SERVICES=rabbit,mysql,key
-
- ## If you want ZeroMQ instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre-requesite)
- #ENABLED_SERVICES+=,-rabbit,-qpid,zeromq
-
- ## If you want Qpid instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre-requesite)
- #ENABLED_SERVICES+=,-rabbit,-zeromq,qpid
-
- # Horizon (Dashboard UI) - (always use the trunk)
- ENABLED_SERVICES+=,horizon
- #HORIZON_REPO=https://github.com/openstack/horizon
- #HORIZON_BRANCH=master
-
- # Nova - Compute Service
- ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-novnc,n-cauth
- IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
-
- ## Nova Cells
- ENABLED_SERVICES+=,n-cell
-
- # Glance - Image Service
- ENABLED_SERVICES+=,g-api,g-reg
-
- # Swift - Object Storage
- #ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
-
- # Neutron - Networking Service
- # If Neutron is not declared the old good nova-network will be used
- ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron
-
- ## Neutron - Load Balancing
- ENABLED_SERVICES+=,q-lbaas
-
- ## Neutron - VPN as a Service
- ENABLED_SERVICES+=,q-vpn
-
- ## Neutron - Firewall as a Service
- ENABLED_SERVICES+=,q-fwaas
-
- # VLAN configuration - LinuxBridge + VLAN模式
- Q_PLUGIN=linuxbridge
- ENABLE_TENANT_VLANS=True
- TENANT_VLAN_RANGE=1920:1930
- PHYSICAL_NETWORK=default
- LB_PHYSICAL_INTERFACE=eth0
# VLAN configuration - Open VSwitch + VLAN模式 (这种配置我试了下,创建虚拟机的时候会报一个vif-create的错误,解决不了。。暂时就不用了)
#ENABLE_TENANT_VLANS=True
#TENANT_VLAN_RANGE=1920:1930
# PHYSICAL_NETWORK=default
#OVS_PHYSICAL_INTERFACE=eth0
- # GRE tunnel configuration
- #Q_PLUGIN=ml2
- #ENABLE_TENANT_TUNNELS=True
-
- # VXLAN tunnel configuration
- #Q_PLUGIN=ml2
- #Q_ML2_TENANT_NETWORK_TYPE=vxlan
-
- # Cinder - Block Device Service
-
- VOLUME_GROUP="cinder-volumes"
- ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch
-
- # Heat - Orchestration Service
- ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
- #IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2"
-
- # Ceilometer - Metering Service (metering + alarming)
- CEILOMETER_BACKEND=mysql
- ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api
- ENABLED_SERVICES+=,ceilometer-alarm-notify,ceilometer-alarm-eval
-
- # Apache fronted for WSGI
- APACHE_ENABLED_SERVICES+=keystone,swift
./stack.sh
pip uninstall kombu
pip install 'kombu>2.4,<3.0'
百度了下,发现军卫的博客上也有写这个错误的解决方法 http://blog.csdn.net/ustc_dylan/article/details/24603743
解决方法: 修改nova.conf配置文件,将如下两个配置项改为
- vif_plugging_timeout = 10
- vif_plugging_is_fatal = False
但我试了下,发现还是不行,
仔细检查了下,通过 ps aux|grep nova 看到nova-compute用的配置文件不是nova.conf,而是nova-cells.conf,
修改 /etc/nova/nova-cells.conf中的vif选项,这次创建实例成功了。
但是在网页上通过vnc访问虚拟机还是不行(在服务器上用浏览器访问是可以的)
猜测是iptables的问题,于是打开了5900:6000端口,
发现还是不行,看了下nova.conf和nova-cells.conf里的vnc配置,
发现vnc是要走6080端口绕一下的,于是在iptables中把6080端口打开,
重启iptables,终于可以远程接入虚拟机了!
to be continue..