Example #1
0
 def testNonExistingVolume(self):
     """
     The volume does not exist.
     """
     (_, rc, _) = checked_call(
        Manager.GetFilesystemObjectPath(
           self._proxy,
           pool_name=self._POOLNAME,
           filesystem_name='noname'
        ),
        ManagerSpec.OUTPUT_SIGS[_MN.GetFilesystemObjectPath]
     )
     self.assertEqual(rc, self._errors.FILESYSTEM_NOTFOUND)
Example #2
0
 def testExistingVolume(self):
     """
     The volume should be discovered.
     """
     (result, rc, _) = checked_call(
        Manager.GetFilesystemObjectPath(
           self._proxy,
           pool_name=self._POOLNAME,
           filesystem_name=self._VOLNAME
        ),
        ManagerSpec.OUTPUT_SIGS[_MN.GetFilesystemObjectPath]
     )
     self.assertEqual(rc, self._errors.OK)
     self.assertNotEqual(result, "")
Example #3
0
    def testNonExistingPool(self):
        """
        If the pool does not exist, the filesystem is not found.

        Given our implementation, it is impossible to distinguish whether that
        is because the filesystem is not found or because the pool is not found.
        """
        (_, rc, _) = checked_call(
           Manager.GetFilesystemObjectPath(
              self._proxy,
              pool_name='notapool',
              filesystem_name='noname'
           ),
           ManagerSpec.OUTPUT_SIGS[_MN.GetFilesystemObjectPath],
        )
        self.assertEqual(rc, self._errors.FILESYSTEM_NOTFOUND)
Example #4
0
def get_volume(top, pool, name):
    """
    Get volume given ``name`` and ``pool``.

    :param top: the top object
    :param str pool: the object path of the pool
    :param str name: the name of the volume

    :returns: the corresponding object
    :rtype: ProxyObject
    :raises StratisCliRuntimeError: if failure to get object
    """
    (volume_object_path, rc,
     message) = Manager.GetFilesystemObjectPath(top,
                                                pool_name=pool,
                                                filesystem_name=name)

    if rc != StratisdErrorsGen.get_object().OK:
        raise StratisCliRuntimeError(rc, message)

    return get_object(volume_object_path)