問題1、創建share卷出錯,狀態爲error
1.1、問題現象
share卷的status字段爲error
# manila create NFS 1 --name share1
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| status | creating |
| share_type_name | default_share_type |
| description | None |
| availability_zone | None |
| share_network_id | None |
| share_server_id | None |
| share_group_id | None |
| host | |
| revert_to_snapshot_support | False |
| access_rules_status | active |
| snapshot_id | None |
| create_share_from_snapshot_support | False |
| is_public | False |
| task_state | None |
| snapshot_support | False |
| id | 0d370e78-79e2-4880-a5e9-7c13d63a1ea6 |
| size | 1 |
| source_share_group_snapshot_member_id | None |
| user_id | 4ab1c3f2bba04c169cf63a15da8ccc97 |
| name | share1 |
| share_type | 54f6bead-1254-47a9-bcf5-cb9b5e7424d2 |
| has_replicas | False |
| replication_type | None |
| created_at | 2020-04-29T16:41:24.000000 |
| share_proto | NFS |
| mount_snapshot_support | False |
| project_id | 23a40789342d4de6bc06d0b0bef7069c |
| metadata | {} |
+---------------------------------------+--------------------------------------+
# manila list
+--------------------------------------+--------+------+-------------+--------+-----------+--------------------+------+-------------------+
| ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone |
+--------------------------------------+--------+------+-------------+--------+-----------+--------------------+------+-------------------+
| 0d370e78-79e2-4880-a5e9-7c13d63a1ea6 | share1 | 1 | NFS | error | False | default_share_type | | None |
+--------------------------------------+--------+------+-------------+--------+-----------+--------------------+------+-------------------+
1.2、報錯日誌
日誌顯示,driver_handles_share_servers這個配置項沒有配置
# tail -f /var/log/manila/share.log
2020-04-29 10:59:55.179 144701 ERROR manila File "/usr/lib/python2.7/site-packages/oslo_utils/importutils.py", line 44, in import_object
2020-04-29 10:59:55.179 144701 ERROR manila return import_class(import_str)(*args, **kwargs)
2020-04-29 10:59:55.179 144701 ERROR manila File "/usr/lib/python2.7/site-packages/manila/share/drivers/generic.py", line 128, in __init__
2020-04-29 10:59:55.179 144701 ERROR manila [False, True], *args, **kwargs)
2020-04-29 10:59:55.179 144701 ERROR manila File "/usr/lib/python2.7/site-packages/manila/share/driver.py", line 280, in __init__
2020-04-29 10:59:55.179 144701 ERROR manila self._verify_share_server_handling(driver_handles_share_servers)
2020-04-29 10:59:55.179 144701 ERROR manila File "/usr/lib/python2.7/site-packages/manila/share/driver.py", line 327, in _verify_share_server_handling
2020-04-29 10:59:55.179 144701 ERROR manila self.driver_handles_share_servers)
2020-04-29 10:59:55.179 144701 ERROR manila ManilaException: Config opt 'driver_handles_share_servers' has improper value - 'None'. Please define it as boolean.
1.3、問題原因
openstack-manila-share會從/etc/manila/manila.conf的[lvm]段讀取配置項driver_handles_share_servers
一開始沒有在配置文件中增加[lvm]段,直接配置了[DEFAULT]段的driver_handles_share_servers
1.4、解決方法
在/etc/manila/manila.conf增加[lvm]段
重啓服務
# systemctl restart openstack-manila-share
問題2、lock path權限問題
2.1、問題現象
創建access時報錯
# manila access-allow share1 ip 192.168.100.223
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-1cd384af-f3d9-4196-b498-328f13a9a599)
2.2、出錯日誌
日誌顯示,api進程沒有訪問lock path目錄的權限
# tail -f /var/log/manila/api.log
2020-04-29 13:26:29.547 3338 ERROR manila.api.middleware.fault File "/usr/lib/python2.7/site-packages/fasteners/process_lock.py", line 37, in _ensure_tree
2020-04-29 13:26:29.547 3338 ERROR manila.api.middleware.fault os.makedirs(path)
2020-04-29 13:26:29.547 3338 ERROR manila.api.middleware.fault File "/usr/lib64/python2.7/os.py", line 150, in makedirs
2020-04-29 13:26:29.547 3338 ERROR manila.api.middleware.fault makedirs(head, mode)
2020-04-29 13:26:29.547 3338 ERROR manila.api.middleware.fault File "/usr/lib64/python2.7/os.py", line 157, in makedirs
2020-04-29 13:26:29.547 3338 ERROR manila.api.middleware.fault mkdir(name, mode)
2020-04-29 13:26:29.547 3338 ERROR manila.api.middleware.fault OSError: [Errno 13] Permission denied: '/var/lock/manila/tmp'
2.3、問題原因
手工部署時,不會自動創建/var/lock/manila/tmp目錄
2.4、解決方法
創建lock path目錄,賦予權限,並重啓服務
# makdir -p /var/lock/manila/tmp
# chown manila:manila /var/lock/manila/tmp
# systemctl restart openstack-manila-api.service
問題三、錯誤的access無法刪除
3.1、問題現象
問題2解決後,重新創建報記錄已經存在
# manila access-allow share1 ip 192.168.100.223
ERROR: Share access ip:192.168.100.223 exists. (HTTP 400) (Request-ID: req-f9de1a7a-7ba4-47d7-8ad4-f5256a5b1b9d)
# manila access-list share1
+--------------------------------------+-------------+-----------------+--------------+-----------------+------------+----------------------------+------------+
| id | access_type | access_to | access_level | state | access_key | created_at | updated_at |
+--------------------------------------+-------------+-----------------+--------------+-----------------+------------+----------------------------+------------+
| e7662348-08a0-4fb8-b4a2-cb18f5f7007f | ip | 192.168.100.223 | rw | queued_to_apply | None | 2020-04-29T17:26:29.000000 | None |
+--------------------------------------+-------------+-----------------+--------------+-----------------+------------+----------------------------+------------+
3.2、原因分析
沒有找到access-delete命令
使用access-deny命令後,access狀態變成error了
# manila access-deny share1 e7662348-08a0-4fb8-b4a2-cb18f5f7007f
# manila access-list share1
+--------------------------------------+-------------+-----------------+--------------+-------+------------+----------------------------+------------+
| id | access_type | access_to | access_level | state | access_key | created_at | updated_at |
+--------------------------------------+-------------+-----------------+--------------+-------+------------+----------------------------+------------+
| e7662348-08a0-4fb8-b4a2-cb18f5f7007f | ip | 192.168.100.223 | rw | error | None | 2020-04-29T17:26:29.000000 | None |
+--------------------------------------+-------------+-----------------+--------------+-------+------------+----------------------------+------------+
3.3、解決方法
似乎沒辦法,只能放大招了
# mysql -u root -p
connect manila;
MariaDB [manila]> show tables;
+--------------------------------------------+
| Tables_in_manila |
+--------------------------------------------+
| alembic_version |
| availability_zones |
| backend_info |
| drivers_private_data |
| messages |
| network_allocations |
| project_share_type_quotas |
| project_user_quotas |
| quota_classes |
| quota_usages |
| quotas |
| reservations |
| security_services |
| services |
| share_access_map |
| share_access_rules_metadata |
| share_group_share_type_mappings |
| share_group_snapshots |
| share_group_type_projects |
| share_group_type_share_type_mappings |
| share_group_type_specs |
| share_group_types |
| share_groups |
| share_instance_access_map |
| share_instance_export_locations |
| share_instance_export_locations_metadata |
| share_instances |
| share_metadata |
| share_network_security_service_association |
| share_network_subnets |
| share_networks |
| share_server_backend_details |
| share_servers |
| share_snapshot_access_map |
| share_snapshot_instance_access_map |
| share_snapshot_instance_export_locations |
| share_snapshot_instances |
| share_snapshots |
| share_type_extra_specs |
| share_type_projects |
| share_types |
| shares |
+--------------------------------------------+
42 rows in set (0.000 sec)
MariaDB [manila]> select * from share_access_map;
+---------------------+------------+------------+---------+--------------------------------------+--------------------------------------+-------------+-----------------+--------------+------------+
| created_at | updated_at | deleted_at | deleted | id | share_id | access_type | access_to | access_level | access_key |
+---------------------+------------+------------+---------+--------------------------------------+--------------------------------------+-------------+-----------------+--------------+------------+
| 2020-04-29 17:26:29 | NULL | NULL | False | e7662348-08a0-4fb8-b4a2-cb18f5f7007f | 5019146e-ebd3-43ae-b601-f34da23a00e3 | ip | 192.168.100.223 | rw | NULL |
+---------------------+------------+------------+---------+--------------------------------------+--------------------------------------+-------------+-----------------+--------------+------------+
1 row in set (0.000 sec)
刪除失敗,有外鍵關聯
MariaDB [manila]> delete from share_access_map where id=e7662348-08a0-4fb8-b4a2-cb18f5f7007f;
ERROR 1054 (42S22): Unknown column 'e7662348' in 'where clause'
MariaDB [manila]> delete from share_access_map where id="e7662348-08a0-4fb8-b4a2-cb18f5f7007f";
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`manila`.`share_instance_access_map`, CONSTRAINT `siam_access_fk` FOREIGN KEY (`access_id`) REFERENCES `share_access_map` (`id`))
刪除關聯表記錄
MariaDB [manila]> select * from share_instance_access_map;
+---------------------+---------------------+------------+---------+--------------------------------------+--------------------------------------+--------------------------------------+-------+
| created_at | updated_at | deleted_at | deleted | id | share_instance_id | access_id | state |
+---------------------+---------------------+------------+---------+--------------------------------------+--------------------------------------+--------------------------------------+-------+
| 2020-04-29 17:26:29 | 2020-04-30 09:21:41 | NULL | False | 11e35894-f6ad-4f0f-8370-84e2726f5fdb | 33d31ea0-7548-4d17-9f9b-267cfbb7802b | e7662348-08a0-4fb8-b4a2-cb18f5f7007f | error |
+---------------------+---------------------+------------+---------+--------------------------------------+--------------------------------------+--------------------------------------+-------+
1 row in set (0.000 sec)
# manila share-instance-list
+--------------------------------------+--------------------------------------+-----------------------------------+-----------+-------------------+------------------+-----------------+--------------------------------------+
| ID | Share ID | Host | Status | Availability Zone | Share Network ID | Share Server ID | Share Type ID |
+--------------------------------------+--------------------------------------+-----------------------------------+-----------+-------------------+------------------+-----------------+--------------------------------------+
| 33d31ea0-7548-4d17-9f9b-267cfbb7802b | 5019146e-ebd3-43ae-b601-f34da23a00e3 | openstack4k8s@lvm#lvm-single-pool | available | nova | None | None | e6876193-e743-43c3-968b-1af2a47f6f52 |
+--------------------------------------+--------------------------------------+-----------------------------------+-----------+-------------------+------------------+-----------------+--------------------------------------+
MariaDB [manila]> delete from share_instance_access_map where id = "11e35894-f6ad-4f0f-8370-84e2726f5fdb";
Query OK, 1 row affected (0.001 sec)
MariaDB [manila]> delete from share_access_map where id = "e7662348-08a0-4fb8-b4a2-cb18f5f7007f";
Query OK, 1 row affected (0.001 sec)
MariaDB [manila]> exit;
Bye
問題解決
# manila access-list share1;
+----+-------------+-----------+--------------+-------+------------+------------+------------+
| id | access_type | access_to | access_level | state | access_key | created_at | updated_at |
+----+-------------+-----------+--------------+-------+------------+------------+------------+
+----+-------------+-----------+--------------+-------+------------+------------+------------+
已經能正常創建access
# manila access-allow share1 ip 192.168.100.223
+--------------+--------------------------------------+
| Property | Value |
+--------------+--------------------------------------+
| access_key | None |
| share_id | 5019146e-ebd3-43ae-b601-f34da23a00e3 |
| created_at | 2020-04-30T09:34:47.000000 |
| updated_at | None |
| access_type | ip |
| access_to | 192.168.100.223 |
| access_level | rw |
| state | queued_to_apply |
| id | 8c472737-f2b2-4de3-b78f-ba9c049e3c2e |
| metadata | {} |
+--------------+--------------------------------------+