赞
踩
注意安装版本为:nova 25.2.2.dev5
在安装和配置compute service之前,需要先创建数据库、服务凭证(用户名/密码)、服务API端点。
1、Create the database:
- root@controller:~# mysql
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 31
- Server version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04
-
- Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
-
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-
- MariaDB [(none)]> CREATE DATABASE nova_api;
- Query OK, 1 row affected (0.001 sec)
-
- MariaDB [(none)]> CREATE DATABASE nova;
- Query OK, 1 row affected (0.000 sec)
-
- MariaDB [(none)]> CREATE DATABASE nova_cell0;
- Query OK, 1 row affected (0.000 sec)
-
- MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
- -> IDENTIFIED BY 'openstack';
- Query OK, 0 rows affected (0.002 sec)
-
- MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
- -> IDENTIFIED BY 'openstack';
- Query OK, 0 rows affected (0.001 sec)
-
- MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
- -> IDENTIFIED BY 'openstack';
- Query OK, 0 rows affected (0.001 sec)
-
- MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
- -> IDENTIFIED BY 'openstack';
- Query OK, 0 rows affected (0.001 sec)
-
- MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
- -> IDENTIFIED BY 'openstack';
- Query OK, 0 rows affected (0.001 sec)
-
- MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
- -> IDENTIFIED BY 'openstack';
- Query OK, 0 rows affected (0.001 sec)
-
- MariaDB [(none)]> quit
- Bye
- root@controller:~#
2、Configure User and Endpoints
- root@controller:~# . admin-openrc
- root@controller ~(admin/amdin)# openstack user create --domain default --password-prompt nova
- User Password:
- Repeat User Password:
- +---------------------+----------------------------------+
- | Field | Value |
- +---------------------+----------------------------------+
- | domain_id | default |
- | enabled | True |
- | id | 107cee2c7dc34407bd41bea2e8ae4b2c |
- | name | nova |
- | options | {} |
- | password_expires_at | None |
- +---------------------+----------------------------------+
- root@controller ~(admin/amdin)# openstack role add --project service --user nova admin
- root@controller ~(admin/amdin)# openstack service create --name nova \
- > --description "OpenStack Compute" compute
- +-------------+----------------------------------+
- | Field | Value |
- +-------------+----------------------------------+
- | description | OpenStack Compute |
- | enabled | True |
- | id | 1b8f162ebcf848ee8bd69bc6b36a8dff |
- | name | nova |
- | type | compute |
- +-------------+----------------------------------+
- root@controller ~(admin/amdin)# openstack endpoint create --region RegionOne \
- > compute public http://controller:8774/v2.1
- +--------------+----------------------------------+
- | Field | Value |
- +--------------+----------------------------------+
- | enabled | True |
- | id | 56f7de504b8c46a8bf49ca95bb82b20a |
- | interface | public |
- | region | RegionOne |
- | region_id | RegionOne |
- | service_id | 1b8f162ebcf848ee8bd69bc6b36a8dff |
- | service_name | nova |
- | service_type | compute |
- | url | http://controller:8774/v2.1 |
- +--------------+----------------------------------+
- root@controller ~(admin/amdin)# openstack endpoint create --region RegionOne \
- > compute internal http://controller:8774/v2.1
- +--------------+----------------------------------+
- | Field | Value |
- +--------------+----------------------------------+
- | enabled | True |
- | id | 92a7d9dd7cce4678b280d143514bbed4 |
- | interface | internal |
- | region | RegionOne |
- | region_id | RegionOne |
- | service_id | 1b8f162ebcf848ee8bd69bc6b36a8dff |
- | service_name | nova |
- | service_type | compute |
- | url | http://controller:8774/v2.1 |
- +--------------+----------------------------------+
- root@controller ~(admin/amdin)# openstack endpoint create --region RegionOne \
- > compute admin http://controller:8774/v2.1
- +--------------+----------------------------------+
- | Field | Value |
- +--------------+----------------------------------+
- | enabled | True |
- | id | 9f112fb3f16441fc8f4314608aaad122 |
- | interface | admin |
- | region | RegionOne |
- | region_id | RegionOne |
- | service_id | 1b8f162ebcf848ee8bd69bc6b36a8dff |
- | service_name | nova |
- | service_type | compute |
- | url | http://controller:8774/v2.1 |
- +--------------+----------------------------------+
- root@controller ~(admin/amdin)#
1、安装软件包
root@controller:~# apt install nova-api nova-conductor nova-novncproxy nova-scheduler
2、Edit the /etc/nova/nova.conf
file
- root@controller:~# vi /etc/nova/nova.conf
-
- [api_database]
- # connection = sqlite:var/lib/nova/nova_api.sqlite
- connection = mysql+pymysql://nova:openstack@controller/nova_api
- ...
- [database]
- # connection = sqlite:var/lib/nova/nova.sqlite
- connection = mysql+pymysql://nova:openstack@controller/nova
- ...
- [DEFAULT]
- transport_url = rabbit://openstack:openstack@controller:5672/
- ...
- [api]
- auth_strategy = keystone
- ...
- [keystone_authtoken]
- www_authenticate_uri = http://controller:5000/
- auth_url = http://controller:5000/
- memcached_servers = controller:11211
- auth_type = password
- project_domain_name = Default
- user_domain_name = Default
- project_name = service
- username = nova
- password = openstack
- ...
- [service_user]
- send_service_user_token = true
- auth_url = https://controller/identity
- auth_strategy = keystone
- auth_type = password
- project_domain_name = Default
- project_name = service
- user_domain_name = Default
- username = nova
- password = openstack
- ...
- [DEFAULT]
- my_ip = 10.0.20.11
- ...
- [neutron]
- auth_url = http://controller:5000
- auth_type = password
- project_domain_name = default
- user_domain_name = default
- region_name = RegionOne
- project_name = service
- username = neutron
- password = openstack
- service_metadata_proxy = true
- metadata_proxy_shared_secret = openstack
- ...
- [vnc]
- enabled = true
- server_listen = $my_ip
- server_proxyclient_address = $my_ip
- ...
- [glance]
- api_servers = http://controller:9292
- ...
- [oslo_concurrency]
- lock_path = /var/lib/nova/tmp
- ...
- [DEFAULT]
- # log_dir = /var/log/nova
- ...
- [placement]
- region_name = RegionOne
- project_domain_name = Default
- project_name = service
- auth_type = password
- user_domain_name = Default
- auth_url = http://controller:5000/v3
- username = placement
- password = openstack
3、Populate the nova-api database:
- root@controller:~# su -s /bin/sh -c "nova-manage api_db sync" nova
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- 2024-08-03 09:56:33.424 12329 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
- 2024-08-03 09:56:33.425 12329 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
- 2024-08-03 09:56:33.432 12329 INFO alembic.runtime.migration [-] Running upgrade -> d67eeaabee36, Initial version
- 2024-08-03 09:56:33.631 12329 INFO alembic.runtime.migration [-] Running upgrade d67eeaabee36 -> b30f573d3377, Remove unused build_requests columns
- root@controller:~#
4、Register the cell0 database:
- root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- root@controller:~#
5、Create the cell1 cell:
- root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- --transport-url not provided in the command line, using the value [DEFAULT]/transport_url from the configuration file
- --database_connection not provided in the command line, using the value [database]/connection from the configuration file
- 8b1967df-7901-42b3-8b03-fc4e884f490d
- root@controller:~#
6、Populate the nova database:
- root@controller:~# su -s /bin/sh -c "nova-manage db sync" nova
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- 2024-08-03 10:06:03.073 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Context impl MySQLImpl.
- 2024-08-03 10:06:03.073 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Will assume non-transactional DDL.
- 2024-08-03 10:06:03.080 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Running upgrade -> 8f2f1571d55b, Initial version
- 2024-08-03 10:06:03.879 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Running upgrade 8f2f1571d55b -> 16f1fbcab42b, Resolve shadow table diffs
- 2024-08-03 10:06:03.899 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Context impl MySQLImpl.
- 2024-08-03 10:06:03.899 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Will assume non-transactional DDL.
- 2024-08-03 10:06:03.905 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Running upgrade -> 8f2f1571d55b, Initial version
- 2024-08-03 10:06:04.629 14092 INFO alembic.runtime.migration [req-2c88e019-957e-4116-8e7c-29dd6243047c - - - - -] Running upgrade 8f2f1571d55b -> 16f1fbcab42b, Resolve shadow table diffs
- root@controller:~#
7、Verify nova cell0 and cell1 are registered correctly:
- root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- +-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+
- | Name | UUID | Transport URL | Database Connection | Disabled |
- +-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+
- | cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller/nova_cell0 | False |
- | cell1 | 8b1967df-7901-42b3-8b03-fc4e884f490d | rabbit://openstack:****@controller:5672/ | mysql+pymysql://nova:****@controller/nova | False |
- +-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+
- root@controller:~#
Restart the Compute services:
- root@controller:~# service nova-api restart
- root@controller:~# service nova-scheduler restart
- root@controller:~# service nova-conductor restart
- root@controller:~# service nova-novncproxy restart
- root@controller:~#
- root@controller:~# systemctl | grep nova
- nova-api.service loaded active running OpenStack Compute API
- nova-conductor.service loaded active running OpenStack Compute Conductor
- nova-novncproxy.service loaded active running OpenStack Compute novncproxy
- nova-scheduler.service loaded active running OpenStack Compute Scheduler
- root@controller:~#
计算服务(Compute Service)支持多种hypervisor来部署实例或虚拟机。为了简化配置,这里使用Quick EMUlator(QEMU)hypervisor,并在支持虚拟机硬件加速的计算节点上结合了基于内核的虚拟机(KVM)扩展。在不支持硬件加速的传统硬件上,可以使用通用的QEMU hypervisor。另外可以通过简单修改这里的配置,增加额外的计算节点,从而水平扩展计算环境。
root@compute1:~# apt install nova-compute
- root@compute1:~# vi /etc/nova/nova.conf
-
- [DEFAULT]
-
- transport_url = rabbit://openstack:openstack@controller
- ...
- [api]
- auth_strategy = keystone
- ...
- [keystone_authtoken]
- www_authenticate_uri = http://controller:5000/
- auth_url = http://controller:5000/
- memcached_servers = controller:11211
- auth_type = password
- project_domain_name = Default
- user_domain_name = Default
- project_name = service
- username = nova
- password = openstack
- ...
- [service_user]
- send_service_user_token = true
- auth_url = https://controller/identity
- auth_strategy = keystone
- auth_type = password
- project_domain_name = Default
- project_name = service
- user_domain_name = Default
- username = nova
- password = openstack
- ...
- [DEFAULT]
- my_ip = 10.0.20.11
- ...
- [neutron]
- auth_url = http://controller:5000
- auth_type = password
- project_domain_name = default
- user_domain_name = default
- region_name = RegionOne
- project_name = service
- username = neutron
- password = openstack
- ...
- [glance]
- api_servers = http://controller:9292
- ...
- [oslo_concurrency]
- lock_path = /var/lib/nova/tmp
- ...
- [placement]
- region_name = RegionOne
- project_domain_name = Default
- project_name = service
- auth_type = password
- user_domain_name = Default
- auth_url = http://controller:5000/v3
- username = placement
- password = openstack
-
1、检查计算节点(compute node)是否支持硬件虚拟化,返回1或者大于1,则支持;返回0则不支持:
- root@compute1:~# egrep -c '(vmx|svm)' /proc/cpuinfo
- 8
2、重启compute service:
- root@compute1:~# service nova-compute restart
-
- root@compute1:~# systemctl status nova-compute
- ● nova-compute.service - OpenStack Compute
- Loaded: loaded (/lib/systemd/system/nova-compute.service; enabled; vendor preset: enabled)
- Active: active (running) since Sat 2024-08-03 12:09:38 UTC; 1min 13s ago
- Main PID: 1167 (nova-compute)
- Tasks: 23 (limit: 4514)
- Memory: 122.8M
- CPU: 1.924s
- CGroup: /system.slice/nova-compute.service
- └─1167 /usr/bin/python3 /usr/bin/nova-compute --config-file=/etc/nova/nova.conf --config-file=/etc/nova/nova-compute.conf --log-file=/var
- /log/nova/nova-compute.log
-
- Aug 03 12:09:38 compute1 systemd[1]: Started OpenStack Compute.
- Aug 03 12:09:38 compute1 nova-compute[1167]: Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urlli
- b3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- root@compute1:~#
1、以admin的凭证获取admin-only openstack CLI,查看数据库是否有compute host:
- root@controller ~(admin/amdin)# cat admin-openrc
- export OS_PROJECT_DOMAIN_NAME=Default
- export OS_USER_DOMAIN_NAME=Default
- export OS_PROJECT_NAME=admin
- export OS_USERNAME=admin
- export OS_PASSWORD=openstack
- export OS_AUTH_URL=http://controller:5000/v3
- export OS_IDENTITY_API_VERSION=3
- export OS_IMAGE_API_VERSION=2
- export PS1='\u@\h \W(admin/amdin)\$ '
- root@controller ~(admin/amdin)#
- root@controller:~# . admin-openrc
- root@controller ~(admin/amdin)# openstack compute service list --service nova-compute
- +--------------------------------------+--------------+----------+------+---------+-------+----------------------------+
- | ID | Binary | Host | Zone | Status | State | Updated At |
- +--------------------------------------+--------------+----------+------+---------+-------+----------------------------+
- | c04e53a4-fdb8-4915-9b1a-f5d195e753c4 | nova-compute | compute1 | nova | enabled | up | 2024-08-03T12:14:15.000000 |
- +--------------------------------------+--------------+----------+------+---------+-------+----------------------------+
2、Discover compute hosts:
- root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- Found 2 cell mappings.
- Skipping cell0 since it does not contain hosts.
- Getting computes from cell 'cell1': 8b1967df-7901-42b3-8b03-fc4e884f490d
- Checking host mapping for compute host 'compute1': 205c89e0-fb82-4def-a0f6-bfe4b120ab79
- Creating host mapping for compute host 'compute1': 205c89e0-fb82-4def-a0f6-bfe4b120ab79
- Found 1 unmapped computes in cell: 8b1967df-7901-42b3-8b03-fc4e884f490d
- root@controller:~#
-
- root@controller:~# nova-manage cell_v2 list_hosts --cell_uuid 8b1967df-7901-42b3-8b03-fc4e884f490d
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- +-----------+--------------------------------------+----------+
- | Cell Name | Cell UUID | Hostname |
- +-----------+--------------------------------------+----------+
- | cell1 | 8b1967df-7901-42b3-8b03-fc4e884f490d | compute1 |
- +-----------+--------------------------------------+----------+
- root@controller:~#
- root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- Found 2 cell mappings.
- Skipping cell0 since it does not contain hosts.
- Getting computes from cell 'cell1': 8b1967df-7901-42b3-8b03-fc4e884f490d
- Found 0 unmapped computes in cell: 8b1967df-7901-42b3-8b03-fc4e884f490d
- root@controller:~#
- root@controller:~# nova-manage cell_v2 list_hosts --cell_uuid 8b1967df-7901-42b3-8b03-fc4e884f490d
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- +-----------+--------------------------------------+----------+
- | Cell Name | Cell UUID | Hostname |
- +-----------+--------------------------------------+----------+
- | cell1 | 8b1967df-7901-42b3-8b03-fc4e884f490d | compute1 |
- +-----------+--------------------------------------+----------+
- root@controller:~#
当您添加新的计算节点时,您必须在控制节点上运行 nova-manage cell_v2 discover_hosts
命令来注册这些新的计算节点。
1、Source the admin
credentials to gain access to admin-only CLI commands:
- root@controller:~# . admin-openrc
- root@controller ~(admin/amdin)#
2、List service components to verify successful launch and registration of each process:
- root@controller ~(admin/amdin)# openstack compute service list
-
- +--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+
- | ID | Binary | Host | Zone | Status | State | Updated At |
- +--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+
- | b935d869-0102-45c0-8b24-e338c5606890 | nova-scheduler | controller | internal | enabled | up | 2024-08-03T12:36:55.000000 |
- | e4929b42-af08-449f-b703-c0fc36c4220b | nova-conductor | controller | internal | enabled | up | 2024-08-03T12:37:02.000000 |
- | c04e53a4-fdb8-4915-9b1a-f5d195e753c4 | nova-compute | compute1 | nova | enabled | up | 2024-08-03T12:36:56.000000 |
- +--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+
3、List API endpoints in the Identity service to verify connectivity with the Identity service:
- root@controller ~(admin/amdin)# openstack catalog list
- +-----------+-----------+-----------------------------------------+
- | Name | Type | Endpoints |
- +-----------+-----------+-----------------------------------------+
- | nova | compute | RegionOne |
- | | | public: http://controller:8774/v2.1 |
- | | | RegionOne |
- | | | internal: http://controller:8774/v2.1 |
- | | | RegionOne |
- | | | admin: http://controller:8774/v2.1 |
- | | | |
- | placement | placement | RegionOne |
- | | | internal: http://controller:8778 |
- | | | RegionOne |
- | | | admin: http://controller:8778 |
- | | | RegionOne |
- | | | public: http://controller:8778 |
- | | | |
- | keystone | identity | RegionOne |
- | | | admin: http://controller:5000/v3/ |
- | | | RegionOne |
- | | | internal: http://controller:5000/v3/ |
- | | | RegionOne |
- | | | public: http://controller:5000/v3/ |
- | | | |
- | glance | image | RegionOne |
- | | | admin: http://controller:9292 |
- | | | RegionOne |
- | | | internal: http://controller:9292 |
- | | | RegionOne |
- | | | public: http://controller:9292 |
- | | | |
- +-----------+-----------+-----------------------------------------+
- root@controller ~(admin/amdin)#
4、List images in the Image service to verify connectivity with the Image service:
- root@controller ~(admin/amdin)# openstack image list
- +--------------------------------------+--------+--------+
- | ID | Name | Status |
- +--------------------------------------+--------+--------+
- | 429decdd-9230-49c0-b735-70364c226eb5 | cirros | active |
- +--------------------------------------+--------+--------+
5、Check the cells and placement API are working successfully and that other necessary prerequisites are in place:
- root@controller ~(admin/amdin)# nova-status upgrade check
- Modules with known eventlet monkey patching issues were imported prior to eventlet monkey patching: urllib3. This warning can usually be ignored if the caller is only importing and not executing nova code.
- +-------------------------------------------+
- | Upgrade Check Results |
- +-------------------------------------------+
- | Check: Cells v2 |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- | Check: Placement API |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- | Check: Cinder API |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- | Check: Policy Scope-based Defaults |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- | Check: Policy File JSON to YAML Migration |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- | Check: Older than N-1 computes |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- | Check: hw_machine_type unset |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- | Check: Service User Token Configuration |
- | Result: Success |
- | Details: None |
- +-------------------------------------------+
- root@controller ~(admin/amdin)#
8、关闭虚机,拍摄快照
关闭controller node和compute node虚机,拍摄快照(可参考之前的章节)。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。