def test_getid(self): self.assertEqual(4, base.getid(4)) class TmpObject(object): id = 4 self.assertEqual(4, base.getid(TmpObject))
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))
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)
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)
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)
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))
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
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")
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")
def delete(self, id): """ Delete storage pool for a given id """ self._delete("/pools/%s" % base.getid(id))
def get_config_keys(self): _resp, body = self.manager.api.client.get( "/backends/%s/config_specs" % base.getid(self)) return body["config_specs"]
def get_capability_keys(self): _resp, body = self.manager.api.client.get( "/tiers/%s/capability_specs" % base.getid(self)) return body["capability_specs"]