OpenStack-liberty版Nova服務部署(三)
API:負責接收和響應外部請求。支持OpenStack API,EC2API。
Cert:負責身份認證。
Scheduler:用於主機調度。
Conductor:計算節點訪問數據的中間件。
Consoleauth:用於控制臺的授權驗證。
Novncproxy:VNC代理。
Nova API:
nova-api組件實現了RESTful API功能,是外部訪問Nova的唯一途徑。
接收外部的請求並通過Message Queue將請求發送給其他的服務組件,同時也兼容EC2 API,所以也可以用EC2的管理工具對nova進行日常管理。
Nova scheduler:
Nova Scheduler模塊在openstack中的作用就是決策虛擬機創建在哪個主機(計算節點)上。
過濾(Filter)
計算權值(Weight)
Nova Dashboard:
Filter Schedulter首先得到未過濾的主機列表,然後根據過濾屬性,選擇服務條件的計算節點主機。
經過主機過濾後,需要對主機進行權值計算,根據策略選擇相應的某一臺主機(對於每一個要創建的虛擬機而言)。
Nova安裝:[root@hostnamelinux-node1 ~]# yum -y install openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient
配置nova:
[root@hostnamelinux-node1 ~]# vim /etc/nova/nova.conf
[database]
connection=mysql://nova:[email protected]/nova
同步數據庫:[root@hostnamelinux-node1 ~]# su -s /bin/sh -c "nova-manage db sync" nova
[root@hostnamelinux-node1 ~]# mysql -unova -pnova Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 26 Server version: 10.1.20-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. MariaDB [(none)]> use nova; Database changed MariaDB [nova]> show tables; +--------------------------------------------+ | Tables_in_nova | +--------------------------------------------+ | agent_builds | | aggregate_hosts | | aggregate_metadata | | aggregates | | block_device_mapping | | bw_usage_cache | | cells | | certificates | | compute_nodes | | console_pools | | consoles | | dns_domains | | fixed_ips | | floating_ips | | instance_actions | | instance_actions_events | | instance_extra | | instance_faults | | instance_group_member | | instance_group_policy | | instance_groups | | instance_id_mappings | | instance_info_caches | | instance_metadata | | instance_system_metadata | | instance_type_extra_specs | | instance_type_projects | | instance_types | | instances | | key_pairs | | migrate_version | | migrations | | networks | | pci_devices | | project_user_quotas | | provider_fw_rules | | quota_classes | | quota_usages | | quotas | | reservations | | s3_images | | security_group_default_rules | | security_group_instance_association | | security_group_rules | | security_groups | | services | | shadow_agent_builds | | shadow_aggregate_hosts | | shadow_aggregate_metadata | | shadow_aggregates | | shadow_block_device_mapping | | shadow_bw_usage_cache | | shadow_cells | | shadow_certificates | | shadow_compute_nodes | | shadow_console_pools | | shadow_consoles | | shadow_dns_domains | | shadow_fixed_ips | | shadow_floating_ips | | shadow_instance_actions | | shadow_instance_actions_events | | shadow_instance_extra | | shadow_instance_faults | | shadow_instance_group_member | | shadow_instance_group_policy | | shadow_instance_groups | | shadow_instance_id_mappings | | shadow_instance_info_caches | | shadow_instance_metadata | | shadow_instance_system_metadata | | shadow_instance_type_extra_specs | | shadow_instance_type_projects | | shadow_instance_types | | shadow_instances | | shadow_key_pairs | | shadow_migrate_version | | shadow_migrations | | shadow_networks | | shadow_pci_devices | | shadow_project_user_quotas | | shadow_provider_fw_rules | | shadow_quota_classes | | shadow_quota_usages | | shadow_quotas | | shadow_reservations | | shadow_s3_images | | shadow_security_group_default_rules | | shadow_security_group_instance_association | | shadow_security_group_rules | | shadow_security_groups | | shadow_services | | shadow_snapshot_id_mappings | | shadow_snapshots | | shadow_task_log | | shadow_virtual_interfaces | | shadow_volume_id_mappings | | shadow_volume_usage_cache | | snapshot_id_mappings | | snapshots | | tags | | task_log | | virtual_interfaces | | volume_id_mappings | | volume_usage_cache | +--------------------------------------------+ 105 rows in set (0.01 sec) MariaDB [nova]> exit Bye
[root@hostnamelinux-node1 ~]# vim /etc/nova/nova.conf
[DEFAULT]
rpc_backend=rabbit
[oslo_messaging_rabbit]
rabbit_host=192.168.56.11
rabbit_port=5672
rabbit_userid=openstack
rabbit_password=openstack
創建nova用戶:
[root@hostnamelinux-node1 ~]# openstack user create --domain default --password=nova nova
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 8120acc4fbbb4cc3a86b20f5ac6114c9 |
| name | nova |
+-----------+----------------------------------+
將nova加入service項目賦予admin權限;[root@hostnamelinux-node1 ~]# openstack role add --project service --user nova admin
[root@hostnamelinux-node1 ~]# vim /etc/nova/nova.conf
[keystone_authtoken]
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = nova
[DEFAULT]
auth_strategy=keystone
network_api_class=nova.network.neutronv2.api.API
network_api_class對應的python方法目錄;
[root@hostnamelinux-node1 ~]# vim /usr/lib/python2.7/site-packages/nova/network/neutronv2/api.py
class API(base_api.NetworkAPI):
pass
[root@hostnamelinux-node1 ~]# vim /etc/nova/nova.conf
[DEFAULT]
security_group_api=neutron
linuxnet_interface_driver=nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
linuxnet_interface_driver對應的python方法目錄;
[root@hostnamelinux-node1 ~]# vim /usr/lib/python2.7/site-packages/nova/network/linux_net.py
class NeutronLinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver):
pass
[root@hostnamelinux-node1 ~]# vim /etc/nova/nova.conf
[DEFAULT]
#firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
firewall_driver=nova.virt.libvirt.firewall.NoopFirewallDriver
my_ip=192.168.56.11
enabled_apis=osapi_compute,metadata
[vnc]
vncserver_listen=$my_ip
vncserver_proxyclient_address=$my_ip
[glance]
host=$my_ip
[oslo_concurrency]
lock_path=/var/lib/nova/tmp
[root@hostnamelinux-node1 ~]# grep ‘^[a-z]‘ /etc/nova/nova.conf
my_ip=192.168.56.11
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.libvirt.firewall.NoopFirewallDriver
rpc_backend=rabbit
connection=mysql://nova:[email protected]/nova
host=$my_ip
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = nova
lock_path=/var/lib/nova/tmp
rabbit_host=192.168.56.11
rabbit_port=5672
rabbit_userid=openstack
rabbit_password=openstack
vncserver_listen=$my_ip
vncserver_proxyclient_address=$my_ip
啟動nova:
[root@hostnamelinux-node1 ~]# grep ‘^[a-z]‘ /etc/nova/nova.conf -c
25
[root@hostnamelinux-node1 ~]# 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
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-cert.service to /usr/lib/systemd/system/openstack-nova-cert.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.
[root@hostnamelinux-node1 ~]# 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
註冊nova:[root@hostnamelinux-node1 ~]# source admin-openrc.sh
創建nova服務:
[root@hostnamelinux-node1 ~]# openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 887fca219f71485a96461ad96aabc594 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
註冊公網:
[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne compute public http://192.168.56.11:8774/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field | Value |
+--------------+--------------------------------------------+
| enabled | True |
| id | aacb15c952264c478632facc9953f320 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 887fca219f71485a96461ad96aabc594 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.56.11:8774/v2/%(tenant_id)s |
+--------------+--------------------------------------------+
註冊私網:
[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne compute internal http://192.168.56.11:8774/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field | Value |
+--------------+--------------------------------------------+
| enabled | True |
| id | 0c5bb8ed04ff4e30bff474ab693a8e7b |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 887fca219f71485a96461ad96aabc594 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.56.11:8774/v2/%(tenant_id)s |
+--------------+--------------------------------------------+
註冊admin:
[root@hostnamelinux-node1 ~]# openstack endpoint create --region RegionOne compute admin http://192.168.56.11:8774/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field | Value |
+--------------+--------------------------------------------+
| enabled | True |
| id | be2392a0d3a84014b108fda8fe9c08eb |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 887fca219f71485a96461ad96aabc594 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.56.11:8774/v2/%(tenant_id)s |
+--------------+--------------------------------------------+
[root@hostnamelinux-node1 ~]# openstack host list
+-------------------------------+-------------+----------+
| Host Name | Service | Zone |
+-------------------------------+-------------+----------+
| hostnamelinux-node1.smoke.com | scheduler | internal |
| hostnamelinux-node1.smoke.com | cert | internal |
| hostnamelinux-node1.smoke.com | consoleauth | internal |
| hostnamelinux-node1.smoke.com | conductor | internal |
+-------------------------------+-------------+----------+
OpenStack-liberty版Nova服務部署(三)