06 龙芯平台openstack部署搭建-nova-controller部署

一、创建Nova相关数据库、凭据与API端点

1.创建数据库并授权

#nova-controller先决条件

mysql -uroot -ploongson -e "CREATE DATABASE nova_api;"

mysql -uroot -ploongson -e "CREATE DATABASE nova;"

mysql -uroot -ploongson -e "CREATE DATABASE nova_cell0;"

mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'loongson';"

mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'loongson';"

mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'loongson';"

mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'loongson';"

mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'loongson';"

mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'loongson';"

2.创建计算服务凭据

#以下命令需要输入密码

openstack user create --domain default --password-prompt nova

openstack role add --project service --user nova admin

openstack service create --name nova --description "OpenStack Compute" compute

3.创建compute API服务端点

openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1

openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1

openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1

二、nova相关软件安装与配置

1.安装nova相关软件

yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler

2.配置文件修改

cp /etc/nova/nova.conf /etc/nova/nova.conf.bac

openstack-config --set /etc/nova/nova.conf DEFAULT debug true

#请根据实际情况自行修改my_ip的值

openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.130.0.31

openstack-config --set /etc/nova/nova.conf DEFAULT pybasedir /usr/lib/python3/dist-packages

openstack-config --set /etc/nova/nova.conf DEFAULT bindir /usr/bin

openstack-config --set /etc/nova/nova.conf DEFAULT state_path /var/lib/nova

openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata

#请根据实际情况自行修改rabbitmq对应服务的ip

openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://guest:loongson@10.130.0.31:5672

openstack-config --set /etc/nova/nova.conf api auth_strategy keystone

openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:loongson@controller:3306/nova_api

openstack-config --set /etc/nova/nova.conf cinder os_region_name RegionOne

openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:loongson@controller:3306/nova

openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292

openstack-config --set /etc/nova/nova.conf keystone_authtoken www_authenticate_uri http://controller:5000

openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000

openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211

openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password

openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name Default

openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name Default

openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service

openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova

openstack-config --set /etc/nova/nova.conf keystone_authtoken password loongson

openstack-config --set /etc/nova/nova.conf libvirt virt_type kvm

openstack-config --set /etc/nova/nova.conf libvirt use_virtio_for_bridges true

#如果需要通过iso起虚拟机,需要设置images_type = raw,默认是qcow2

#openstack-config --set /etc/nova/nova.conf libvirt images_type raw

openstack-config --set /etc/nova/nova.conf neutron auth_url http://controller:5000

openstack-config --set /etc/nova/nova.conf neutron auth_type password

openstack-config --set /etc/nova/nova.conf neutron project_domain_name default

openstack-config --set /etc/nova/nova.conf neutron user_domain_name default

openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne

openstack-config --set /etc/nova/nova.conf neutron project_name service

openstack-config --set /etc/nova/nova.conf neutron username neutron

openstack-config --set /etc/nova/nova.conf neutron password loongson

openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp

openstack-config --set /etc/nova/nova.conf placement region_name RegionOne

openstack-config --set /etc/nova/nova.conf placement project_domain_name Default

openstack-config --set /etc/nova/nova.conf placement project_name service

openstack-config --set /etc/nova/nova.conf placement auth_type password

openstack-config --set /etc/nova/nova.conf placement user_domain_name Default

openstack-config --set /etc/nova/nova.conf placement auth_url http://controller:5000/v3

openstack-config --set /etc/nova/nova.conf placement username placement

openstack-config --set /etc/nova/nova.conf placement password loongson

openstack-config --set /etc/nova/nova.conf vnc enabled true

openstack-config --set /etc/nova/nova.conf vnc server_listen " $my_ip"

openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address " $my_ip"

openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://controller:6080/vnc_auto.html

3.修改/etc/nova/nova.conf文件,设置 vif_plugging_is_fatal = False 和 vif_plugging_timeout = 0,如下所示:

#Fail instance boot if vif plugging fails

vif_plugging_is_fatal = False

#Number of seconds to wait for neutron vif

#plugging events to arrive before continuing or failing

#(see vif_plugging_is_fatal). If this is set to zero and

#vif_plugging_is_fatal is False, events should not be expected to arrive at all.

vif_plugging_timeout = 0

4.在/etc/httpd/conf.d/00-placement-api.conf增加以下内容,并重启httpd服务, systemctl restart httpd

cp /etc/httpd/conf.d/00-placement-api.conf /etc/httpd/conf.d/00-placement-api.conf.bac

bash 复制代码
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>

5.同步创建相关数据库(注意顺序)

#(1)填充nova-api数据库

su -s /bin/sh -c "nova-manage api_db sync" nova

#验证数据库

mysql -unova -ploongson -e "use nova_api;show tables;"

#(2)注册cell0数据库

su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

#(3)创建cell1单元

su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

#(4)初始化nova数据库

su -s /bin/sh -c "nova-manage db sync" nova

#(5)检查确认cell0和cell1注册成功

su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

#(6)验证数据库

mysql -unova -ploongson -e "use nova_api;show tables;"

mysql -uplacement -ploongson -e "use placement;show tables;"

#启动计算服并设置开机自启

systemctl enable

openstack-nova-api.service

openstack-nova-scheduler.service

openstack-nova-conductor.service

openstack-nova-novncproxy.service

systemctl start

openstack-nova-api.service

openstack-nova-scheduler.service

openstack-nova-conductor.service

openstack-nova-novncproxy.service

systemctl status

openstack-nova-api.service

openstack-nova-scheduler.service

openstack-nova-conductor.service

openstack-nova-novncproxy.service

#创建flavor

#内存2048M 虚拟机60G cpu核数2

nova flavor-create --is-public true boshen_ram_2048_disk_2_vcpus_1 boshen_ram_2048_disk_2_vcpus_1 2048 60 2

#验证

openstack compute service list

openstack catalog list

openstack image list

nova-status upgrade check

相关推荐
huhy~10 天前
基于Ubuntu2410脚本搭建OpenStack-D版
服务器·网络·openstack
xserver210 天前
Openstack9--安装etcd分布式键-值对存储系统
数据库·分布式·openstack·etcd
mqiqe19 天前
云计算Openstack 虚拟机调度策略
云计算·openstack
小安运维日记23 天前
Linux云计算 |【第五阶段】CLOUD-DAY2
linux·运维·云计算·openstack
南宫乘风1 个月前
OpenStack将运行的系统导出 QCOW2 镜像并导入阿里云
阿里云·云计算·openstack
学习向前冲1 个月前
开源OpenStack
openstack
suum1 个月前
openstack-swift.18421165
openstack
极客先躯1 个月前
开源的云平台有哪些?
kubernetes·开源·openstack·cloudstack·云平台·docker swarm·opennebula
mqiqe1 个月前
云计算Openstack Horizon
云计算·openstack·perl
zkyqss2 个月前
OpenStack Yoga版安装笔记(十六)Openstack网络理解
笔记·openstack