Exemplo n.º 1
0
    def __init__(self, livelock=None):
        """Constructs a new GanetiContext object.

    There should be only a GanetiContext object at any time, so this
    function raises an error if this is not the case.

    """
        assert self.__class__._instance is None, "double GanetiContext instance"

        # Create a livelock file
        if livelock is None:
            self.livelock = utils.livelock.LiveLock("masterd")
        else:
            self.livelock = livelock

        # Locking manager
        cfg = self.GetConfig(None)
        self.glm = locking.GanetiLockManager(
            cfg.GetNodeList(), cfg.GetNodeGroupList(),
            [inst.name for inst in cfg.GetAllInstancesInfo().values()],
            cfg.GetNetworkList())

        # Job queue
        logging.debug("Creating the job queue")
        self.jobqueue = jqueue.JobQueue(self, cfg)

        # setting this also locks the class against attribute modifications
        self.__class__._instance = self
Exemplo n.º 2
0
    def __init__(self):
        """Constructs a new GanetiContext object.

    There should be only a GanetiContext object at any time, so this
    function raises an error if this is not the case.

    """
        assert self.__class__._instance is None, "double GanetiContext instance"

        # Create global configuration object
        self.cfg = config.ConfigWriter()

        # Locking manager
        self.glm = locking.GanetiLockManager(
            self.cfg.GetNodeList(), self.cfg.GetNodeGroupList(),
            [inst.name for inst in self.cfg.GetAllInstancesInfo().values()],
            self.cfg.GetNetworkList())

        self.cfg.SetContext(self)

        # RPC runner
        self.rpc = rpc.RpcRunner(self.cfg, self.glm.AddToLockMonitor)

        # Job queue
        self.jobqueue = jqueue.JobQueue(self)

        # setting this also locks the class against attribute modifications
        self.__class__._instance = self
Exemplo n.º 3
0
    def __init__(self, livelock=None):
        """Constructs a new GanetiContext object.

    There should be only a GanetiContext object at any time, so this
    function raises an error if this is not the case.

    """
        assert self.__class__._instance is None, "double GanetiContext instance"

        # Create a livelock file
        if livelock is None:
            self.livelock = utils.livelock.LiveLock("masterd")
        else:
            self.livelock = livelock

        # Job queue
        cfg = self.GetConfig(None)
        logging.debug("Creating the job queue")
        self.jobqueue = jqueue.JobQueue(self, cfg)

        # setting this also locks the class against attribute modifications
        self.__class__._instance = self