Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 创建硬盘时 【指定虚拟机】展示的列表不全 #20279

Open
G-red opened this issue May 15, 2024 · 1 comment
Open

[BUG] 创建硬盘时 【指定虚拟机】展示的列表不全 #20279

G-red opened this issue May 15, 2024 · 1 comment
Assignees
Labels

Comments

@G-red
Copy link

G-red commented May 15, 2024

问题描述/What happened:
创建硬盘时,【指定虚拟机】展示的列表不全
原因为 hosts_tbl 中 storage_type 字段为空,和该 host 对应的 storages_tbl 中的 medium_type 对应不上,
这块的数据同步存在问题?

环境/Environment:
cloudpods 版本 3.10.10
管理节点:
192.168.4.244
计算节点:
192.168.4.241
192.168.4.242
192.168.4.243

问题排查过程

  1. 页面向后台发起的请求为:
    /api/v2/hosts?scope=system&show_fail_reason=true&details=false&baremetal=false&limit=0&brand=OneCloud&storage_type=rotate
    返回的数据没有 4.243 的记录

  2. 在数据库查看 hosts 数据,发现存在 storage_type 为空字符串的情况
    MariaDB [yunioncloud]> SELECT hs.id, hs.hostname, hs.storage_type FROM yunioncloud.hosts_tbl hs WHERE hs.deleted = 0;
    +--------------------------------------+----------------------------+--------------+
    | id | hostname | storage_type |
    +--------------------------------------+----------------------------+--------------+
    | 165cd919-aba7-447b-86e1-284425a0fdf2 | cloudpods244-192-168-4-244 | rotate |
    | 1e34c707-811b-41fd-8caf-9619ca784710 | cloudpods242-192-168-4-242 | rotate |
    | 6da168b7-0c08-42a0-8b5b-f1a9947bb9d3 | cloudpods243-192-168-4-243 | |
    | b6a26660-69bc-4d65-836d-bc08c5964461 | physical-host | rotate |
    | f529aa4e-0b16-4000-882a-de48dee9f1a5 | cloudpods241-192-168-4-241 | rotate |
    +--------------------------------------+----------------------------+--------------+

  3. 进入宿主机页面查看 4.243 存储信息,展示为机械盘
    /api/v2/storages?scope=system&show_fail_reason=true&details=false&with_meta=true&host_id=6da168b7-0c08-42a0-8b5b-f1a9947bb9d3&limit=20&is_baremetal=false
    返回内容中 "medium_type":"rotate",

  4. 在数据库中查看相关信息
    MariaDB [(none)]> SELECT st.id , st.medium_type FROM yunioncloud.storages_tbl st left join yunioncloud.hoststorages_tbl ht on st.id = ht.storage_id WHERE ht.host_id = '6da168b7-0c08-42a0-8b5b-f1a9947bb9d3';
    +--------------------------------------+-------------+
    | id | medium_type |
    +--------------------------------------+-------------+
    | 04cf7e7a-2dff-4ff5-8922-c71d1fa7666e | rotate |
    +--------------------------------------+-------------+

@G-red G-red added the bug Something isn't working label May 15, 2024
@wanyaoqi
Copy link
Member

wanyaoqi commented Jun 6, 2024

@G-red
hostinfo中的medium type 是通过sysfs /sys/class/block 中的块设备对应的 queue/rotational 属性探测的,具体可以看:

func DetectStorageType() (string, error) {

可以看下你的环境是否能通过 sysfs读取到 medium type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants