Пример #1
0
 def handle(self, request, data):
     replica_id = self.initial['replica_id']
     try:
         replica = manila.share_replica_get(self.request, replica_id)
         manila.share_replica_promote(request, replica)
         message = _('Setting replica "%s" as active...') % replica_id
         messages.success(request, message)
         return True
     except Exception:
         redirect = reverse("horizon:project:shares:index")
         exceptions.handle(request,
                           _("Unable to set replica '%s' as active.") %
                           replica_id,
                           redirect=redirect)
Пример #2
0
 def handle(self, request, data):
     replica_id = self.initial['replica_id']
     try:
         replica = manila.share_replica_get(self.request, replica_id)
         manila.share_replica_promote(request, replica)
         message = _('Setting replica "%s" as active...') % replica_id
         messages.success(request, message)
         return True
     except Exception:
         redirect = reverse("horizon:project:shares:index")
         exceptions.handle(
             request,
             _("Unable to set replica '%s' as active.") % replica_id,
             redirect=redirect)
Пример #3
0
    def test_share_replica_promote(self):
        api.share_replica_promote(self.request, "fake")

        self.manilaclient.share_replicas.promote.assert_called_once_with(
            "fake")
Пример #4
0
    def test_share_replica_promote(self):
        api.share_replica_promote(self.request, "fake")

        self.manilaclient.share_replicas.promote.assert_called_once_with(
            "fake")