openstack(五)nova(控制节点/计算节点)

控制节点

yum install -y openstack-nova-api openstack-nova-placement-api   openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler libibverbs

/etc/nova/nova.conf

cat > /etc/nova/nova.conf <<EOF
[DEFAULT]
enabled_apis=osapi_compute,metadata
transport_url = rabbit://openstack:[email protected]
use_neutron=true
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[api]
auth_strategy=keystone

[glance]
api_servers = http://192.168.3.220:9292

[api_database]
connection= mysql+pymysql://nova:[email protected]/nova_api

[database]
connection= mysql+pymysql://nova:[email protected]/nova

[keystone_authtoken]
auth_uri = http://192.168.3.220:5000
auth_url = http://192.168.3.220:35357
memcached_servers = 192.168.3.220:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova

[vnc]
enabled=true
server_listen = 0.0.0.0
server_proxyclient_address = 192.168.3.220

[oslo_concurrency]
lock_path=/var/lib/nova/tmp

[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://192.168.3.220:35357/v3
username = placement
password = placement
EOF

nova.conf

初始化api数据库

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

注册cell0

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

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

初始化nova数据库
su -s /bin/sh -c "nova-manage db sync" nova

查看注册cells

nova-manage cell_v2 list_cells

查看数据库表

mysql -unova -pnova -e " use nova;show tables;use nova_api;show tables;use nova_cell0;show tables;"

启动并配置开机启动

systemctl restart  openstack-nova-scheduler openstack-nova-conductor openstack-nova-novncproxy openstack-nova-api openstack-nova-console openstack-nova-scheduler

systemctl enable openstack-nova-api openstack-nova-scheduler openstack-nova-conductor  openstack-nova-novncproxy openstack-nova-console 1>&2

配置服务与端点

openstack service create --name nova   --description "Openstack Compute " compute 
openstack endpoint create --region RegionOne compute public   http://192.168.3.220:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://192.168.3.220:8774/v2.1
openstack endpoint create --region RegionOne compute admin    http://192.168.3.220:8774/v2.1

nova service-list

========================================================

计算节点

yum install -y openstack-nova-compute sysfsutils

/etc/nova/nova.conf 

cat > /etc/nova/nova.conf << EOF
[DEFAULT]
enabled_apis=osapi_compute,metadata
transport_url = rabbit://openstack:[email protected]
use_neutron=true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
vif_plugging_is_fatal = False 
vif_plugging_timeout = 0

[api]
auth_strategy=keystone

[glance]
api_servers = http://192.168.3.220:9292

[keystone_authtoken]
auth_uri = http://192.168.3.220:5000
auth_url = http://192.168.3.220:35357
memcached_servers = 192.168.3.220:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova

[vnc]
enabled=true
server_listen = 0.0.0.0
server_proxyclient_address = 192.168.3.220
novncproxy_base_url = http://192.168.3.220:6080/vnc_auto.html

[oslo_concurrency]
lock_path=/var/lib/nova/tmp

[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://192.168.3.220:35357/v3
username = placement
password = placement

[libvirt]
virt_type=kvm

EOF

nova.conf

配置开机启动服务并启动服务

systemctl restart libvirtd openstack-nova-compute && systemctl enable libvirtd openstack-nova-compute

========================================================

控制节点上加入主机

su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

查看主机

openstack host list
openstack compute service list
openstack catalog list

相关推荐