标签:command path virt restful interface table device pack 响应
Nova计算服务: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:nova@192.168.56.11/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:nova@192.168.56.11/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 |
+-------------------------------+-------------+----------+
标签:command path virt restful interface table device pack 响应
原文地址:http://blog.51cto.com/smoke520/2294329