Exemple #1
0
 def setUp(self):
     super(TwoLabels, self).setUp()
     ap1 = allocation.AllocationProvider('provider1', self.provider1)
     at1 = allocation.AllocationTarget('target1')
     ar1 = allocation.AllocationRequest('label1', self.label1)
     ar2 = allocation.AllocationRequest('label2', self.label2)
     ar1.addTarget(at1, 0)
     ar2.addTarget(at1, 0)
     self.agt.append(ar1.addProvider(ap1, at1, 0)[1])
     self.agt.append(ar2.addProvider(ap1, at1, 0)[1])
     ap1.makeGrants()
Exemple #2
0
        def do_it():
            ap1 = allocation.AllocationProvider('provider1', self.provider1)
            ap2 = allocation.AllocationProvider('provider2', self.provider2)

            at1 = allocation.AllocationTarget('target1')

            ars = []
            ars.append(allocation.AllocationRequest('label1', self.label1, ah))
            ars.append(allocation.AllocationRequest('label2', self.label2, ah))
            ars.append(allocation.AllocationRequest('label3', self.label3, ah))
            ars.append(allocation.AllocationRequest('label4', self.label4, ah))
            ars.append(allocation.AllocationRequest('label5', self.label5, ah))
            ars.append(allocation.AllocationRequest('label6', self.label6, ah))
            ars.append(allocation.AllocationRequest('label7', self.label7, ah))
            ars.append(allocation.AllocationRequest('label8', self.label8, ah))

            # each request to one target, and can be satisfied by both
            # providers
            for ar in ars:
                ar.addTarget(at1, 0)
                ar.addProvider(ap1, at1, 0)
                ar.addProvider(ap2, at1, 0)

            ap1.makeGrants()
            for g in ap1.grants:
                self.allocations.append(g.request.name)
            ap2.makeGrants()
            for g in ap2.grants:
                self.allocations.append(g.request.name)

            ah.grantsDone()
Exemple #3
0
        def do_it():
            ap1 = allocation.AllocationProvider('provider1', self.provider1)
            ap2 = allocation.AllocationProvider('provider2', self.provider2)

            at1 = allocation.AllocationTarget('target1')

            ars = []
            ars.append(allocation.AllocationRequest('label1', self.label1, ah))
            ars.append(allocation.AllocationRequest('label2', self.label2, ah))
            ars.append(allocation.AllocationRequest('label3', self.label3, ah))
            ars.append(allocation.AllocationRequest('label4', self.label4, ah))
            ars.append(allocation.AllocationRequest('label5', self.label5, ah))
            ars.append(allocation.AllocationRequest('label6', self.label6, ah))
            ars.append(allocation.AllocationRequest('label7', self.label7, ah))
            ars.append(allocation.AllocationRequest('label8', self.label8, ah))

            # first ar can only go to provider1, the last only to
            # provider2
            ars[0].addTarget(at1, 0)
            ars[0].addProvider(ap1, at1, 0)
            ars[-1].addTarget(at1, 0)
            ars[-1].addProvider(ap2, at1, 0)

            # the rest can go anywhere
            for ar in ars[1:-1]:
                ar.addTarget(at1, 0)
                ar.addProvider(ap1, at1, 0)
                ar.addProvider(ap2, at1, 0)

            ap1.makeGrants()
            for g in ap1.grants:
                self.allocations.append(g.request.name)

            ap2.makeGrants()
            for g in ap2.grants:
                self.allocations.append(g.request.name)

            ah.grantsDone()