def _create_distributed_volume_params(self, name): 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, name) return volparams
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 create_bricks(self, hosts, num_bricks): bricks = ParamFactory().create_bricks() for i in range(num_bricks): host_index = i % len(hosts) bricks.add_brick(BrickFactory().create(hosts[host_index].id)) return bricks;