def _action(self, action, backup, info=None, **kwargs):
     """Perform a volume backup action."""
     body = {action: info}
     self.run_hooks('modify_body_for_action', body, **kwargs)
     url = '/backups/%s/action' % base.getid(backup)
     resp, body = self.api.client.post(url, body=body)
     return common_base.TupleWithMeta((resp, body), resp)
Beispiel #2
0
 def _action(self, action, snapshot, info=None, **kwargs):
     """Perform a snapshot action."""
     body = {action: info}
     self.run_hooks('modify_body_for_action', body, **kwargs)
     url = '/snapshots/%s/action' % base.getid(snapshot)
     resp, body = self.api.client.post(url, body=body)
     return common_base.TupleWithMeta((resp, body), resp)
 def test_tuple_with_meta(self):
     resp = create_response_obj_with_header()
     obj = common_base.TupleWithMeta((), resp)
     self.assertEqual((), obj)
     # Check request_ids attribute is added to obj
     self.assertTrue(hasattr(obj, 'request_ids'))
     self.assertEqual([REQUEST_ID], obj.request_ids)
 def _action(self, action, volume_type, info, **kwargs):
     """Perform a volume type action."""
     body = {action: info}
     self.run_hooks('modify_body_for_action', body, **kwargs)
     url = '/types/%s/action' % base.getid(volume_type)
     resp, body = self.api.client.post(url, body=body)
     return common_base.TupleWithMeta((resp, body), resp)
Beispiel #5
0
    def disassociate_all(self, qos_specs):
        """Disassociate all entities from specific qos specs.

        :param qos_specs: The qos specs to be associated with
        """
        resp, body = self.api.client.get("/qos-specs/%s/disassociate_all" %
                                         base.getid(qos_specs))
        return common_base.TupleWithMeta((resp, body), resp)
Beispiel #6
0
    def disassociate(self, qos_specs, vol_type_id):
        """Disassociate qos specs from volume type.

        :param qos_specs: The qos specs to be associated with
        :param vol_type_id: The volume type id to be associated with
        """
        resp, body = self.api.client.get(
            "/qos-specs/%s/disassociate?vol_type_id=%s" %
            (base.getid(qos_specs), vol_type_id))
        return common_base.TupleWithMeta((resp, body), resp)
    def delete(self, consistencygroup, force=False):
        """Delete a consistencygroup.

        :param Consistencygroup: The :class:`Consistencygroup` to delete.
        """
        body = {'consistencygroup': {'force': force}}
        self.run_hooks('modify_body_for_action', body, 'consistencygroup')
        url = '/consistencygroups/%s/delete' % base.getid(consistencygroup)
        resp, body = self.api.client.post(url, body=body)
        return common_base.TupleWithMeta((resp, body), resp)
    def delete(self, group, delete_volumes=False):
        """Delete a group.

        :param group: the :class:`Group` to delete.
        :param delete_volumes: delete volumes in the group.
        """
        body = {'delete': {'delete-volumes': delete_volumes}}
        self.run_hooks('modify_body_for_action', body, 'group')
        url = '/groups/%s/action' % base.getid(group)
        resp, body = self.api.client.post(url, body=body)
        return common_base.TupleWithMeta((resp, body), resp)
    def _action(self, action, group, info=None, **kwargs):
        """Perform a group "action."

        :param action: an action to be performed on the group
        :param group: a group to perform the action on
        :param info: details of the action
        :param **kwargs: other parameters
        """

        body = {action: info}
        self.run_hooks('modify_body_for_action', body, **kwargs)
        url = '/groups/%s/action' % base.getid(group)
        resp, body = self.api.client.post(url, body=body)
        return common_base.TupleWithMeta((resp, body), resp)
 def _delete(self, url):
     resp, body = self.api.client.delete(url)
     return common_base.TupleWithMeta((resp, body), resp)