OpenStack安装(四)--Nova

作者:CasonChan     分类:云技术     时间:2014-06-06     浏览:47     评论:0 来源:博客园

Nova是OpenStack的计算控制器,虚拟机实例(instances)生命周期的所有活动都是由Nova处理,这样使得Nova成为一个负责管理计算资源、网络、认证、所需可扩展性的平台。但是,Nova自身并没有提供任何虚拟化能力,相反它使用libvirt API来与被支持的Hypervisors交互。Nova 通过一个与Amazon Web Services(AWS)EC2 API兼容的web services API来对外提供服务。

功能和特点:

  • 实例生命周期管理
  • 管理计算资源
  • 网络和认证管理
  • REST风格的API
  • 异步的一致性通信
  • Hypervisor透明:支持Xen,XenServer/XCP, KVM, UML, VMware vSphere and Hyper-V

下面记录下Nova组件的整个安装过程:

1、下载源码并切换到 havana 分支:

(openstack)[root@casonchan openstack]# git clone git://git.openstack.org/openstack/nova nova
(openstack)[root@casonchan openstack]# cd nova/
(openstack)[root@casonchan nova]# git checkout -b stable/havana remotes/origin/stable/havana
Branch stable/havana set up to track remote branch stable/havana from origin.
Switched to a new branch 'stable/havana'
(openstack)[root@casonchan nova]#

2、安装Nova依赖(自动下载安装python-cinderclient 、python-neutronclient ):

(openstack)[root@casonchan nova]# pip install -r requirements.txt

3、编译安装Nova:

(openstack)[root@casonchan nova]# python setup.py install

4、下载python-novaclient源码并编译安装:

(openstack)[root@casonchan novaclient]# git clone git://git.openstack.org/openstack/python-novaclient  novaclient
(openstack)[root@casonchan novaclient]# cd novaclient/
(openstack)[root@casonchan novaclient]# pip install -r requirements.txt
(openstack)[root@casonchan novaclient]# python setup.py install

5、建立配置文件目录和日志文件目录,并拷贝配置文件到配置文件目录:

(openstack)[root@casonchan nova]# mkdir /etc/nova
(openstack)[root@casonchan nova]# mkdir /var/log/nova
(openstack)[root@casonchan nova]# mkdir -p /var/lib/nova/instances
(openstack)[root@casonchan nova]# cp -r etc/nova/* /etc/nova/
(openstack)[root@casonchan nova]# cd /etc/nova/
(openstack)[root@casonchan nova]# mv nova.conf.sample nova.conf
(openstack)[root@casonchan nova]# mv release.sample release
(openstack)[root@casonchan nova]# ll
total 124
-rw-r--r--. 1 root root  3861 Feb 24 23:02 api-paste.ini
-rw-r--r--. 1 root root   726 Feb 24 23:02 cells.json
-rw-r--r--. 1 root root  1346 Feb 24 23:02 logging_sample.conf
-rw-r--r--. 1 root root 85637 Feb 24 23:02 nova.conf
-rw-r--r--. 1 root root 15650 Feb 24 23:02 policy.json
-rw-r--r--. 1 root root    73 Feb 24 23:02 release
-rw-r--r--. 1 root root   934 Feb 24 23:02 rootwrap.conf
drwxr-xr-x. 2 root root  4096 Feb 24 23:02 rootwrap.d

6、修改 /etc/nova/api-paste.ini 配置文件:

    sed -i 's/%SERVICE_TENANT_NAME%/tenant/g' /etc/nova/api-paste.ini
    sed -i 's/%SERVICE_USER%/nova/g' /etc/nova/api-paste.ini
    sed -i 's/%SERVICE_PASSWORD%/service/g' /etc/nova/api-paste.ini

7、修改 /etc/nova/nova.conf 配置文件:

    sed -i 's/#debug=false/debug=true/g' /etc/nova/nova.conf
    sed -i 's/#verbose=false/verbose=true/g' /etc/nova/nova.conf
    sed -i 's/#log_dir=<None>/log_dir=\/var\/log\/nova\//g' /etc/nova/nova.conf
    sed -i 's/#use_syslog=false/use_syslog=false/g' /etc/nova/nova.conf
    sed -i 's/#db_backend=sqlalchemy/db_backend=sqlalchemy/g' /etc/nova/nova.conf
    sed -i 's/#backend=sqlalchemy/backend=sqlalchemy/g' /etc/nova/nova.conf
    sed -i 's/#sql_connection=sqlite:\/\/\/$state_path\/$sqlite_db/sql_connection=mysql:\/\/root:123456@localhost\/nova/g' /etc/nova/nova.conf
    sed -i 's/#connection=sqlite:\/\/\/\/nova\/openstack\/common\/db\/$sqlite_db/connection=mysql:\/\/root:123456@127.0.0.1\/nova/g' /etc/nova/nova.conf
    sed -i 's/#api_paste_config=api-paste.ini/api_paste_config=\/etc\/nova\/api-paste.ini/g' /etc/nova/nova.conf
    sed -i 's/#bindir=$pybasedir\/bin/bindir=\/usr\/bin\//g' /etc/nova/nova.conf
    sed -i 's/#state_path=$pybasedir/state_path=\/var\/lib\/nova\//g' /etc/nova/nova.conf
    sed -i 's/#my_ip=10.0.0.1/my_ip=172.16.24.138/g' /etc/nova/nova.conf
    sed -i 's/#glance_host=$my_ip/glance_host=$my_ip/g' /etc/nova/nova.conf
    sed -i 's/#glance_port=9292/glance_port=9292/g' /etc/nova/nova.conf
    sed -i 's/#glance_api_servers=$glance_host:$glance_port/glance_api_servers=$glance_host:$glance_port/g' /etc/nova/nova.conf
    sed -i 's/#metadata_host=$my_ip/metadata_host=$my_ip/g' /etc/nova/nova.conf
    sed -i 's/#metadata_port=8775/metadata_port=8775/g' /etc/nova/nova.conf
    sed -i 's/#rootwrap_config=<None>/rootwrap_config=\/etc\/nova\/rootwrap.conf/g' /etc/nova/nova.conf
    sed -i 's/#auth_strategy=noauth/auth_strategy=keystone/g' /etc/nova/nova.conf
    sed -i 's/#osapi_compute_listen=0.0.0.0/osapi_compute_listen=$my_ip/g' /etc/nova/nova.conf
    sed -i 's/#osapi_compute_listen_port=8774/osapi_compute_listen_port=8774/g' /etc/nova/nova.conf
    sed -i 's/#metadata_listen=0.0.0.0/metadata_listen=0.0.0.0/g' /etc/nova/nova.conf
    sed -i 's/#metadata_listen_port=8775/metadata_listen_port=8775/g' /etc/nova/nova.conf
    sed -i 's/#instances_path=$state_path\/instances/instances_path=$state_path\/instances/g' /etc/nova/nova.conf
    sed -i 's/#use_stderr=true/use_stderr=false/g' /etc/nova/nova.conf
    sed -i 's/#rabbit_host=localhost/rabbit_host=localhost/g' /etc/nova/nova.conf
    sed -i 's/#rabbit_port=5672/rabbit_port=5672/g' /etc/nova/nova.conf
    sed -i 's/#rabbit_userid=guest/rabbit_userid=guest/g' /etc/nova/nova.conf
    sed -i 's/#rabbit_password=guest/rabbit_password=guest/g' /etc/nova/nova.conf
    sed -i 's/#rabbit_virtual_host=\//rabbit_virtual_host=\//g' /etc/nova/nova.conf
    sed -i 's/#timeout_nbd=10/timeout_nbd=10/g' /etc/nova/nova.conf
    sed -i 's/#libvirt_type=kvm/libvirt_type=kvm/g' /etc/nova/nova.conf

8、配置polkit策略,在/etc/polkit-1/localauthority/50-local.d/建立50-nova.pkla文件,内容如下:

    [Allow nova libvirt management permissions]
    Identity=unix-user:nova
    Action=org.libvirt.unix.manage
    ResultAny=yes
    ResultInactive=yes
    ResultActive=yes
注:次策略使用在不使用root用户启动

9、初始化数据库:

(openstack)[root@casonchan ~]# mysql -h127.0.0.1 -uroot -p123456 -e 'create database `nova`'
(openstack)[root@casonchan ~]# nova-manage db sync

表结构如下:

 

10、启动服务:

nova-all --config-file=/etc/nova/nova.conf --log-config=/etc/nova/logging_sample.conf &

 

 

 

 

本文转载自:http://www.cnblogs.com/CasonChan/p/3567647.html

上一篇:Java从控制台接受输入字符

下一篇:继续寻找app开发的技术方案


0 评论

查看所有评论

给个评论吧