本文整理汇总了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
"""
示例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
"""