def list_volumes(namespace): """ List the volumes in a pool. """ proxy = get_object(TOP_OBJECT) pool_object = get_pool(proxy, namespace.pool) (result, rc, message) = Pool.ListFilesystems(pool_object) if rc != StratisdErrorsGen().get_object().OK: raise StratisCliRuntimeError(rc, message) for item in result: print(item) return
def testDestroyOne(self): """ Test calling with a non-existant volume name. This should succeed, because at the end the volume is not there. """ (result, rc, _) = checked_call( Pool.DestroyFilesystems(self._pool_object, names=['name']), PoolSpec.OUTPUT_SIGS[_PN.DestroyFilesystems]) self.assertEqual(len(result), 1) self.assertEqual(rc, self._errors.OK) (result, rc, _) = checked_call(Pool.ListFilesystems(self._pool_object), PoolSpec.OUTPUT_SIGS[_PN.ListFilesystems]) self.assertEqual(rc, self._errors.OK) self.assertEqual(len(result), 0)
def testDestroyNone(self): """ Test calling with no actual volume specification. An empty volume list should always succeed, and it should not decrease the number of volumes. """ (result, rc, _) = checked_call( Pool.DestroyFilesystems(self._pool_object, names=[]), PoolSpec.OUTPUT_SIGS[_PN.DestroyFilesystems]) self.assertEqual(len(result), 0) self.assertEqual(rc, self._errors.OK) (result, rc, _) = checked_call(Pool.ListFilesystems(self._pool_object), PoolSpec.OUTPUT_SIGS[_PN.ListFilesystems]) self.assertEqual(rc, self._errors.OK) self.assertEqual(len(result), 0)
def testDestroy(self): """ Test calling by specifying the volume name. Assume that destruction should always succeed. """ (result, rc, _) = checked_call( Pool.DestroyFilesystems(self._pool_object, names=[self._VOLNAME]), PoolSpec.OUTPUT_SIGS[_PN.DestroyFilesystems]) self.assertEqual(len(result), 1) self.assertEqual(rc, self._errors.OK) (rc, _) = result[0] self.assertEqual(rc, self._errors.OK) (result, rc, _) = checked_call(Pool.ListFilesystems(self._pool_object), PoolSpec.OUTPUT_SIGS[_PN.ListFilesystems]) self.assertEqual(rc, self._errors.OK) self.assertEqual(len(result), 0)