CentOS 6.4 Openstack Grizzly 安装配置 (Open VSwitch 单节点)

转载请注明出处,谢谢

微博:http://weibo.com/u/2644902257

欢迎大家一起讨论交流!

参考文献


Red Hat OpenStack Preview
https://access.redhat.com/site/documentation/Red_Hat_OpenStack_Preview/

CentOS 6.3 Openstack Folsom 安装(Linux Bridge模式)-- 陈沙克日志
http://www.chenshake.com/centos-install-6-3-openstack-folsom-linux-bridge-mode/#comment-1716


准备环境


1、配置yum源
CentOS6-Base-163.repo

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=0
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=0
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

epel.repo

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://centos.ustc.edu.cn/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://centos.ustc.edu.cn/epel/6/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=0

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=http://centos.ustc.edu.cn/epel/6/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=0

openstack.repo

[epel-openstack-grizzly]
name=OpenStack Grizzly Repository for EPEL 6
baseurl=http://repos.fedorapeople.org/repos/openstack/openstack-grizzly/epel-6
enabled=1
skip_if_unavailable=1
gpgcheck=0
priority=98


安装前准备



1、 安装OpenStack Utilities

#yum install -y openstack-utils dnsmasq-utils


2、更新系统

# yum update


3、关闭iptables
# service iptables stop
# chkconfig iptables off


4.关闭selinux
# vi /etc/selinux/config
SELINUX=disabled 


5、重启服务器

# reboot

6、安装qpid

# yum install -y qpid-cpp-server
# sed -i -e 's/auth=.*/auth=no/g' /etc/qpidd.conf
# service qpidd start
# chkconfig qpidd on



部署KeyStone


1、安装KeyStone
# yum install -y openstack-keystone


2、初始化数据库
# openstack-db --init --service keystone \
        --password PASSWORD

如果没有安装mysql,会在这步安装,这里默认密码PASSWORD

3、生成Token,并设置环境变量
# export SERVICE_TOKEN=$(openssl rand -hex 10)
# export SERVICE_ENDPOINT=http://10.9.0.206:35357/v2.0
# echo $SERVICE_TOKEN > /tmp/ks_admin_token
71068df694f4c4620156


4、修改配置文件
# openstack-config --set /etc/keystone/keystone.conf \
  DEFAULT admin_token $SERVICE_TOKEN
# openstack-config --set /etc/keystone/keystone.conf \
  signing token_format UUID


5、启动keystone服务
# service openstack-keystone start
# chkconfig openstack-keystone on


6、查看是否启动正常

# ps -ef | grep -i keystone-all
keystone  2331     1  3 15:24 ?        00:00:00 /usr/bin/python /usr/bin/keystone-all --config-file /etc/keystone/keystone.conf
root      2339  1902  0 15:24 pts/0    00:00:00 grep -i keystone-all
# grep ERROR /var/log/keystone/keystone.log


7、创建Keystone服务,并注册Endpoint
# keystone service-create --name=keystone --type=identity \
  --description="Keystone Identity Service"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |    Keystone Identity Service     |
|      id     | b987bd18f91a47709d1c191ca924f4db |
|     name    |             keystone             |
|     type    |             identity             |
+-------------+----------------------------------+


# keystone endpoint-create \
  --service_id b987bd18f91a47709d1c191ca924f4db \
  --publicurl 'http://10.9.0.206:5000/v2.0' \
  --adminurl 'http://10.9.0.206:35357/v2.0' \
  --internalurl 'http://10.9.0.206:5000/v2.0'
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |   http://10.9.0.206:35357/v2.0   |
|      id     | a86e402ec8144c0ba560f9b917c65981 |
| internalurl |   http://10.9.0.206:5000/v2.0    |
|  publicurl  |   http://10.9.0.206:5000/v2.0    |
|    region   |            regionOne             |
|  service_id | b987bd18f91a47709d1c191ca924f4db |
+-------------+----------------------------------+


其中service_id和上面创建service的返回ID对应

8、创建admin用户

a) 创建admin用户
# keystone user-create --name admin --pass PASSWORD
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 8179d4236cd147f2a9670df1616882a0 |
|   name   |              admin               |
| tenantId |                                  |
+----------+----------------------------------+


b) 创建admin role
# keystone role-create --name admin
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | c44c1e8f4b8c4efa82beb83a847dd0ca |
|   name   |              admin               |
+----------+----------------------------------+


c) 创建admin tenant
# keystone tenant-create --name admin
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |                                  |
|   enabled   |               True               |
|      id     | 78b342b561ed4fb79ab764b828473f93 |
|     name    |              admin               |
+-------------+----------------------------------+


d)将admin用户加入到admin role中
# keystone user-role-add --user-id 8179d4236cd147f2a9670df1616882a0 \
  --role-id c44c1e8f4b8c4efa82beb83a847dd0ca \
  --tenant-id 78b342b561ed4fb79ab764b828473f93



e)设置admin的环境变量
# vi keystonerc_admin
export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=PASSWORD
export OS_AUTH_URL=http://10.9.0.205:35357/v2.0/
export PS1='[\u@\h \W(keystone_admin)]\$ '



f)测试是否创建完成

# unset SERVICE_TOKEN
# unset SERVICE_ENDPOINT
# source ~/keystonerc_admin
# keystone user-list



9、创建一个普通用户

# keystone user-create --name tcommerce --pass PASSWORD

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | ad91d8062e5e48b185aa0e0847d4b860 |
|   name   |            tcommerce             |
| tenantId |                                  |
+----------+----------------------------------+



#  keystone role-create --name user

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | c5689d23e5a04465831f5e39caff1099 |
|   name   |               user               |
+----------+----------------------------------+



# keystone tenant-create --name user
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |                                  |
|   enabled   |               True               |
|      id     | f380922e9d844b77b7c1cb742c7ca04b |
|     name    |               user               |
+-------------+----------------------------------+



keystone user-role-add --user-id ad91d8062e5e48b185aa0e0847d4b860 \
  --role-id c5689d23e5a04465831f5e39caff1099 \
  --tenant-id f380922e9d844b77b7c1cb742c7ca04b 



#vim keystonerc_tcommerce
export OS_USERNAME=tcommerce
export OS_TENANT_NAME=user
export OS_PASSWORD=PASSWORD
export OS_AUTH_URL=http://10.9.0.206:5000/v2.0/
export PS1='[\u@\h \W(tcommerce)]\$ '


# source keystonerc_tcommerce 


# keystone user-list
Unable to communicate with identity service: {"error": {"message": "You are not authorized to perform the requested action: admin_required", "code": 403, "title": "Not Authorized"}}. (HTTP 403)


# keystone token-get

+-----------+----------------------------------+
|  Property |              Value               |
+-----------+----------------------------------+
|  expires  |       2013-04-25T08:14:28Z       |
|     id    | 1360775bf4504e84881689e6b9b4fff6 |
| tenant_id | f380922e9d844b77b7c1cb742c7ca04b |
|  user_id  | ad91d8062e5e48b185aa0e0847d4b860 |
+-----------+----------------------------------+



部署Glance



1、安装glance
# yum install -y openstack-glance


2、设置环境变量

# source ~/keystonerc_admin


3、初始数据库
# openstack-db --init --service glance \
        --password PASSWORD


4、修改配置文件

# openstack-config --set /etc/glance/glance-api.conf \
   paste_deploy flavor keystone
# openstack-config --set /etc/glance/glance-api.conf \
   keystone_authtoken admin_tenant_name admin
# openstack-config --set /etc/glance/glance-api.conf \
   keystone_authtoken admin_user admin
# openstack-config --set /etc/glance/glance-api.conf \
   keystone_authtoken admin_password PASSWORD
# openstack-config --set /etc/glance/glance-registry.conf \
   paste_deploy flavor keystone
# openstack-config --set /etc/glance/glance-registry.conf \
   keystone_authtoken admin_tenant_name admin
# openstack-config --set /etc/glance/glance-registry.conf \
   keystone_authtoken admin_user admin
# openstack-config --set /etc/glance/glance-registry.conf \
   keystone_authtoken admin_password PASSWORD



5、启动服务

# service openstack-glance-registry start
# service openstack-glance-api start
# chkconfig openstack-glance-registry on
# chkconfig openstack-glance-api on


6、创建服务和Endpoint

# keystone service-create --name=glance --type=image --description="Glance Image Service"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |       Glance Image Service       |
|      id     | c5b9b64a19084d8fbf1230ab200e730b |
|     name    |              glance              |
|     type    |              image               |
+-------------+----------------------------------+


# keystone endpoint-create --service_id c5b9b64a19084d8fbf1230ab200e730b \
  --publicurl http://10.9.0.206:9292 \
  --adminurl http://10.9.0.206:9292 \
  --internalurl http://10.9.0.206:9292

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |      http://10.9.0.206:9292      |
|      id     | 611967c3b2224cba8632e8ebe98bef96 |
| internalurl |      http://10.9.0.206:9292      |
|  publicurl  |      http://10.9.0.206:9292      |
|    region   |            regionOne             |
|  service_id | c5b9b64a19084d8fbf1230ab200e730b |
+-------------+----------------------------------+



7、测试是否安装成功

# source ~/keystonerc_tcommerce
# glance image-list


9、上传镜像到Glance

a)下载镜像
# wget http://berrange.fedorapeople.org/images/2012-11-15/f17-x86_64-openstack-sda.qcow2



b)上传镜像

glance image-create --name "fd" \
        --is-public true \
        --disk-format qcow2 \
        --container-format bare \
        --file f17-x86_64-openstack-sda.qcow2
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 4255a68ec619c25d8e93ae00e514f42f     |
| container_format | bare                                 |
| created_at       | 2013-04-24T08:30:36                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | f1d57318-63f6-4670-a4c0-b97db6fab835 |
| is_public        | True                                 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | fd                                   |
| owner            | f380922e9d844b77b7c1cb742c7ca04b     |
| protected        | False                                |
| size             | 5089761                              |
| status           | active                               |
| updated_at       | 2013-04-24T08:30:36                  |
+------------------+--------------------------------------+



c)查看镜像
# glance image-list
+--------------------------------------+----------+-------------+------------------+---------+--------+
| ID                                   | Name     | Disk Format | Container Format | Size    | Status |
+--------------------------------------+----------+-------------+------------------+---------+--------+
| f1d57318-63f6-4670-a4c0-b97db6fab835 | fd       | qcow2       | bare             | 5089761 | active |
+--------------------------------------+----------+-------------+------------------+---------+--------+



部署Cinder


1、安装Cinder
# yum install -y openstack-cinder


2、设置环境变量

# source ~/keystonerc_admin


3、初始化数据库

# openstack-db --init --service cinder \
        --password PASSWORD


4、修改配置文件

# openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
# openstack-config --set /etc/cinder/cinder.conf \
   keystone_authtoken admin_tenant_name admin
# openstack-config --set /etc/cinder/cinder.conf \
   keystone_authtoken admin_user admin
# openstack-config --set /etc/cinder/cinder.conf \
   keystone_authtoken admin_password PASSWORD

5、修改tgt配置文件

grep -q /etc/cinder/volumes /etc/tgt/targets.conf || sed -i '1iinclude /etc/cinder/volumes/*' /etc/tgt/targets.conf

6、启动tgt

#service tgtd start
#chkconfig tgtd on

6、创建cinder-volumes
使用一个空闲独立的分区,这里这个分区为/dev/sdb1

# vgcreate cinder-volumes /dev/sdb1
  Volume group "cinder-volumes" successfully created


# vgdisplay cinder-volumes
  --- Volume group ---
  VG Name               cinder-volumes
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.90 TiB
  PE Size               4.00 MiB
  Total PE              498073
  Alloc PE / Size       0 / 0   
  Free  PE / Size       498073 / 1.90 TiB
  VG UUID               KpVXij-o9qC-WNOI-BKIw-1VSz-NUEa-2UsYTF


7、 启动服务

# for srv in api scheduler volume ; do \
   sudo service openstack-cinder-$srv start ; \
  done

# for srv in api scheduler volume ; do \
   sudo chkconfig openstack-cinder-$srv on ; \
  done



8、检查是否有报错

# grep -i ERROR /var/log/cinder/*
# grep CRITICAL /var/log/cinder/*


9、创建服务和endpoint

# keystone service-create --name=cinder --type=volume --description="Cinder Volume Service"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |      Cinder Volume Service       |
|      id     | 43f96e5b49464b809388daebbc5c1b2b |
|     name    |              cinder              |
|     type    |              volume              |
+-------------+----------------------------------+



# keystone endpoint-create --service_id 43f96e5b49464b809388daebbc5c1b2b \
  --publicurl "http://10.9.0.206:8776/v1/\$(tenant_id)s" \
  --adminurl "http://10.9.0.206:8776/v1/\$(tenant_id)s" \
  --internalurl "http://10.9.0.206:8776/v1/\$(tenant_id)s"



10、测试是否正常

# source ~/keystonerc_username
# cinder list


部署 Nova


1、安装nova和cinderclient
# yum install -y openstack-nova
# yum install -y python-cinderclient


2、初始化数据库
# openstack-db --init --service nova \
        --password PASSWORD


3、修改配置文件
# openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
# openstack-config --set /etc/nova/api-paste.ini \
  filter:authtoken admin_token $(cat /tmp/ks_admin_token)


4、卸载nova-network
# rpm -e openstack-nova-network-2013.1-2.el6.noarch --nodeps


这里面使用Quantum替代


# service messagebus start
# chkconfig messagebus on


# service libvirtd start
# chkconfig libvirtd on


# openstack-config --set /etc/nova/nova.conf DEFAULT \
   volume_api_class nova.volume.cinder.API
# openstack-config --set /etc/nova/nova.conf DEFAULT \
   enabled_apis ec2,osapi_compute,metadata


5、创建服务和Endpoint
# keystone service-create --name=nova --type=compute --description="Nova Compute Service"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |       Nova Compute Service       |
|      id     | dff2746d4d7049fab6e1a96968f6a6ff |
|     name    |               nova               |
|     type    |             compute              |
+-------------+----------------------------------+


# keystone endpoint-create --service_id dff2746d4d7049fab6e1a96968f6a6ff \
  --publicurl "http://10.9.0.206:8774/v1.1/\$(tenant_id)s" \
  --adminurl "http://10.9.0.206:8774/v1.1/\$(tenant_id)s" \
  --internalurl "http://10.9.0.206:8774/v1.1/\$(tenant_id)s"

+-------------+-------------------------------------------+
|   Property  |                   Value                   |
+-------------+-------------------------------------------+
|   adminurl  | http://10.9.0.206:8774/v1.1/$(tenant_id)s |
|      id     |      21cd3644397e4affb79e22ef26a4acb8     |
| internalurl | http://10.9.0.206:8774/v1.1/$(tenant_id)s |
|  publicurl  | http://10.9.0.206:8774/v1.1/$(tenant_id)s |
|    region   |                 regionOne                 |
|  service_id |      dff2746d4d7049fab6e1a96968f6a6ff     |
+-------------+-------------------------------------------+


部署 OpenStack Networking



1、为OpenStack Networking配置Keystone
# source ~/keystonerc_admin


# keystone service-create --name openstack_network --type network \
        --description 'OpenStack Networking Service'

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |   OpenStack Networking Service   |
|      id     | 90d4cf4d89a143dabf5faf2de1f0de48 |
|     name    |        openstack_network         |
|     type    |             network              |
+-------------+----------------------------------+



# keystone endpoint-create --service-id 90d4cf4d89a143dabf5faf2de1f0de48 \
        --publicurl 'http://10.9.0.206:9696/' \
        --adminurl 'http://10.9.0.206:9696/' \
        --internalurl 'http://10.9.0.206:9696/'

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |     http://10.9.0.206:9696/      |
|      id     | e6b17c6f8ff14455a755e4c9f6fc8ca6 |
| internalurl |     http://10.9.0.206:9696/      |
|  publicurl  |     http://10.9.0.206:9696/      |
|    region   |            regionOne             |
|  service_id | 90d4cf4d89a143dabf5faf2de1f0de48 |
+-------------+----------------------------------+



2、安装 quantum 和插件
# yum install openstack-quantum

# yum install openstack-quantum-openvswitch



3、配置Openstack-Networking
# openstack-config --set /etc/quantum/quantum.conf \
DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid

# openstack-config --set /etc/quantum/quantum.conf \
DEFAULT qpid_hostname 10.9.0.206

# openstack-config --set /etc/quantum/quantum.conf \
       keystone_authtoken admin_tenant_name admin

# openstack-config --set /etc/quantum/quantum.conf \
       keystone_authtoken admin_user admin

# openstack-config --set /etc/quantum/quantum.conf \
       keystone_authtoken admin_password PASSWORD



# sudo sh -c 'echo 127.0.0.1 `hostname` >> /etc/hosts'


# quantum-server-setup --plugin openvswitch

Quantum plugin: openvswitch
Plugin: openvswitch => Database: ovs_quantum
Please enter the password for the 'root' MySQL user:
Verified connectivity to MySQL.
Would you like to update the nova configuration files? (y/n):
Y
Configuration updates complete!


# service quantum-server start
# chkconfig quantum-server on


4、修改nova.conf

network_api_class = nova.network.quantumv2.api.API
quantum_admin_username = admin
quantum_admin_password = PASSWORD
quantum_admin_auth_url = http://10.9.0.206:35357/v2.0/
quantum_auth_strategy = keystone
quantum_admin_tenant_name = admin
quantum_url = http://10.9.0.206:9696/
libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
libvirt_use_virtio_for_bridges=True


5、安装OpenStack Networking Agents

# yum install -y openstack-quantum-openvswitch


# quantum-node-setup --plugin openvswitch

Quantum plugin: openvswitch
Please enter the Quantum hostname:
10.9.0.206
Would you like to update the nova configuration files? (y/n):
y
/usr/bin/openstack-config --set|--del config_file section [parameter] [value]
Configuration updates complete!


# service openvswitch start
# chkconfig openvswitch on

# service quantum-openvswitch-agent start
# chkconfig quantum-openvswitch-agent on

# chkconfig quantum-ovs-cleanup on

6、安装 OpenStack Networking DHCP Agent

#  quantum-dhcp-setup --plugin openvswitch
Quantum plugin: openvswitch
Please enter the Quantum hostname:
10.9.0.206
Configuration updates complete!

# service quantum-dhcp-agent start
# chkconfig quantum-dhcp-agent on


7、安装OpenStack Networking L3 Agent

# ovs-vsctl add-br br-int

# ovs-vsctl add-br br-ex

# ovs-vsctl add-port br-ex eth1

# yum install -y openstack-quantum

# quantum-l3-setup --plugin openvswitch
Quantum plugin: openvswitch
Please enter the Quantum hostname:
10.9.0.206
Configuration updates complete!


# quantum router-create router1

+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| admin_state_up        | True                                 |
| external_gateway_info |                                      |
| id                    | e6216a61-0212-4b0c-8b1c-3911e9b97974 |
| name                  | router1                              |
| status                | ACTIVE                               |
| tenant_id             | 78b342b561ed4fb79ab764b828473f93     |
+-----------------------+--------------------------------------+


# vi /etc/quantum/l3_agent.ini

router_id = 3129097f-4d02-4610-b77a-47dc7a2904ea


# service quantum-l3-agent start
# chkconfig quantum-l3-agent on


8、启动nova
# service openstack-nova-api start
# service openstack-nova-cert start
# service openstack-nova-conductor start
# service openstack-nova-objectstore start
# service openstack-nova-scheduler start
# service openstack-nova-compute start


# chkconfig openstack-nova-api on
# chkconfig openstack-nova-cert on
# chkconfig openstack-nova-conductor on
# chkconfig openstack-nova-objectstore on
# chkconfig openstack-nova-scheduler on
# chkconfig openstack-nova-compute on

安装Horizon

yum install -y openstack-dashboard

yum install -y mod_ssl


#keystone role-create --name Member

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | 60b56c45151841018131c14f98052a08 |
|   name   |              Member              |
+----------+----------------------------------+


#service httpd start
#chkconfig httpd on


连接https://10.9.0.206/dashboard/

用户名:admin

密码:PASSWORD


Console Access

yum install -y openstack-nova-novncproxy

openstack-config --set /etc/nova/nova.conf \
DEFAULT novncproxy_host 0.0.0.0

openstack-config --set /etc/nova/nova.conf \
DEFAULT novncproxy_port 6080

openstack-config --set /etc/nova/nova.conf \
DEFAULT novncproxy_base_url http://10.9.0.206:6080/vnc_auto.html


openstack-config --set /etc/nova/nova.conf \
DEFAULT vnc_enabled true

openstack-config --set /etc/nova/nova.conf \
DEFAULT vncserver_listen 127.0.0.1

openstack-config --set /etc/nova/nova.conf \
DEFAULT vncserver_proxyclient_address 127.0.0.1

service openstack-nova-novncproxy start
service openstack-nova-consoleauth start
chkconfig openstack-nova-novncproxy on
chkconfig openstack-nova-consoleauth on


service openstack-nova-compute restart


使用OpenStack



1、创建key

# nova keypair-add oskey > oskey.priv
# chmod 600 oskey.priv


2、创建Instance

#  nova flavor-list

+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1  | m1.tiny   | 512       | 0    | 0         |      | 1     | 1.0         | True      | {}          |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      | {}          |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      | {}          |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      | {}          |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      | {}          |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+


# nova image-list

+--------------------------------------+------+--------+--------+
| ID                                   | Name | Status | Server |
+--------------------------------------+------+--------+--------+
| f1d57318-63f6-4670-a4c0-b97db6fab835 | fd   | ACTIVE |        |
+--------------------------------------+------+--------+--------+


# nova boot --flavor 2 --key_name oskey --image f1d57318-63f6-4670-a4c0-b97db6fab835 fedoral

+-------------------------------------+--------------------------------------+
| Property                            | Value                                |
+-------------------------------------+--------------------------------------+
| OS-EXT-STS:task_state               | scheduling                           |
| image                               | fd                                   |
| OS-EXT-STS:vm_state                 | building                             |
| OS-EXT-SRV-ATTR:instance_name       | instance-00000006                    |
| flavor                              | m1.small                             |
| id                                  | 6169db0a-4e70-4fea-9bd3-80f33875215d |
| security_groups                     | [{u'name': u'default'}]              |
| user_id                             | 8179d4236cd147f2a9670df1616882a0     |
| OS-DCF:diskConfig                   | MANUAL                               |
| accessIPv4                          |                                      |
| accessIPv6                          |                                      |
| progress                            | 0                                    |
| OS-EXT-STS:power_state              | 0                                    |
| OS-EXT-AZ:availability_zone         | None                                 |
| config_drive                        |                                      |
| status                              | BUILD                                |
| updated                             | 2013-04-25T05:01:05Z                 |
| hostId                              |                                      |
| OS-EXT-SRV-ATTR:host                | None                                 |
| key_name                            | oskey                                |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None                                 |
| name                                | fedoral                              |
| adminPass                           | eVUAeQ7H6CBm                         |
| tenant_id                           | 78b342b561ed4fb79ab764b828473f93     |
| created                             | 2013-04-25T05:01:05Z                 |
| metadata                            | {}                                   |
+-------------------------------------+--------------------------------------+

[root@iaas206 ~(keystone_admin)]# nova list
+--------------------------------------+---------+--------+-------------------+
| ID                                   | Name    | Status | Networks          |
+--------------------------------------+---------+--------+-------------------+
| 6169db0a-4e70-4fea-9bd3-80f33875215d | fedoral | ACTIVE | abc=192.168.100.1 |
+--------------------------------------+---------+--------+-------------------+


遇到问题及解决



1、使用admin用户查看用户列表时报错
# keystone user-list
Authorization Failed: Unable to communicate with identity service: {"error": {"message": "Unable to sign token.", "code": 500, "title": "Internal Server Error"}}. (HTTP 500)


解决方法:
# openstack-config --set /etc/keystone/keystone.conf \
  signing token_format UUID


2、qantum log出现下面错误

Command: ['sudo', 'ovs-vsctl', '--timeout=2', 'list-ports', 'br-int']
Exit code: 1
Stdout: ''
Stderr: 'sudo: no tty present and no askpass program specified\n'
2013-04-25 11:12:37    ERROR [quantum.agent.linux.ovs_lib] Unable to execute ['ovs-vsctl', '--timeout=2', 'list-ports', 'br-int']. Exception:


解决方法:

# visudo -f /etc/sudoers.d/quantum

quantum ALL = (root) NOPASSWD: ALL




你可能感兴趣的:(CentOS 6.4 Openstack Grizzly 安装配置 (Open VSwitch 单节点))