使用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.

如果命令中未指定userpassword,则会提示您输入它们。在

$ 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>

{"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.

应用程序日志

与使用CLI执行的任务相关的所有日志文件都存储在/var/log/ucamdsm/中。在

致谢

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
JavaHTTP。请求侦听器   java Selenium webdriver遍历行并仅检索某些列   JavaSpring批处理在启动运行方法之前启动SimpleZoblancher运行方法   maven如何使用Maven2从javadoc生成java源代码?   java为什么我的Unicodont(Slick2D)不画画?   java取消对未使用对象的引用是否会提高冗长方法的性能?   java可执行Jar的画布比使用Eclipse Runner的小   为什么我的for循环在Android studio中与eclipse(java)产生不同的结果   java代码段字节数组到端口号   java在DynamoDB范围键中插入项   java 安卓。看法WindowManager$BadTokenException:无法添加窗口,您的活动正在运行吗?   java我想要两个列表视图同时滚动   java测试数据分离   java Saxon:每次重新部署后都需要重新启动Glassfish