当前位置: 首页>>代码示例>>Python>>正文


Python Snapshot.snapshot_query方法代码示例

本文整理汇总了Python中snapshot.Snapshot.snapshot_query方法的典型用法代码示例。如果您正苦于以下问题:Python Snapshot.snapshot_query方法的具体用法?Python Snapshot.snapshot_query怎么用?Python Snapshot.snapshot_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在snapshot.Snapshot的用法示例。


在下文中一共展示了Snapshot.snapshot_query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: exportgroup_remove_volumes_by_uri

# 需要导入模块: from snapshot import Snapshot [as 别名]
# 或者: from snapshot.Snapshot import snapshot_query [as 别名]
    def exportgroup_remove_volumes_by_uri(
        self, exportgroup_uri, volumeIdList, sync=False, tenantname=None, projectname=None, snapshots=None, cg=None
    ):
        # if snapshot given then snapshot added to exportgroup
        volume_snapshots = volumeIdList
        if snapshots:
            resuri = None
            if cg:
                blockTypeName = "consistency-groups"
                from consistencygroup import ConsistencyGroup

                cgObject = ConsistencyGroup(self.__ipAddr, self.__port)
                resuri = cgObject.consistencygroup_query(cg, projectname, tenantname)
            else:
                blockTypeName = "volumes"
                if len(volumeIdList) > 0:
                    resuri = volumeIdList[0]
            volume_snapshots = []
            snapshotObject = Snapshot(self.__ipAddr, self.__port)
            for snapshot in snapshots:
                volume_snapshots.append(snapshotObject.snapshot_query("block", blockTypeName, resuri, snapshot))

        parms = {}

        parms["volume_changes"] = self._remove_list(volume_snapshots)
        o = self.send_json_request(exportgroup_uri, parms)
        return self.check_for_sync(o, sync)

        # initator
        """
开发者ID:blueranger,项目名称:coprhd-controller,代码行数:32,代码来源:exportgroup.py

示例2: _get_resource_lun_tuple

# 需要导入模块: from snapshot import Snapshot [as 别名]
# 或者: from snapshot.Snapshot import snapshot_query [as 别名]
    def _get_resource_lun_tuple(self, resources, resType, baseResUri, tenantname, projectname, blockTypeName):
        copyEntries = []
        snapshotObject = Snapshot(self.__ipAddr, self.__port)
        volumeObject = Volume(self.__ipAddr, self.__port)
        for copy in resources:
            copyParam = []
            try:
                copyParam = copy.split(":")
            except Exception as e:
                raise SOSError(
                    SOSError.CMD_LINE_ERR, "Please provide valid format volume: lun for parameter " + resType
                )
            copy = dict()
            if not len(copyParam):
                raise SOSError(SOSError.CMD_LINE_ERR, "Please provide atleast volume for parameter " + resType)
            if resType == "volumes":
                fullvolname = tenantname + "/" + projectname + "/"
                fullvolname += copyParam[0]
                copy["id"] = volumeObject.volume_query(fullvolname)
            if resType == "snapshots":
                copy["id"] = snapshotObject.snapshot_query("block", blockTypeName, baseResUri, copyParam[0])
            if len(copyParam) > 1:
                copy["lun"] = copyParam[1]
            copyEntries.append(copy)
        return copyEntries

        """
开发者ID:blueranger,项目名称:coprhd-controller,代码行数:29,代码来源:exportgroup.py


注:本文中的snapshot.Snapshot.snapshot_query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。