centos7+openstack (4) nova配置

Submitted by Lizhe on Tue, 07/11/2017 - 22:58

修改 /etc/nova/nova.conf

 

vi /etc/nova/nova.conf

 

cat /etc/nova/nova.conf|grep -v "^#"|grep -v "^$"

[DEFAULT] 
my_ip=192.168.1.151
enabled_apis=osapi_compute,metadata 
auth_strategy=keystone 
network_api_class=nova.network.neutronv2.api.API 
linuxnet_interface_driver=nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver 
security_group_api=neutron 
firewall_driver = nova.virt.firewall.NoopFirewallDriver 
debug=true 
verbose=true 
rpc_backend=rabbit 
allow_resize_to_same_host=True 
scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter 
[api_database] 
[barbican] 
[cells] 
[cinder] 
[conductor] 
[cors] 
[cors.subdomain] 
[database] 
connection=mysql://nova:nova@192.168.1.151/nova 
[ephemeral_storage_encryption] 
[glance] 
host=$my_ip 
[guestfs] 
[hyperv] 
[image_file_url] 
[ironic] 
[keymgr] 
[keystone_authtoken]
auth_uri = http://192.168.1.151:5000 
auth_url = http://192.168.1.151:35357 
auth_plugin = password 
project_domain_id = default 
user_domain_id = default 
project_name = service 
username = nova 
password = nova 
[libvirt] 
#if used as a compute node add this line
virt_type=qemu
[matchmaker_redis] 
[matchmaker_ring] 
[metrics] 
[neutron] 
url = http://192.168.1.151:9696 
auth_url = http://192.168.1.151:35357 
auth_plugin = password 
project_domain_id = default 
user_domain_id = default 
region_name = RegionOne 
project_name = service 
username = neutron 
password = neutron 
service_metadata_proxy = True 
metadata_proxy_shared_secret = neutron 
lock_path=/var/lib/nova/tmp 
[osapi_v21] 
[oslo_concurrency] 
[oslo_messaging_amqp] 
[oslo_messaging_qpid] 
[oslo_messaging_rabbit] 
rabbit_host=192.168.1.151 
rabbit_port=5672 
rabbit_userid=openstack 
rabbit_password=openstack 
[oslo_middleware] 
[rdp] 
[serial_console] 
[spice] 
[ssl] 
[trusted_computing] 
[upgrade_levels] 
[vmware] 
[vnc]
#if used as a compute node add this line
novncproxy_base_url=http://58.68.250.151:6080/vnc_auto.html
vncserver_listen= $my_ip 
vncserver_proxyclient_address= $my_ip
#if used as a compute node add this line
keymap=en-us
[workarounds] 
[xenserver] 
[zookeeper]

同步数据库

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

 

忽略错误

No handlers could be found for logger "oslo_config.cfg"
/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py:450: Warning: Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.
  cursor.execute(statement, parameters)
/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py:450: Warning: Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.
  cursor.execute(statement, parameters)

 

此处会创建nova用户,登录check一下

mysql -h 192.168.1.151 -unova -p   (密码nova)

 

创建nova 的keystone 用户

source admin-openrc.sh
openstack user create --domain default --password=nova nova
openstack role add --project service --user nova admin

启动nova 相关服务

systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
 

在keystone 上注册

source admin-openrc.sh
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne compute public http://192.168.1.151:8774/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute internal http://192.168.1.151:8774/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute admin http://192.168.1.151:8774/v2/%\(tenant_id\)s
 

检查一下

openstack host list

164

 


 

以下内容在计算节点(192.168.1.152)上进行

从控制机拷贝到计算节点

scp /etc/nova/nova.conf 192.168.1.152:/etc/nova/

手动更改如下配置

vi /etc/nova/nova.conf
my_ip=192.168.1.152 
novncproxy_base_url=http://192.168.1.151:6080/vnc_auto.html 
vncserver_listen=0.0.0.0 
vncserver_proxyclient_address= $my_ip 
keymap=en-us 
[glance] 
host=192.168.56.151 
[libvirt] 
virt_type=qemu

启动服务

启动服务之前请检查rabbitmq工作正常

#!/bin/bash

rabbitmqctl add_user openstack openstack
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
systemctl restart rabbitmq-server.service
rabbitmqctl set_user_tags openstack administrator
rabbitmqctl set_permissions -p / openstack '.*' '.*' '.*'

启动服务

systemctl enable libvirtd openstack-nova-compute
systemctl start libvirtd openstack-nova-compute

在控制节点测试,可以看到152已经join进来了

openstack host list

165

检查nova下glance是否正常

nova image-list

166

检查nova下keystone是否正常

nova endpoints

[root@centos_admin ~]# nova endpoints
WARNING: nova has no endpoint in ! Available endpoints for this service:
+-----------+---------------------------------------------------------------+
| nova      | Value                                                         |
+-----------+---------------------------------------------------------------+
| id        | 10d77539a9be48a4bb26f2bf159288b3                              |
| interface | admin                                                         |
| region    | RegionOne                                                     |
| region_id | RegionOne                                                     |
| url       | http://192.168.1.151:8774/v2/dfd06c2e4610414491056a6e1214f1ae |
+-----------+---------------------------------------------------------------+
+-----------+---------------------------------------------------------------+
| nova      | Value                                                         |
+-----------+---------------------------------------------------------------+
| id        | 3eda8d51f401435289ad6e26b9c2a039                              |
| interface | public                                                        |
| region    | RegionOne                                                     |
| region_id | RegionOne                                                     |
| url       | http://192.168.1.151:8774/v2/dfd06c2e4610414491056a6e1214f1ae |
+-----------+---------------------------------------------------------------+
+-----------+---------------------------------------------------------------+
| nova      | Value                                                         |
+-----------+---------------------------------------------------------------+
| id        | d5c24f6b037d4da1baff9d20132b0c89                              |
| interface | internal                                                      |
| region    | RegionOne                                                     |
| region_id | RegionOne                                                     |
| url       | http://192.168.1.151:8774/v2/dfd06c2e4610414491056a6e1214f1ae |
+-----------+---------------------------------------------------------------+
WARNING: keystone has no endpoint in ! Available endpoints for this service:
+-----------+----------------------------------+
| keystone  | Value                            |
+-----------+----------------------------------+
| id        | 3d9feccadbf74a5f8dc1a99e0024850c |
| interface | admin                            |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://192.168.1.151:35357/v2.0  |
+-----------+----------------------------------+
+-----------+----------------------------------+
| keystone  | Value                            |
+-----------+----------------------------------+
| id        | 82294eb6fc664fc6aaf36d9e4aa66728 |
| interface | internal                         |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://192.168.1.151:5000/v2.0   |
+-----------+----------------------------------+
+-----------+----------------------------------+
| keystone  | Value                            |
+-----------+----------------------------------+
| id        | fb351fb303bd4d4a95b1ffc53d943c0a |
| interface | public                           |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://192.168.1.151:5000/v2.0   |
+-----------+----------------------------------+
WARNING: glance has no endpoint in ! Available endpoints for this service:
+-----------+----------------------------------+
| glance    | Value                            |
+-----------+----------------------------------+
| id        | 54f3d2a398e64d4da3cdf3c5d5bfbc91 |
| interface | internal                         |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://192.168.1.151:9292        |
+-----------+----------------------------------+
+-----------+----------------------------------+
| glance    | Value                            |
+-----------+----------------------------------+
| id        | 7f66279a0dcb4b329269196a0d82e46d |
| interface | public                           |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://192.168.1.151:9292        |
+-----------+----------------------------------+
+-----------+----------------------------------+
| glance    | Value                            |
+-----------+----------------------------------+
| id        | e0c950f689b84656818ae33b03964033 |
| interface | admin                            |
| region    | RegionOne                        |
| region_id | RegionOne                        |
| url       | http://192.168.1.151:9292        |
+-----------+----------------------------------+
[root@centos_admin ~]# 

 

167