X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=slivermanager.py;h=4caa1aded65844c4a1204971d40642e381966cfd;hb=9810ffaa90bac99bbe7a5b18ae914f649193ef8a;hp=1d38758659d43e7b9c3bfc26e3269ca6193d7c2f;hpb=ca883d7f49cb4f30e1ac2698575c0a174d3787cf;p=nodemanager.git diff --git a/slivermanager.py b/slivermanager.py index 1d38758..4caa1ad 100644 --- a/slivermanager.py +++ b/slivermanager.py @@ -14,9 +14,8 @@ 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 @@ -69,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") @@ -93,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 @@ -159,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')) @@ -206,12 +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(sliver_lxc.Sliver_LXC) - 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()