예제 #1
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(1)
     command_line = ['create', self._POOLNAME] + self._pool_devices()
     all(run(command_line))
     command_line = \
        ['blockdev', 'cache', 'create', self._POOLNAME] + \
        self._cache_devices()
     all(run(command_line))
예제 #2
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(1)
     command_line = \
        ['pool', 'create'] + [self._POOLNAME] + \
        [d.device_node for d in _device_list(_DEVICES, 1)]
     all(run(command_line))
     command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES
     all(run(command_line))
예제 #3
0
 def testDestroy(self):
     """
     Destruction of the volume must succeed since pool exists and at end
     volume is gone.
     """
     command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES
     all(run(command_line))
예제 #4
0
 def testStratisTwoOptons(self):
     """
     Exactly one option should be set, so this should fail.
     """
     command_line = self._MENU + ['--log-level', '--version']
     with self.assertRaises(SystemExit):
         all(run(command_line))
예제 #5
0
 def testStratisNoOptions(self):
     """
     Exactly one option should be set, so this should fail.
     """
     command_line = self._MENU
     with self.assertRaises(SystemExit):
         all(run(command_line))
예제 #6
0
 def testAdd(self):
     """
     Adding devices that are already there should succeed if devices are
     unused by pool, but should fail otherwise.
     """
     command_line = self._MENU + [self._POOLNAME] + self._DEVICES
     all(run(command_line))
예제 #7
0
 def testExecution(self):
     """
     This should fail since it has a volume.
     """
     command_line = self._MENU + [self._POOLNAME]
     with self.assertRaises(StratisCliRuntimeError):
         all(run(command_line))
예제 #8
0
 def testSnapshot(self):
     """
     Snapshot of the volume could fail if not enough space in pool, should
     succeed if enough space in pool.
     """
     command_line = \
        self._MENU + [self._POOLNAME] + [self._ORIGIN] + [self._SNAP]
     all(run(command_line))
예제 #9
0
 def testCreate(self):
     """
     Create expects success unless devices are already occupied.
     """
     command_line = \
        self._MENU + \
        [self._POOLNAME] + \
        [d.device_node for d in _device_list(_DEVICES, 1)]
     all(run(command_line))
예제 #10
0
 def testList(self):
     """
     Listing the volume must fail since the pool does not exist.
     """
     command_line = self._MENU + [self._POOLNAME]
     with self.assertRaises(StratisCliRuntimeError) as ctxt:
         all(run(command_line))
     expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND
     self.assertEqual(ctxt.exception.rc, expected_error)
예제 #11
0
 def testCreate(self):
     """
     Create should fail, because there is already a cache.
     """
     command_line = self._MENU + [self._POOLNAME] + self._other_devices()
     with self.assertRaises(StratisCliRuntimeError) as ctxt:
         all(run(command_line))
     expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND
     self.assertEqual(ctxt.exception.rc, expected_error)
예제 #12
0
 def testCreation(self):
     """
     Creation of the volume must fail since pool is not specified.
     """
     command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES
     with self.assertRaises(StratisCliRuntimeError) as ctxt:
         all(run(command_line))
     expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND
     self.assertEqual(ctxt.exception.rc, expected_error)
예제 #13
0
 def testSnapshot(self):
     """
     Snapshot of the volume must fail since there is no volume.
     """
     command_line = \
        self._MENU + [self._POOLNAME] + [self._ORIGIN] + [self._SNAP]
     with self.assertRaises(StratisCliRuntimeError) as ctxt:
         all(run(command_line))
     expected_error = StratisdErrorsGen.get_object().VOLUME_NOTFOUND
     self.assertEqual(ctxt.exception.rc, expected_error)
예제 #14
0
 def testCreation(self):
     """
     Creation of this volume should fail, because there is an existing
     volume of the same name.
     """
     command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES
     with self.assertRaises(StratisCliRuntimeError) as ctxt:
         all(run(command_line))
     expected_error = StratisdErrorsGen.get_object().LIST_FAILURE
     self.assertEqual(ctxt.exception.rc, expected_error)
예제 #15
0
 def testCreate(self):
     """
     Create should fail trying to create new pool with same name as previous.
     """
     command_line = \
        self._MENU + \
        [self._POOLNAME] + \
        [d.device_node for d in _device_list(_DEVICES, 1)]
     with self.assertRaises(StratisCliRuntimeError):
         all(run(command_line))
예제 #16
0
 def setUp(self):
     """
     Start the stratisd daemon with the simulator.
     """
     self._service = Service()
     self._service.setUp()
     time.sleep(1)
     command_line = \
        ['pool', 'create'] + [self._POOLNAME] + self._DEVICES
     all(run(command_line))
예제 #17
0
 def testAdd(self):
     """
     Adding the devices must fail since the pool does not exist.
     """
     command_line = self._MENU + [self._POOLNAME] + \
        [d.device_node for d in _device_list(_DEVICES, 1)]
     with self.assertRaises(StratisCliRuntimeError) as ctxt:
         all(run(command_line))
     expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND
     self.assertEqual(ctxt.exception.rc, expected_error)
예제 #18
0
 def testRedundancy(self):
     """
     Parser error on all redundancy that is not 'none'.
     """
     command_line = \
        self._MENU + \
        ['--redundancy', 'raid6'] + \
        [self._POOLNAME] + \
        [d.device_node for d in _device_list(_DEVICES, 1)]
     with self.assertRaises(SystemExit):
         all(run(command_line))
예제 #19
0
 def testCreate(self):
     """
     Create should fail because the pool does not exist.
     """
     command_line = \
        self._MENU + \
        [self._POOLNAME] + \
        [d.device_node for d in _device_list(_DEVICES, 1)]
     with self.assertRaises(StratisCliRuntimeError) as ctxt:
         all(run(command_line))
     expected_error = StratisdErrorsGen.get_object().POOL_NOTFOUND
     self.assertEqual(ctxt.exception.rc, expected_error)
예제 #20
0
 def testList(self):
     """
     Listing the devices should succeed.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))
예제 #21
0
 def testStratisVersion(self):
     """
     Getting version should just succeed.
     """
     command_line = self._MENU + ['--version']
     all(run(command_line))
예제 #22
0
 def testList(self):
     """
     List should just succeed.
     """
     command_line = self._MENU
     all(run(command_line))
예제 #23
0
 def testCreate(self):
     """
     Create should succeed, assuming devices are not busy.
     """
     command_line = self._MENU + [self._POOLNAME] + self._cache_devices()
     all(run(command_line))
예제 #24
0
 def testList(self):
     """
     Listing the volumes in an empty pool should succeed.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))
예제 #25
0
 def testExecution(self):
     """
     Destroy should succeed.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))
예제 #26
0
 def testCreation(self):
     """
     Creation of the volume should succeed since pool is available.
     """
     command_line = self._MENU + [self._POOLNAME] + self._VOLNAMES
     all(run(command_line))
예제 #27
0
 def testExecution(self):
     """
     The pool was just created, so must be destroyable.
     """
     command_line = self._MENU + [self._POOLNAME]
     all(run(command_line))