使用REST API的Dell SC任务自动化
ucamdsm的Python项目详细描述
戴尔SC
简介
通过REST API与Dell SCs交互。在
该项目提供一个命令行界面(CLI),用于连接到Dell Storage Manager并运行基本操作,例如获取卷、服务器、快照的列表。它是Shell中已开发功能的重新实现,用于克隆和回收卷,并处理文件系统设备(mount、unmount、update multipath、update fstab)等。最初的Shell实现在Git存储库https://git.uis.cam.ac.uk/i/uis/infra/dellsc.git上。在
运行应用程序
先决条件
安装
作为root
,运行:
pip3 install ucamdsm
CLI
例如,要显示命令帮助:
^{pr2}$或者,要获取Storage Center的列表:
$ ucamdsm --dsm_host host --dsm_user user --dsm_password password list --object scs --output json 07/10/2019 04:24:32 PM INFO Connected to DSM. API Version: 3.5, Connection ID: 007/10/2019 04:24:32 PM INFO API call ApiConnection/ApiConnection/0/StorageCenterList succeeded. 07/10/2019 04:24:32 PM INFO List of scs: {"SB Storage Center": {"instanceId": "000", "hostOrIP": "x.x.x.x"}, "WCDC Storage Center": {"instanceId": "000", "hostOrIP": "y.y.y.y"}}07/10/2019 04:24:32 PM INFO Logout of DSM: True.
如果命令中未指定user
和password
,则会提示您输入它们。在
$ ucamdsm --dsm_host host list --object scs --output json Username: user Password: 07/16/2019 04:59:53 PM INFO Connected to DSM. API Version: 3.5, Connection ID: 007/16/2019 04:59:53 PM INFO API call ApiConnection/ApiConnection/0/StorageCenterList succeeded. 07/16/2019 04:59:53 PM INFO List of scs: {"SB Storage Center": {"instanceId": "000", "hostOrIP": "x.x.x.x"}, "WCDC Storage Center": {"instanceId": "000", "hostOrIP": "y.y.y.y"}}07/16/2019 04:59:53 PM INFO Logout of DSM: True.
该命令还可以从json
文件中读取参数。在
{cd6> 要从 与使用CLI执行的任务相关的所有日志文件都存储在 标签:{"dsm_host": "abc",
"dsm_port": 3033,
"dsm_user": "user",
"dsm_password": "password",
"is_secure": false,
"record_config": false,
"subparser": "list",
"object": "scs",
"output": "json"}
args.json
读取参数:$ ucamdsm --file args.json
07/16/2019 05:05:57 PM INFO Connected to DSM. API Version: 3.5, Connection ID: 007/16/2019 05:05:58 PM INFO API call ApiConnection/ApiConnection/0/StorageCenterList succeeded.
07/16/2019 05:05:58 PM INFO List of scs:
{"SB Storage Center": {"instanceId": "000",
"hostOrIP": "x.x.x.x"},
"WCDC Storage Center": {"instanceId": "000",
"hostOrIP": "y.y.y.y"}}07/16/2019 05:05:58 PM INFO Logout of DSM: True.
应用程序日志
/var/log/ucamdsm/
中。在致谢
推荐PyPI第三方库