OpenStack版本升级之Nova

F版对依赖库的变化

F版Nova对依赖库的变化比较大,官网文档就提到了5点,另外还增加和去掉了一些依赖,详情如下:

[ugyn@localhost nova]$ git diff origin/stable/essex:tools/pip-requires origin/stable/folsom:tools/pip-requires
diff --git a/origin/stable/essex:tools/pip-requires b/origin/stable/folsom:tools/pip-requires
index 3359f64..d1a2bcf 100644
--- a/origin/stable/essex:tools/pip-requires
+++ b/origin/stable/folsom:tools/pip-requires
@@ -1,27 +1,23 @@
-SQLAlchemy>=0.7.3
+SQLAlchemy>=0.7.8,<=0.7.9
 Cheetah==2.4.4
 amqplib==0.6.1
 anyjson==0.2.4
 boto==2.1.1
-carrot==0.10.5
-eventlet
+eventlet>=0.9.17
 kombu==1.0.4
-lockfile==0.8
-lxml==2.3
-python-daemon==1.5.5
-python-gflags==1.3
-python-novaclient
+lxml>=2.3,<=2.3.5
 routes==1.12.3
 WebOb==1.0.8
-wsgiref==0.1.2
 greenlet>=0.3.1
 PasteDeploy==1.5.0
 paste
 sqlalchemy-migrate>=0.7.2
 netaddr
-glance>=2011.3.1
 suds==0.4
 paramiko
-feedparser
 Babel>=0.9.6
 iso8601>=0.1.4
+httplib2
+setuptools_git>=0.4
+python-quantumclient>=2.0
+python-glanceclient>=0.5.0,<2

备份配置文件及数据库

[root@stack1 update_nova]# cp -R /etc/nova ./nova-etc
[root@stack1 update_nova]# mysqldump -h10.61.2.12 -unova -p nova > nova.sql

下载相关升级软件

考虑到nova的升级涉及多个节点,所以最好把这些包都下载到本地然后写一个简单的脚本安装比较合适。用pip下载依赖包时容易出现timeout重新运行命令即可。

[root@stack1 update_nova]# pip install -d ./ --no-install SQLAlchemy eventlet httplib2 setuptools_git python-quantumclient python-glanceclient
[root@stack1 update_nova]# ll *gz *zip
-rw-r--r-- 1 root root   69297 Nov 19 16:11 argparse-1.2.1.tar.gz
-rw-r--r-- 1 root root  123636 Nov 19 16:10 cliff-1.3.tar.gz
-rw-r--r-- 1 root root   21147 Nov 19 16:20 cmd2-0.6.4.tar.gz
-rw-r--r-- 1 root root  638335 Nov 19 16:18 distribute-0.6.30.tar.gz
-rw-r--r-- 1 root root  262991 Nov 19 16:04 eventlet-0.9.17.tar.gz
-rw-r--r-- 1 root root   72790 Nov 19 16:10 greenlet-0.4.0.zip
-rw-r--r-- 1 root root  116500 Nov 19 16:04 httplib2-0.7.7.zip
-rw-r--r-- 1 root root    9621 Nov 19 16:20 jsonschema-0.2.zip
-rw-r--r-- 1 root root   22779 Nov 19 16:11 prettytable-0.6.1.zip
-rw-r--r-- 1 root root 1418892 Nov 19 16:17 pyparsing-1.5.6.tar.gz
-rw-r--r-- 1 root root   64924 Nov 19 16:09 python-glanceclient-0.5.1.tar.gz
-rw-r--r-- 1 root root   57538 Nov 19 16:17 python-keystoneclient-0.1.3.tar.gz
-rw-r--r-- 1 root root   43397 Nov 19 16:05 python-quantumclient-2.1.tar.gz
-rw-r--r-- 1 root root    3646 Nov 19 16:04 setuptools-git-0.4.2.tar.gz
-rw-r--r-- 1 root root   53228 Nov 19 16:12 simplejson-2.6.2.tar.gz
-rw-r--r-- 1 root root 2649932 Nov 19 16:03 SQLAlchemy-0.7.9.tar.gz
-rw-r--r-- 1 root root    6717 Nov 19 16:18 warlock-0.5.0.tar.gz
[root@stack1 update_nova]# git clone git://github.com/openstack/nova.git
[root@stack1 update_nova]# cd nova
[root@stack1 nova]# git checkout -b folsom origin/stable/folsom

配置Nova

将F的配置文件拷入到你的升级目录下(如update_nova)并修改nova.conf和api-paste.ini,注意,我这里用eth1作为public_interface,如果只有一个网卡的话public_interface设为br100即可,另外,我这里使用ccip代表控制节点ip,nodeip代表本地节点ip便于后面运行升级脚本:

[root@stack1 nova]# cp -R etc/nova ../etc
[root@stack1 nova]# cd ..
[root@stack1 update_nova]# cat etc/nova.conf
[DEFAULT]
# LOGS/STATE
#verbose=True
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova

# ROOTWRAP
rootwrap_config=/etc/nova/rootwrap.conf

# AUTHENTICATION
auth_strategy=keystone

# SCHEDULER
compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler

# VOLUMES
volume_group=nova-volumes
#volume_name_template=volume-%08x
iscsi_helper=tgtadm

# DATABASE
sql_connection=mysql://nova:nova@ccip/nova

# COMPUTE
libvirt_type=kvm
compute_driver=libvirt.LibvirtDriver
instances_path=/var/lib/nova/instances
instance_name_template=instance-%08x
api_paste_config=/etc/nova/api-paste.ini
allow_resize_to_same_host=True
#resume_guests_state_on_host_boot=True
#start_guests_on_host_boot=True

# APIS
osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions
cc_host=ccip
metadata_host=ccip
metadata_listen=0.0.0.0
ec2_host=ccip
ec2_dmz_host=ccip
ec2_url=http://ccip:8773/services/Cloud
keystone_ec2_url = http://ccip:5000/v2.0/ec2tokens
nova_url=http://ccip:8774/v1.1/
s3_host=ccip
s3_dmz=ccip

# RABBITMQ
# rabbit_host=ccip
# rabbit_userid=guest
# rabbit_password=service123

# QPID
rpc_backend=nova.rpc.impl_qpid
qpid_hostname=ccip

# GLANCE
image_service=nova.image.glance.GlanceImageService
glance_host=ccip
glance_api_servers=ccip:9292

# NETWORK
network_manager=nova.network.manager.FlatDHCPManager
force_dhcp_release=True
dhcp_release_time=1200
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
auto_assign_floating_ip=True
routing_source_ip=ccip
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
my_ip=nodeip
public_interface=eth1
vlan_interface=eth0
flat_network_bridge=br100
flat_interface=eth0
fixed_range=10.0.0.0/24

# NOVNC CONSOLE
novncproxy_base_url=http://ccip:6080/vnc_auto.html
xvpvncproxy_base_url=http://ccip:6081/console
vncserver_proxyclient_address=nodeip
vncserver_listen=0.0.0.0
[root@stack1 update_nova]# tail -n 9 etc/api-paste.ini
[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
auth_host = ccip
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = service123
signing_dirname = /tmp/keystone-signing-nova

创建升级脚本

[root@stack1 update_nova]# cat install.sh
#!/usr/bin/env bash

TOP_DIR=$(cd $(dirname "$0") && pwd)
nodeip=${1:-null}
ccip=${2:-10.61.2.12}

if [[ "$nodeip" == "null" ]]; then
    echo "Usage: `basename $0` nodeip [ccip]"
    exit 1
fi

pip install --upgrade  simplejson-2.6.2.tar.gz prettytable-0.6.1.zip argparse-1.2.1.tar.gz httplib2-0.7.7.zip
pip install jsonschema-0.2.zip pyparsing-1.5.6.tar.gz
pip install cmd2-0.6.4.tar.gz distribute-0.6.30.tar.gz warlock-0.5.0.tar.gz python-keystoneclient-0.1.3.tar.gz cliff-1.3.tar.gz greenlet-0.4.0.zip
pip install python-glanceclient-0.5.1.tar.gz python-quantumclient-2.1.tar.gz setuptools-git-0.4.2.tar.gz eventlet-0.9.17.tar.gz SQLAlchemy-0.7.9.tar.gz

file=$(find /usr/lib -name "subprocess.py")
sed -i 's/0.01)/0.01, timeout=None)/' $file

if [[ -f /etc/tgt/targets.conf ]] && ! grep -q 'volumes' /etc/tgt/targets.conf
then
    sed -i 's;\(#include.*\);\1\ninclude /var/lib/nova/volumes/\*;' /etc/tgt/targets.conf
fi

cd nova/
python setup.py install > $TOP_DIR/../install.info
cd ..

rm -fr /etc/nova/*
cp -R etc/* /etc/nova/
sed -i -e "s/ccip/$ccip/g" -e "s/nodeip/$nodeip/g" /etc/nova/nova.conf /etc/nova/api-paste.ini

升级各节点

使用如下命令将文件传输到各节点,停止节点的nova服务,然后运行升级脚本升级nova。全部升级完成后用命令nova-manage db sync同步数据库,然后就可以启动各服务了。

[root@stack1 update_nova]# cd ..
[root@stack1 ~]# rsync -az --exclude=update_nova/.git update_nova [email protected]:/root/
[root@stack1 ~]# ssh [email protected]
[root@stack5 ~]# cd update_nova/
[root@stack5 update_nova]# service nova-compute stop
[root@stack5 update_nova]# ./install.sh 10.61.2.5

注意事项

建议仔细阅读Nova的Upgrade Notes
1.nova-volume到cinder的迁移,这个打算全部升级完成后再搞
2.配置targets.conf,见上面的升级脚本
3.rootwrap的配置,由于我是用root运行nova的(尝试过用nova用户运行,但是在libvirt这一个的权限没搞好,后面就没弄了),只简单的设置了rootwrap_config来代替原来的root_helper
4.nova.conf中用compute_driver=libvirt.LibvirtDriver代替了connection_type=libvirt
5.flavors的变化。。。

升级时遇到的一些问题

1.同步数据库失败,报:CRITICAL nova [-] /usr/lib/python2.6/site-packages/nova-2012.2.1-py2.6.egg/nova/db/sqlalchemy/migrate_repo
我刚开始打算用命令wget https://github.com/openstack/nova/archive/stable/folsom.zip从github直接获取源码安装,可是这样获取的源码缺少文件,导致上述问题。解决办法:使用git clone git://github.com/openstack/nova.git获取源码
2.启动nova-network、nova-compute时报:CRITICAL nova [-] wait() got an unexpected keyword argument 'timeout'
这是老问题了,在E版就有,因为升级了eventlet的原故把原来的修改覆盖了(详情),解决办法见上面的脚本。
3.启动nova-volume报: CRITICAL nova [-] %x format: a number is required, not unicode
这是由于沿用了E版中的一些配置造成的,注释掉volume_name_template=volume-%08x即可。

北方工业大学 | 云计算研究中心 | 姜永

你可能感兴趣的:(OpenStack版本升级之Nova)