יום חמישי, 8 במאי 2014

Writing custom openstack wighter

Two options are available in order to guide the OpenStack cloud infrastructure to schedule  the next Virtual machine on a host with minimum benchmark execution time left :
1.Write a custom Nova scheduling filter.
2.Write a custom Nova scheduling  weigher   .
Due to the fact that the filter logic in this case is complicated a wighter class is more appropriated for this task.

The wighter classes location :
The scheduling implementation in Nova is located in \nova\scheduler directory
The weights folder contains build in Weighers for example the RAMWeigher that returns host score  according to its available ram .

Open stack Weigher classes relationships 

Capture4
A concrete Weigher implements the weights.BaseHostWeigher interface (its abc python interface ).
The BaseWeigher interface declares the following methods:
The def _weigh_object(self, host_state, weight_properties):
method returns the host un normalized score.
The def weigh_objects(self, weighed_obj_list, weight_properties):
method may used to calculate the weight of an host when information from all hosted is required  .(Not our case ).

We need to create a new concrete Weighter class that's overrides the _weigh_object method .

class BenchMarkResourcesWeigher(weights.BaseHostWeigher):
    def _weight_multiplier(self):
        """the default weight multiplier."""
        return 1
    def _weigh_object(self, host_state, weight_properties):
        """Higher weights win.  """
        return -1 * host_state.BenchMarks_Total_Work_Left


In the next Post we will add the new member : BenchMarks_Total_Work_left  to the host_state class 

2 תגובות:

  1. Hey very nice blog!! Man you have done the Amazing efforts to make this blog... I will surely bookmark your blog. at payessay.com

    השבמחק
  2. Wowww! Thanks a lot baby! I always required writing in my site something very special like your blog has. You have really helped me a lot. Trainer Certification}

    השבמחק