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


Python manila.share_get函数代码示例

本文整理汇总了Python中manila_ui.api.manila.share_get函数的典型用法代码示例。如果您正苦于以下问题:Python share_get函数的具体用法?Python share_get怎么用?Python share_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: delete

 def delete(self, request, obj_id):
     share = manila.share_get(request, obj_id)
     try:
         manila.share_delete(
             request, share.id, share_group_id=share.share_group_id)
     except Exception:
         msg = _('Unable to delete share "%s". ') % obj_id
         messages.error(request, msg)
开发者ID:openstack,项目名称:manila-ui,代码行数:8,代码来源:tables.py

示例2: get_data

 def get_data(self):
     try:
         share_id = self.kwargs['share_id']
         share = manila.share_get(self.request, share_id)
     except Exception:
         exceptions.handle(
             self.request, _('Unable to retrieve volume details.'),
             redirect=self.success_url)
     return share
开发者ID:ajarr,项目名称:manila-ui,代码行数:9,代码来源:views.py

示例3: get_context_data

 def get_context_data(self, **kwargs):
     context = super(ManageRulesView, self).get_context_data(**kwargs)
     share = manila.share_get(self.request, self.kwargs['share_id'])
     context['share_display_name'] = share.name or share.id
     context["share"] = self.get_data()
     context["page_title"] = _("Share Rules: "
                               "%(share_display_name)s") % {
         'share_display_name': context['share_display_name']}
     return context
开发者ID:openstack,项目名称:manila-ui,代码行数:9,代码来源:views.py

示例4: get_object

 def get_object(self):
     if not hasattr(self, "_object"):
         vol_id = self.kwargs['share_id']
         try:
             self._object = manila.share_get(self.request, vol_id)
         except Exception:
             msg = _('Unable to retrieve share.')
             url = reverse('horizon:project:shares:index')
             exceptions.handle(self.request, msg, redirect=url)
     return self._object
开发者ID:openstack,项目名称:manila-ui,代码行数:10,代码来源:views.py

示例5: get_data

 def get_data(self):
     try:
         share_id = self.kwargs['share_id']
         share = manila.share_get(self.request, share_id)
         share.rules = manila.share_rules_list(self.request, share_id)
     except Exception:
         redirect = reverse('horizon:project:shares:index')
         exceptions.handle(self.request,
                           _('Unable to retrieve share details.'),
                           redirect=redirect)
     return share
开发者ID:jcsp,项目名称:manila-ui,代码行数:11,代码来源:views.py

示例6: get_data

 def get_data(self):
     try:
         snapshot_id = self.kwargs['snapshot_id']
         snapshot = manila.share_snapshot_get(self.request, snapshot_id)
         share = manila.share_get(self.request, snapshot.share_id)
         snapshot.share_name_or_id = share.name or share.id
     except Exception:
         exceptions.handle(self.request,
                           _('Unable to retrieve snapshot details.'),
                           redirect=self.redirect_url)
     return snapshot
开发者ID:vponomaryov,项目名称:manila-ui,代码行数:11,代码来源:views.py

示例7: get_data

 def get_data(self):
     try:
         snapshot_id = self.kwargs['snapshot_id']
         snapshot = manila.share_snapshot_get(self.request, snapshot_id)
         share = manila.share_get(self.request, snapshot.share_id)
         snapshot.share_name_or_id = share.name or share.id
     except Exception:
         redirect = reverse('horizon:project:shares:index')
         exceptions.handle(self.request,
                           _('Unable to retrieve snapshot details.'),
                           redirect=redirect)
     return snapshot
开发者ID:bswartz,项目名称:manila-ui,代码行数:12,代码来源:views.py

示例8: get_data

    def get_data(self, request, share_id):
        share = manila.share_get(request, share_id)
        if not share.name:
            share.name = share_id
        if share.share_network_id:
            share_net = manila.share_network_get(request,
                                                 share.share_network_id)
            share.share_network = share_net.name or share_net.id
        else:
            share.share_network = None
        share.metadata = utils.metadata_to_str(share.metadata)

        return share
开发者ID:openstack,项目名称:manila-ui,代码行数:13,代码来源:tables.py

示例9: allowed

 def allowed(self, request, replica=None):
     if replica:
         share = manila.share_get(request, replica.share_id)
         replicas = manila.share_replica_list(request, replica.share_id)
         if share.replication_type is None:
             return False
         elif (share.replication_type is 'writable' and
               replica.status in DELETABLE_STATUSES and
               len(replicas) > 1) or (
                   share.replication_type in ('dr', 'readable') and
                   replica.status in DELETABLE_STATUSES and
                   replica.replica_state != 'active'):
             return True
     return False
开发者ID:openstack,项目名称:manila-ui,代码行数:14,代码来源:tables.py

示例10: handle

 def handle(self, request, data):
     share_id = self.initial['share_id']
     try:
         share = manila.share_get(self.request, share_id)
         manila.share_extend(
             request, share.id, data['new_size'])
         message = _('Extend share "%s"') % data['name']
         messages.success(request, message)
         return True
     except Exception:
         redirect = reverse("horizon:project:shares:index")
         exceptions.handle(request,
                           _('Unable to extend share.'),
                           redirect=redirect)
开发者ID:ajarr,项目名称:manila-ui,代码行数:14,代码来源:forms.py

示例11: get_context_data

 def get_context_data(self, **kwargs):
     context = super(ManageReplicasView, self).get_context_data(**kwargs)
     try:
         share = manila.share_get(self.request, self.kwargs["share_id"])
     except Exception:
         redirect = reverse(self._redirect_url)
         exceptions.handle(
             self.request,
             _('Unable to retrieve share. %s') % self.kwargs["share_id"],
             redirect=redirect)
     context["share_display_name"] = share.name or share.id
     context["share"] = self.get_data()
     context["page_title"] = _(
         "Share Replicas: %(share_display_name)s") % {
             "share_display_name": context["share_display_name"]}
     return context
开发者ID:openstack,项目名称:manila-ui,代码行数:16,代码来源:views.py

示例12: get_context_data

 def get_context_data(self, **kwargs):
     context = super(CreateSnapshotView, self).get_context_data(**kwargs)
     context['share_id'] = self.kwargs['share_id']
     try:
         share = manila.share_get(self.request, context['share_id'])
         if (share.status == 'in-use'):
             context['attached'] = True
             context['form'].set_warning(_("This share is currently "
                                           "attached to an instance. "
                                           "In some cases, creating a "
                                           "snapshot from an attached "
                                           "share can result in a "
                                           "corrupted snapshot."))
         context['usages'] = quotas.tenant_limit_usages(self.request)
     except Exception:
         exceptions.handle(self.request,
                           _('Unable to retrieve share information.'))
     return context
开发者ID:bswartz,项目名称:manila-ui,代码行数:18,代码来源:views.py

示例13: handle

    def handle(self, request, data):
        try:
            share = manila.share_get(request, data['share_id'])
            force = False
            message = _('Creating share snapshot "%s".') % data['name']
            if share.status == 'in-use':
                force = True
                message = _('Forcing to create snapshot "%s" '
                            'from attached share.') % data['name']
            snapshot = manila.share_snapshot_create(request,
                                                    data['share_id'],
                                                    data['name'],
                                                    data['description'],
                                                    force=force)

            messages.success(request, message)
            return snapshot
        except Exception:
            redirect = reverse("horizon:project:shares:index")
            exceptions.handle(request,
                              _('Unable to create share snapshot.'),
                              redirect=redirect)
开发者ID:ajarr,项目名称:manila-ui,代码行数:22,代码来源:forms.py

示例14: get_data

    def get_data(self):
        try:
            snapshot_id = self.kwargs['snapshot_id']
            snapshot = manila.share_snapshot_get(self.request, snapshot_id)
            share = manila.share_get(self.request, snapshot.share_id)
            if share.mount_snapshot_support:
                snapshot.rules = manila.share_snapshot_rules_list(
                    self.request, snapshot_id)
                snapshot.export_locations = (
                    manila.share_snap_export_location_list(
                        self.request, snapshot))
                export_locations = [
                    exp['path'] for exp in snapshot.export_locations
                ]
                snapshot.el_size = ui_utils.calculate_longest_str_size(
                    export_locations)

            snapshot.share_name_or_id = share.name or share.id
        except Exception:
            exceptions.handle(
                self.request,
                _('Unable to retrieve snapshot details.'),
                redirect=self.redirect_url)
        return snapshot
开发者ID:openstack,项目名称:manila-ui,代码行数:24,代码来源:views.py

示例15: allowed

 def allowed(self, request, share=None):
     share = manila.share_get(request, self.table.kwargs['share_id'])
     return share.status in ("available", "in-use")
开发者ID:jcsp,项目名称:manila-ui,代码行数:3,代码来源:tables.py


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