def test_create_distributed_volume(self): bricks = ParamFactory().create_bricks() for _ in range(4): bricks.add_brick(ParamFactory().create_brick(TestVolume.host.id)) for _ in range(4): bricks.add_brick(ParamFactory().create_brick(TestVolume.host2.id)) volparams = ParamFactory().create_volume(bricks,'myvol2') vol = FixtureFactory(self.api).create_volume(TestVolume.cluster, volparams) vol.delete()
def test_create_replicated_volume(self): bricks = ParamFactory().create_bricks() for _ in range(4): bricks.add_brick(ParamFactory().create_brick(TestVolume.host.id)) for _ in range(4): bricks.add_brick(ParamFactory().create_brick(TestVolume.host2.id)) volparams = ParamFactory().create_volume(bricks,'rep-vol',"REPLICATE") volparams.set_replica_count(8) vol = FixtureFactory(self.api).create_volume(TestVolume.cluster, volparams) vol.delete()
def test_add_brick(self): volparams = VolumeFactory().create_distributed_volume("myvol", TestVolume.hosts, 8) vol = FixtureFactory(self.api).create_volume(TestVolume.cluster, volparams) try: bricks = ParamFactory().create_bricks() new_brick = BrickFactory().create(TestVolume.host2.id) bricks.add_brick(new_brick) vol.bricks.add(bricks) except Exception as e: raise finally: vol.delete()
def test_negative_create_distributed_volume_with_bricks_from_another(self): vol = None existing_volum = None try: existing_volume_params = VolumeFactory().create_distributed_volume("existing-volume", TestVolume.hosts, 8) existing_volum = FixtureFactory(self.api).create_volume(TestVolume.cluster, existing_volume_params) existing_brick = existing_volum.bricks.list()[0] bricks = VolumeFactory().create_bricks(TestVolume.hosts, 7) bricks.add_brick(BrickFactory().create(existing_brick.get_server_id(), existing_brick.get_brick_dir())) new_volume_params = VolumeFactory().create_distributed_volume("new-volume", TestVolume.hosts, 8) new_volume_params.set_bricks(bricks) self.assertRaisesRegexp( RequestError, ".*already used.*", lambda: FixtureFactory(self.api).create_volume(TestVolume.cluster, new_volume_params), ) finally: existing_volum and existing_volum.delete() vol and vol.delete()
def test_create_replicated_volume(self): volparams = VolumeFactory().create_distributed_replicate_volume("myvol", TestVolume.hosts, 8, 2) vol = FixtureFactory(self.api).create_volume(TestVolume.cluster, volparams) vol.delete()