Beispiel #1
0
    def test_getid(self):
        self.assertEqual(4, base.getid(4))

        class TmpObject(object):
            id = 4

        self.assertEqual(4, base.getid(TmpObject))
Beispiel #2
0
    def delete(self, storage_backend):
        """
        Delete a specific storage_backend.

        :param storage_backend: The ID of the :class:`StorageBackend` to get.
        """
        self._delete("/backends/%s" % base.getid(storage_backend))
Beispiel #3
0
 def set_config_keys(self, metadata):
     body = {'config_specs': metadata}
     return self.manager._create(
         "/backends/%s/config_specs" % base.getid(self),
         body,
         "config_specs",
         return_raw=True)
Beispiel #4
0
 def create_storage_tiers(self, metadata):
     body = {'storage_tier': metadata}
     return self.manager._create(
         "/backends/%s/tiers" % base.getid(self),
         body,
         "storage_tier",
         return_raw=True)
Beispiel #5
0
 def set_capability_keys(self, metadata):
     body = {'capability_specs': metadata}
     return self.manager._create(
         "/tiers/%s/capability_specs" % base.getid(self),
         body,
         "capability_specs",
         return_raw=True)
Beispiel #6
0
    def delete(self, storage_tier):
        """
        Delete a specific storage tier.

        :param storage_tier: The ID of the :class:`StorageTier` to get.
        """
        self._delete("/tiers/%s" % base.getid(storage_tier))
Beispiel #7
0
 def delete_capability_keys(self, keys):
     resp = None
     for k in keys:
         resp = self.manager._delete(
             "/backends/%s/capability_specs/%s" % (
             base.getid(self), k))
         if resp is not None:
             return resp
Beispiel #8
0
    def get(self, storage_backend):
        """
        Get a specific storage backend.

        :param storage_backend: The ID of the :class:`StorageBackend` to get.
        :rtype: :class:`StorageBackend`
        """
        return self._get("/backends/%s" % base.getid(storage_backend), "storage_backend")
Beispiel #9
0
    def get(self, storage_tier):
        """
        Get a specific storage tier.

        :param storage_tier: The ID of the :class:`StorageTier` to get.
        :rtype: :class:`StorageTier`
        """
        return self._get("/tiers/%s" % base.getid(storage_tier), "storage_tier")
Beispiel #10
0
 def delete(self, id):
     """
     Delete storage pool for a given id
     """
     self._delete("/pools/%s" % base.getid(id))
Beispiel #11
0
 def get_config_keys(self):
     _resp, body = self.manager.api.client.get(
         "/backends/%s/config_specs" %
         base.getid(self))
     return body["config_specs"]
Beispiel #12
0
 def get_capability_keys(self):
     _resp, body = self.manager.api.client.get(
         "/tiers/%s/capability_specs" %
         base.getid(self))
     return body["capability_specs"]