管理存储后端
1 - 查询存储后端
执行以下命令获取查询后端帮助。
oceanctl get backend -h
执行以下命令查询默认命名空间下单个存储后端。
oceanctl get backend <backend-name>
执行以下命令查询指定命名空间下所有存储后端。
oceanctl get backend -n <namespace>
执行以下命令格式化输出,当前支持json,yaml和wide。
oceanctl get backend <backend-name> -o json
2 - 更新存储后端
- 当前使用oceanctl更新存储后端信息时,仅支持更新存储后端密码以及登录存储后端的认证模式。
- 若在存储侧更新了后端的账号密码,CSI插件会因登录失败而重试,可能会导致账号被锁定。如果账号被锁定,请参考 存储侧更新密码后账户被锁定 章节修改。
2.1 - 更新存储后端密码
获取更新后端帮助信息
执行以下命令获取更新存储后端帮助。
oceanctl update backend -h
命令结果示例如下:
Update a backend for Ocean Storage in Kubernetes Usage: oceanctl update backend <name> [flags] Examples: # Update backend account information in default(huawei-csi) namespace oceanctl update backend <name> --password # Update backend account information in specified namespace oceanctl update backend <name> -n namespace --password # Update backend account information with ldap authentication mode in default(huawei-csi) namespace oceanctl update backend <name> --password --authenticationMode=ldap # Update backend account information with local authentication mode in default(huawei-csi) namespace oceanctl update backend <name> --password --authenticationMode=local # Update backend account information with ldap authentication mode in specified namespace oceanctl update backend <name> -n namespace --password --authenticationMode=ldap Flags: --authenticationMode string Specify authentication mode -h, --help help for backend -n, --namespace string namespace of resources --password Update account password Global Flags: --log-dir string Specify the directory for printing log files. (default "/var/log/huawei")
更新后端密码示例
执行以下命令更新存储后端信息,其中backend-name为待更新后端名称。
oceanctl update backend backend-name --password
根据提示输入用户名和新密码:
Please enter this backend user name:admin Please enter this backend password: backend/backend-name updated
2.2 - 更新存储后端登陆认证模式
更新后端登录认证类型为LDAP示例
执行以下命令更新存储后端信息,其中backend-name为待更新后端名称。
oceanctl update backend backend-name --password --authenticationMode=ldap
根据提示输入用户名和新密码:
Please enter this backend user name:admin Please enter this backend password: backend/backend-name updated
2.3 - 更新存储后端信息
- PVC发放需要基于已配置的存储后端,因此当存储后端已经发放PVC时,请勿随便修改存储后端。
- 名称是存储后端的唯一标识,已发放PVC的存储后端不允许修改名称。
- 存储后端修改后,新增配置仅作用于新发放的卷。
- 存储后端修改期间,请勿执行卷管理操作。
操作步骤
3 - 删除存储后端
正在执行卷管理操作期间,请勿删除存储后端。
删除后端示例
执行以下命令获取存储后端。
oceanctl get backend
命令结果示例如下:
NAMESPACE NAME PROTOCOL STORAGETYPE SN STATUS ONLINE URL huawei-csi backend-1 roce oceanstor-san xxxxxxxxxxxxxxxxxxxx Bound true https://192.168.129.157:8088 huawei-csi backend-2 roce oceanstor-san xxxxxxxxxxxxxxxxxxxx Bound true https://192.168.129.158:8088
执行以下命令删除指定存储后端。
oceanctl delete backend backend-1
执行以下命令检查删除结果。
oceanctl get backend backend-1
命令结果示例如下,如果回显为“not found”则删除成功。
Error from server (NotFound): backend "backend-1" not found
4 - 添加存储后端证书
前提条件
完成证书制作。以OceanStor Dorado为例,证书制作过程请参考: 点此前往 。
创建证书示例
提前准备好证书文件,如cert.crt。
执行以下命令获取存储后端。
oceanctl get backend
命令结果示例如下:
NAMESPACE NAME PROTOCOL STORAGETYPE SN STATUS ONLINE URL huawei-csi backend-1 roce oceanstor-san xxxxxxxxxxxxxxxxxxxx Bound true https://192.168.129.157:8088 huawei-csi backend-2 roce oceanstor-san xxxxxxxxxxxxxxxxxxxx Bound true https://192.168.129.158:8088
执行以下命令为指定存储后端创建证书。
oceanctl create cert cert-1 -b backend-1 -f /path/to/cert.crt
检查证书创建结果。
oceanctl get cert -b backend-1
命令结果示例如下:
NAMESPACE NAME BOUNDBACKEND huawei-csi cert-1 backend-1
5 - 移除存储后端证书
操作步骤
执行以下命令获取存储后端。
oceanctl get backend
命令结果示例如下:
NAMESPACE NAME PROTOCOL STORAGETYPE SN STATUS ONLINE URL huawei-csi backend-1 roce oceanstor-san xxxxxxxxxxxxxxxxxxxx Bound true https://192.168.129.157:8088 huawei-csi backend-2 roce oceanstor-san xxxxxxxxxxxxxxxxxxxx Bound true https://192.168.129.158:8088
执行以下命令获取指定存储后端的证书。
oceanctl get cert -b backend-1
命令结果示例如下:
NAMESPACE NAME BOUNDBACKEND huawei-csi cert-1 backend-1
执行以下命令删除指定存储后端的证书。
oceanctl delete cert -b backend-1
检查删除结果。
oceanctl get cert -b backend-1
命令结果示例如下,如果回显为“no cert found”则删除成功。
Error from server (NotFound): no cert found on backend backend-1 in huawei-csi namespace