Project: mesos
Issue MESOS-3042: Master/Allocator does not send InverseOffers to resources to be maintained
Offers are currently sent from master/allocator to framework via ResourceOffersMessage's. InverseOffers, which are roughly equivalent to negative Offers, can be sent in the same package. In src/messages/messages.proto {code} message ResourceOffersMessage { repeated Offer offers = 1; repeated string pids = 2; // New field with InverseOffers repeated InverseOffer inverseOffers = 3; } {code} Sent InverseOffers can be tracked in the master's local state: i.e. In src/master/master.hpp: {code} struct Slave { ... // Existing fields. // Active InverseOffers on this slave. // Similar pattern to the "offers" field hashset inverseOffers; } {code} One actor (master or allocator) should populate the new InverseOffers field. * In master (src/master/master.cpp) ** Master::offer is where the ResourceOffersMessage and Offer object is constructed. ** The same method could also check for maintenance and send InverseOffers. * In the allocator (src/master/allocator/mesos/hierarchical.hpp) ** HierarchicalAllocatorProcess::allocate is where slave resources are aggregated an sent off to the frameworks. ** InverseOffers (i.e. negative resources) allocation could be calculated in this method. ** A change to Master::offer (i.e. the "offerCallback") may be necessary to account for the negative resources. Possible test(s): * InverseOfferTest ** Start master, slave, framework. ** Accept resource offer, start task. ** Set maintenance schedule to the future. ** Check that InverseOffer(s) are sent to the framework. ** Decline InverseOffer. ** Check that more InverseOffer(s) are sent. ** Accept InverseOffer. ** Check that more InverseOffer(s) are sent.
Story points: 8