def testDestroyOne(self): """ Test calling with a non-existant object path. This should succeed, because at the end the filesystem is not there. """ (result, rc, _) = checked_call( Pool.DestroyFilesystems(self._pool_object, filesystems=['/']), PoolSpec.OUTPUT_SIGS[_PN.DestroyFilesystems] ) self.assertEqual(rc, self._errors.OK) self.assertEqual(len(result), 0) result = [x for x in get_managed_objects(self._proxy).filesystems()] self.assertEqual(len(result), 0)
def destroy_volumes(namespace): """ Destroy volumes in a pool. :raises StratisCliRuntimeError: """ proxy = get_object(TOP_OBJECT) pool_object = get_pool(proxy, namespace.pool) (_, rc, message) = \ Pool.DestroyFilesystems(pool_object, names=namespace.volume) if rc != StratisdErrorsGen().get_object().OK: raise StratisCliRuntimeError(rc, message) 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, filesystems=[]), PoolSpec.OUTPUT_SIGS[_PN.DestroyFilesystems] ) self.assertEqual(len(result), 0) self.assertEqual(rc, self._errors.OK) result = [x for x in get_managed_objects(self._proxy).filesystems()] self.assertEqual(len(result), 0)
def testDestroyOne(self): """ Test calling by specifying the object path. Assume that destruction should always succeed. """ fs_object_path = self._filesystems[0][0] (result, rc, _) = checked_call( Pool.DestroyFilesystems( self._pool_object, filesystems=[fs_object_path] ), PoolSpec.OUTPUT_SIGS[_PN.DestroyFilesystems] ) self.assertEqual(len(result), 1) self.assertEqual(rc, self._errors.OK) result = [x for x in get_managed_objects(self._proxy).filesystems()] self.assertEqual(len(result), 0)
def testDestroyTwo(self): """ Test calling by specifying one existing volume name and one non-existing. Should succeed, but only the existing name should be returned. """ fs_object_path = self._filesystems[0][0] (result, rc, _) = checked_call( Pool.DestroyFilesystems( self._pool_object, filesystems=[fs_object_path, "/"] ), PoolSpec.OUTPUT_SIGS[_PN.DestroyFilesystems] ) self.assertEqual(len(result), 1) self.assertEqual(rc, self._errors.OK) result = [x for x in get_managed_objects(self._proxy).filesystems()] 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)