X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=slivermanager.py;h=ea446fc556624411a0621d6bdd6e201f93b480aa;hb=d235d740614a027b111b37ce84f1d9edaf113922;hp=70c2186b586d163ae83e2778acd258d4c18d068d;hpb=47a2f121f043f7545d68457c21bd995602d3c4b9;p=nodemanager.git diff --git a/slivermanager.py b/slivermanager.py index 70c2186..ea446fc 100644 --- a/slivermanager.py +++ b/slivermanager.py @@ -14,11 +14,11 @@ import time import logger import api, api_calls import database -import accounts +import account import controller -import sliver_vs +import sliver_lxc -try: from bwlimit import bwmin, bwmax +try: from bwlimitlxc import bwmin, bwmax except ImportError: bwmin, bwmax = 8, 1000*1000*1000 priority=10 @@ -29,7 +29,7 @@ DEFAULT_ALLOCATION = { # CPU parameters 'cpu_pct': 0, # percent CPU reserved 'cpu_share': 1, # proportional share - 'cpu_cores': 0, # reserved cpu cores + 'cpu_cores': "0b", # reserved cpu cores [b] # bandwidth parameters 'net_min_rate': bwmin / 1000, # kbps 'net_max_rate': bwmax / 1000, # kbps @@ -68,7 +68,8 @@ def adjustReservedSlivers (data): if 'reservation_policy' not in data: return policy=data['reservation_policy'] if policy not in ['lease_or_idle', 'lease_or_shared']: - logger.log ("unexpected reservation_policy %(policy)s"%locals()) + if policy is not None: + logger.log ("unexpected reservation_policy %(policy)s"%locals()) return logger.log("slivermanager.adjustReservedSlivers") @@ -92,7 +93,7 @@ def adjustReservedSlivers (data): if is_system_sliver(sliver): sliver['reservation_alive']=True continue - + # regular slivers if not active_lease: # with 'idle_or_shared', just let the field out, behave like a shared node @@ -158,7 +159,7 @@ def GetSlivers(data, config = None, plc=None, fullupdate=True): if rec['instantiation'].lower() == 'nm-controller': rec.setdefault('type', attributes.get('type', 'controller.Controller')) else: - rec.setdefault('type', attributes.get('type', 'sliver.VServer')) + rec.setdefault('type', attributes.get('type', 'sliver.LXC')) # set the vserver reference. If none, set to default. rec.setdefault('vref', attributes.get('vref', 'default')) @@ -205,11 +206,13 @@ def deliver_ticket(data): return GetSlivers(data, fullupdate=False) def start(): - for resname, default_amount in sliver_vs.DEFAULT_ALLOCATION.iteritems(): - DEFAULT_ALLOCATION[resname]=default_amount + # No default allocation values for LXC yet, think if its necessary given + # that they are also default allocation values in this module + #for resname, default_amount in sliver_vs.DEFAULT_ALLOCATION.iteritems(): + # DEFAULT_ALLOCATION[resname]=default_amount - accounts.register_class(sliver_vs.Sliver_VS) - accounts.register_class(controller.Controller) + account.register_class(sliver_lxc.Sliver_LXC) + account.register_class(controller.Controller) database.start() api_calls.deliver_ticket = deliver_ticket api.start()