Beispiel #1
0
 def _place_request_with_params(self, ratio, min_fanout, max_fanout):
     place_params = PlaceParams()
     place_params.fanoutRatio = ratio
     place_params.minFanoutCount = min_fanout
     place_params.maxFanoutCount = max_fanout
     place_request = PlaceRequest(resource=Resource(Vm(), [Disk()]),
                                  leafSchedulerParams=place_params)
     return place_request
    def _get_place_params(self, request):
        out_params = PlaceParams(
            fanoutRatio=self.fanout_ratio, minFanoutCount=self.min_fanout, maxFanoutCount=self.max_fanout
        )
        if request.leafSchedulerParams is None:
            return out_params

        in_params = request.leafSchedulerParams
        if in_params.fanoutRatio is not None:
            out_params.fanoutRatio = in_params.fanoutRatio
        if in_params.minFanoutCount is not None:
            out_params.minFanoutCount = in_params.minFanoutCount
        if in_params.maxFanoutCount is not None:
            out_params.maxFanoutCount = in_params.maxFanoutCount

        return out_params
Beispiel #3
0
    def _get_place_params(self, request):
        out_params = PlaceParams(fanoutRatio=self.fanout_ratio,
                                 minFanoutCount=self.min_fanout,
                                 maxFanoutCount=self.max_fanout)
        if request.leafSchedulerParams is None:
            return out_params

        in_params = request.leafSchedulerParams
        if in_params.fanoutRatio is not None:
            out_params.fanoutRatio = in_params.fanoutRatio
        if in_params.minFanoutCount is not None:
            out_params.minFanoutCount = in_params.minFanoutCount
        if in_params.maxFanoutCount is not None:
            out_params.maxFanoutCount = in_params.maxFanoutCount

        return out_params