Example #1
0
 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_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()
Example #3
0
 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()
Example #4
0
    def test_add_brick(self):
        vol = self._create_distributed_volume('test-add-brick')

        new_bricks= ParamFactory().create_bricks(ParamFactory().create_brick(TestVolume.host2.id))
        try:
        # import pdb; pdb.set_trace()
        # from ovirtsdk.xml import params
        # brick = params.GlusterBrick(brick_dir="/tmp/blah123123123", server_id=TestVolume.host2.id)
        # brick_params = params.GlusterBricks()
        # brick_params.add_brick(brick)
            # vol.bricks.add(brick_params)
            vol.bricks.add(new_bricks)
        except Exception as e:
            raise 
        finally:
            vol.delete()
Example #5
0
    def test_negative_create_distributed_volume_with_bricks_from_another(self):
        vol = None
        existing_volum = None
        try:
            existing_volum = self._create_distributed_volume('existing-volume')
            existing_brick = existing_volum.bricks.list()[0]

            bricks = self._create_param_bricks(TestVolume.host.id, 7)
            bricks.append(ParamFactory().create_brick(existing_brick.get_server_id(),existing_brick.get_brick_dir()))
            self.assertRaisesRegexp(RequestError,'.*already used.*',
                    lambda: FixtureFactory(self.api).create_volume(TestVolume.cluster, ParamFactory().create_volume(ParamFactory().create_bricks(*bricks),'existing-brick-negative-volume')))
        finally:
            existing_volum and existing_volum.delete()
            vol and 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;
Example #7
0
 def create_cluster(self, params=ParamFactory().create_cluster()):
     return ClusterRepository(self.api).show(params) or ClusterRepository(
         self.api).create(params)
Example #8
0
 def create_datacenter(self, datacenter=ParamFactory().create_datacenter()):
     return DatacenterRepository(
         self.api).show(datacenter) or DatacenterRepository(
             self.api).create(datacenter)
 def create(self, params=ParamFactory().create_cluster()):
     return self.api.clusters.add(params)
 def create(self, params=ParamFactory().create_datacenter()):
     if ('datcenters' in dir(self.api)):
         return self.api.datacenters.add(params)
Example #11
0
 def create(self):
     return ParamFactory().create_host(**self.compiled_args())
Example #12
0
 def create(self):
     return ParamFactory().create_cluster(**self.compiled_args())
Example #13
0
 def create(self):
     return ParamFactory().create_version(**self.compiled_args())
Example #14
0
 def _create_param_bricks(self,host_id,num_bricks):
     result = []
     for _ in range(num_bricks):
         result.append(ParamFactory().create_brick(host_id))
     return result
Example #15
0
 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()