def setUp(self): """ Obtain the Introspect() xml. """ self._introspection_data = dict() self._service = Service() self._service.setUp() time.sleep(1) proxy = get_object(TOP_OBJECT) self._introspection_data[ManagerSpec.INTERFACE_NAME] = \ proxy.Introspect(dbus_interface=dbus.INTROSPECTABLE_IFACE) ((poolpath, _), _, _) = Manager.CreatePool(proxy, name="name", redundancy=0, force=False, devices=[]) pool = get_object(poolpath) self._introspection_data[PoolSpec.INTERFACE_NAME] = \ pool.Introspect(dbus_interface=dbus.INTROSPECTABLE_IFACE) ([(fspath, _)], _, _) = \ Pool.CreateFilesystems(pool, specs=[("filesystem", '', None)]) fs = get_object(fspath) self._introspection_data[FilesystemSpec.INTERFACE_NAME] = \ fs.Introspect(dbus_interface=dbus.INTROSPECTABLE_IFACE)
def testCreate(self): """ Test calling with no actual volume specification. An empty volume list should always succeed, and it should not increase the number of volumes. """ (result, rc, _) = checked_call(Pool.CreateFilesystems(self._pool_object, specs=[]), PoolSpec.OUTPUT_SIGS[_PN.CreateFilesystems]) 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 testCreate(self): """ Test calling by specifying a volume name. Because there is already a volume with the given name, the creation of the new volume should fail, and no additional volume should be created. """ (result, rc, _) = checked_call( Pool.CreateFilesystems(self._pool_object, specs=[self._VOLNAME]), PoolSpec.OUTPUT_SIGS[_PN.CreateFilesystems]) self.assertEqual(rc, self._errors.ALREADY_EXISTS) self.assertEqual(len(result), 0) result = [x for x in get_managed_objects(self._proxy).filesystems()] self.assertEqual(len(result), 1)
def create_volumes(namespace): """ Create volumes in a pool. :raises StratisCliRuntimeError: """ proxy = get_object(TOP_OBJECT) pool_object = get_pool(proxy, namespace.pool) volume_list = [(x, '', None) for x in namespace.volume] (_, rc, message) = \ Pool.CreateFilesystems(pool_object, specs=volume_list) if rc != StratisdErrorsGen().get_object().OK: raise StratisCliRuntimeError(rc, message) return
def setUp(self): """ Start the stratisd daemon with the simulator. """ self._service = Service() self._service.setUp() time.sleep(1) self._proxy = get_object(TOP_OBJECT) self._errors = StratisdErrorsGen.get_object() self._devs = _DEVICE_STRATEGY.example() ((poolpath, _), _, _) = Manager.CreatePool(self._proxy, name=self._POOLNAME, redundancy=0, force=False, devices=self._devs) self._pool_object = get_object(poolpath) Pool.CreateFilesystems(self._pool_object, specs=[self._VOLNAME]) Manager.ConfigureSimulator(self._proxy, denominator=8)
def testDuplicateSpecs(self): """ Test calling with duplicate specification for same filesystem name. """ new_name = "name" (result, rc, _) = checked_call( Pool.CreateFilesystems(self._pool_object, specs=[new_name, new_name]), PoolSpec.OUTPUT_SIGS[_PN.CreateFilesystems]) self.assertEqual(rc, self._errors.OK) self.assertEqual(len(result), 1) (_, fs_name) = result[0] self.assertEqual(fs_name, new_name) result = [x for x in get_managed_objects(self._proxy).filesystems()] self.assertEqual(len(result), 1)
def testCreateOne(self): """ Test calling by specifying a new and different volume name. The new volume will be created. """ new_name = "newname" (result, rc, _) = checked_call( Pool.CreateFilesystems(self._pool_object, specs=[new_name]), PoolSpec.OUTPUT_SIGS[_PN.CreateFilesystems]) self.assertEqual(rc, self._errors.OK) self.assertEqual(len(result), 1) (_, fs_name) = result[0] self.assertEqual(fs_name, new_name) result = [x for x in get_managed_objects(self._proxy).filesystems()] self.assertEqual(len(result), 2)
def setUp(self): """ Start the stratisd daemon with the simulator. """ self._service = Service() self._service.setUp() time.sleep(2) self._proxy = get_object(TOP_OBJECT) self._errors = StratisdErrorsGen.get_object() self._devs = [d.device_node for d in _device_list(_DEVICES, 1)] (result, _, _) = Manager.CreatePool(self._proxy, name=self._POOLNAME, redundancy=0, force=False, devices=self._devs) self._pool_object = get_object(result) Pool.CreateFilesystems(self._pool_object, specs=[(self._VOLNAME, '', 0)]) Manager.ConfigureSimulator(self._proxy, denominator=8)
def setUp(self): """ Start the stratisd daemon with the simulator. """ self._service = Service() self._service.setUp() time.sleep(1) self._proxy = get_object(TOP_OBJECT) self._errors = StratisdErrorsGen.get_object() (poolpath, _, _) = Manager.CreatePool( self._proxy, name=self._POOLNAME, redundancy=0, force=False, devices=[d.device_node for d in _device_list(_DEVICES, 1)] ) Pool.CreateFilesystems( get_object(poolpath), specs=[(self._VOLNAME, '', 0)] )