本文整理汇总了Python中manilaclient.openstack.common.apiclient.base.getid函数的典型用法代码示例。如果您正苦于以下问题:Python getid函数的具体用法?Python getid怎么用?Python getid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
def create(self, share_proto, size, snapshot_id=None, name=None,
description=None, metadata=None, share_network=None,
share_type=None, is_public=False, availability_zone=None,
consistency_group_id=None):
"""Create a share.
:param share_proto: text - share protocol for new share
available values are NFS, CIFS, GlusterFS and HDFS.
:param size: int - size in GiB
:param snapshot_id: text - ID of the snapshot
:param name: text - name of new share
:param description: text - description of a share
:param metadata: dict - optional metadata to set on share creation
:param share_network: either instance of ShareNetwork or text with ID
:param share_type: either instance of ShareType or text with ID
:param is_public: bool, whether to set share as public or not.
:param consistency_group_id: text - ID of the consistency group to
which the share should belong
:rtype: :class:`Share`
"""
share_metadata = metadata if metadata is not None else dict()
body = {
'size': size,
'snapshot_id': snapshot_id,
'name': name,
'description': description,
'metadata': share_metadata,
'share_proto': share_proto,
'share_network_id': common_base.getid(share_network),
'share_type': common_base.getid(share_type),
'is_public': is_public,
'availability_zone': availability_zone,
'consistency_group_id': consistency_group_id,
}
return self._create('/shares', {'share': body}, 'share')
示例2: create
def create(self, share_network=None, name=None, description=None,
source_cgsnapshot_id=None, share_types=None):
"""Create a Consistency Group.
:param share_network: either the share network object or text of the
uuid - represents the share network to use when creating a
consistency group with multi-svm capabilities.
:param name: text - name of the new consistency group
:param description: text - description of the consistency group
:param source_cgsnapshot_id: text - The uuid of the cgsnapshot from
which this CG was created. Cannot be supplied when 'share_types'
is provided.
:param share_types: List of the share types that shares in the CG are
allowed to be a part of. Cannot be supplied when
'source_cgsnapshot_id' is provided.
:rtype: :class:`ConsistencyGroup`
"""
if share_types:
share_types = [common_base.getid(share_type)
for share_type in share_types]
body = {'name': name, 'description': description}
share_network_id = None
if share_network:
share_network_id = common_base.getid(share_network)
if share_network_id:
body['share_network_id'] = share_network_id
if source_cgsnapshot_id:
body['source_cgsnapshot_id'] = source_cgsnapshot_id
if share_types:
body['share_types'] = share_types
return self._create(RESOURCES_PATH,
{RESOURCE_NAME: body}, RESOURCE_NAME)
示例3: get
def get(self, share, export_location):
"""Get a share export location."""
share_id = common_base.getid(share)
export_location_id = common_base.getid(export_location)
return self._get(
"/shares/%(share_id)s/export_locations/%(export_location_id)s" % {
"share_id": share_id,
"export_location_id": export_location_id}, "export_location")
示例4: list
def list(self, share_type):
if share_type.is_public:
return None
return self._list(
'/types/%s/os-share-type-access' % common_base.getid(share_type),
'share_type_access')
示例5: unmanage
def unmanage(self, share):
"""Unmanage a share.
:param share: either share object or text with its ID.
"""
return self.api.client.post(
"/os-share-unmanage/%s/unmanage" % common_base.getid(share))
示例6: get_metadata
def get_metadata(self, share):
"""Get metadata of a share.
:param share: either share object or text with its ID.
"""
return self._get("/shares/%s/metadata" % common_base.getid(share),
"metadata")
示例7: get
def get(self, share):
"""Get a share.
:param share: either share object or text with its ID.
:rtype: :class:`Share`
"""
share_id = common_base.getid(share)
return self._get("/shares/%s" % share_id, "share")
示例8: get
def get(self, instance):
"""Get a share instance.
:param instance: either share object or text with its ID.
:rtype: :class:`ShareInstance`
"""
share_id = common_base.getid(instance)
return self._get("/share_instances/%s" % share_id, "share_instance")
示例9: get
def get(self, share_type="default"):
"""Get a specific share type.
:param share_type: The ID of the :class:`ShareType` to get.
:rtype: :class:`ShareType`
"""
return self._get("/types/%s" % common_base.getid(share_type),
"share_type")
示例10: get
def get(self, volume_type):
"""Get a specific volume type.
:param volume_type: The ID of the :class:`VolumeType` to get.
:rtype: :class:`VolumeType`
"""
return self._get("/types/%s" % common_base.getid(volume_type),
"volume_type")
示例11: get_keys
def get_keys(self):
"""Get extra specs from a volume type.
:param vol_type: The :class:`VolumeType` to get extra specs from
"""
_resp, body = self.manager.api.client.get(
"/types/%s/extra_specs" % common_base.getid(self))
return body["extra_specs"]
示例12: get
def get(self, replica):
"""Get a share replica.
:param replica: either replica object or its UUID.
:rtype: :class:`ShareReplica`
"""
replica_id = common_base.getid(replica)
return self._get(RESOURCE_PATH % replica_id, RESOURCE_NAME)
示例13: set_metadata
def set_metadata(self, share, metadata):
"""Set or update metadata for share.
:param share: either share object or text with its ID.
:param metadata: A list of keys to be set.
"""
body = {'metadata': metadata}
return self._create("/shares/%s/metadata" % common_base.getid(share),
body, "metadata")
示例14: get
def get(self, snapshot):
"""Get a snapshot.
:param snapshot: The :class:`ShareSnapshot` instance or string with ID
of snapshot to delete.
:rtype: :class:`ShareSnapshot`
"""
snapshot_id = common_base.getid(snapshot)
return self._get('/snapshots/%s' % snapshot_id, 'snapshot')
示例15: update_all_metadata
def update_all_metadata(self, share, metadata):
"""Update all metadata of a share.
:param share: either share object or text with its ID.
:param metadata: A list of keys to be updated.
"""
body = {'metadata': metadata}
return self._update("/shares/%s/metadata" % common_base.getid(share),
body)