def testSomeDevs(self):
        """
        Adding a non-empty list of devs should increase the number of devs
        in the pool.
        """
        (result, rc, _) = checked_call(
           Pool.AddDevs(
              self._pool_object,
              force=False,
              devices=_DEVICE_STRATEGY.example()
           ),
           PoolSpec.OUTPUT_SIGS[_PN.AddDevs]
        )

        #(result1, rc1, _) = checked_call(
        #   Pool.ListDevs(self._pool_object),
        #   PoolSpec.OUTPUT_SIGS[_PN.ListDevs]
        #)
        #self.assertEqual(rc1, self._errors.OK)

        num_devices_added = len(result)
        #self.assertEqual(len(result1), num_devices_added)

        if rc == self._errors.OK:
            self.assertGreater(num_devices_added, 0)
        else:
            self.assertEqual(num_devices_added, 0)
    def testEmptyDevs(self):
        """
        Adding an empty list of devs should leave the pool empty.
        """
        (result, rc, _) = checked_call(
           Pool.AddDevs(self._pool_object, force=False, devices=[]),
           PoolSpec.OUTPUT_SIGS[_PN.AddDevs]
        )

        self.assertEqual(len(result), 0)
        self.assertEqual(rc, self._errors.OK)
Example #3
0
 def add_device(namespace):
     """
     Add a device to a pool.
     """
     proxy = get_object(TOP_OBJECT)
     pool_object = get_pool(proxy, namespace.name)
     (_, rc, message) = Pool.AddDevs(
        pool_object,
        force=namespace.force,
        devices=namespace.device
     )
     if rc != StratisdErrorsGen.get_object().OK:
         raise StratisCliRuntimeError(rc, message)
     return