Пример #1
0
 def _start_mrc(self, nodes):
     for node in nodes:
         try:
             client.createMRC(node.ip, 5555, self.dirNodes[0].ip)
         except client.AgentException:
             self.logger.exception('Failed to start MRC at node %s' % node)
             self.state = self.S_ERROR
             raise
Пример #2
0
 def _start_mrc(self, nodes):
     for node in nodes:
         try:
             client.createMRC(node.ip, 5555, self.dirNodes[0].ip)
         except client.AgentException:
             self.logger.exception('Failed to start MRC at node %s' % node)
             self.state = self.S_ERROR
             raise
Пример #3
0
    def _do_add_nodes(self, nr_dir, nr_mrc, nr_osd, cloud, resuming=False):
        startCloud = self._init_cloud(cloud)
        totalNodes = nr_dir + nr_mrc + nr_osd

        # try to create totalNodes new nodes
        try:
            node_instances = self.controller.create_nodes(totalNodes, 
                client.check_agent_process, 5555, startCloud)      
        except:
            self.logger.exception('_do_add_nodes: Failed to request a new node')
            self.state = self.S_STOPPED
            return

        self.nodes += node_instances 

        dirNodesAdded = node_instances[:nr_dir]
        self.dirNodes += dirNodesAdded

        mrcNodesAdded = node_instances[nr_dir:nr_mrc+nr_dir]
        self.mrcNodes += mrcNodesAdded

        osdNodesAdded = node_instances[nr_mrc+nr_dir:] 
        self.osdNodes += osdNodesAdded

        # TODO: maybe re-enable when OSD-removal moves data to another node before shutting down the service.
        #KilledOsdNodes = []
        # The first node will contain the OSD service so it will be removed
        # from there
        #if nr_osd > 0 and self.osdCount == 0:
        #    KilledOsdNodes.append(self.dirNodes[0])
        #self.KillOsd(KilledOsdNodes)
          
        # Startup DIR agents
        for node in dirNodesAdded:
            client.startup(node.ip, 5555)
            data = client.createDIR(node.ip, 5555)
            self.logger.info('Received %s from %s', data, node.id)
            self.dirCount += 1

        # Startup MRC agents
        for node in mrcNodesAdded:
            client.startup(node.ip, 5555)
            data = client.createMRC(node.ip, 5555, self.dirNodes[0].ip)
            self.logger.info('Received %s from %s', data, node.id)
            self.mrcCount += 1

        # Startup OSD agents (if not resuming)
        if not resuming:
            self._start_osd(osdNodesAdded, startCloud)
      
        self.osdCount += len(osdNodesAdded)

        #for node in osdNodesAdded:
        #    client.startup(node.ip, 5555)
        #    data = client.createOSD(node.ip, 5555, self.dirNodes[0].ip)
        #    self.logger.info('Received %s from %s', data, node.id)         
        #    self.osdCount += 1

        self.state = self.S_RUNNING
        return HttpJsonResponse()
Пример #4
0
    def _do_add_nodes(self, nr_dir, nr_mrc, nr_osd, cloud):
        startCloud = self._init_cloud(cloud)
        totalNodes = nr_dir + nr_mrc + nr_osd

        # try to create totalNodes new nodes
        try:
            node_instances = self.controller.create_nodes(
                totalNodes, client.check_agent_process, 5555, startCloud)
        except:
            self.logger.exception(
                '_do_add_nodes: Failed to request a new node')
            self.state = self.S_STOPPED
            return

        self.nodes += node_instances

        dirNodesAdded = node_instances[:nr_dir]
        self.dirNodes += dirNodesAdded

        mrcNodesAdded = node_instances[nr_dir:nr_mrc + nr_dir]
        self.mrcNodes += mrcNodesAdded

        osdNodesAdded = node_instances[nr_mrc + nr_dir:]
        self.osdNodes += osdNodesAdded

        # TODO: maybe re-enable when OSD-removal moves data to another node before shutting down the service.
        #KilledOsdNodes = []
        # The first node will contain the OSD service so it will be removed
        # from there
        #if nr_osd > 0 and self.osdCount == 0:
        #    KilledOsdNodes.append(self.dirNodes[0])
        #self.KillOsd(KilledOsdNodes)

        # Startup DIR agents
        for node in dirNodesAdded:
            client.startup(node.ip, 5555)
            data = client.createDIR(node.ip, 5555)
            self.logger.info('Received %s from %s', data, node.id)
            self.dirCount += 1

        # Startup MRC agents
        for node in mrcNodesAdded:
            client.startup(node.ip, 5555)
            data = client.createMRC(node.ip, 5555, self.dirNodes[0].ip)
            self.logger.info('Received %s from %s', data, node.id)
            self.mrcCount += 1

        # Startup OSD agents
        for node in osdNodesAdded:
            client.startup(node.ip, 5555)
            data = client.createOSD(node.ip, 5555, self.dirNodes[0].ip)
            self.logger.info('Received %s from %s', data, node.id)
            self.osdCount += 1

        self.state = self.S_RUNNING
        return HttpJsonResponse()
Пример #5
0
 def createMRC(self, kwargs):
     if self.state != self.S_RUNNING:
         return HttpErrorResponse('ERROR: Wrong state to create MRC service')
     # Just createMRC from all the agents
     for node in self.nodes:
         data = client.createMRC(node.ip, 5555, self.dirNodes[0].ip)
         self.logger.info('Received %s from %s', data, node.id)
     return HttpJsonResponse({
         'xtreemfs': [ node.id for node in self.nodes ],
         })   
Пример #6
0
 def createMRC(self, kwargs):
     if self.state != self.S_RUNNING:
         return HttpErrorResponse(
             'ERROR: Wrong state to create MRC service')
     # Just createMRC from all the agents
     for node in self.nodes:
         data = client.createMRC(node.ip, 5555, self.dirNodes[0].ip)
         self.logger.info('Received %s from %s', data, node.id)
     return HttpJsonResponse({
         'xtreemfs': [node.id for node in self.nodes],
     })