Пример #1
0
 def action(self):
     logger.info('Rerconfiguring glassfish')
     try:
         # Deferred list
         dlist = []
         
         # Run drone on all target domains
         for target in self.blackboard.hosts.get_hosts('target'):
             print '   * configuring glassfish on target %s' % (target)
             
             # mysql_name = target.replace('glassfish', 'mysql')
             mysql_name = 'localhost'
             print '     using mysql name: %s' % (mysql_name)
             drones.prepare_drone('glassfish_configure', 'domain.xml', mysql_server=mysql_name, targetHostName=target)
             drones.create_drone('glassfish_configure')
             
             d = base.launch(self.blackboard.hosts, self.blackboard.client_list, target, 'glassfish_configure', wait=True)
             dlist.append(d)
         
         # Wait for all drones to finish and set phase
         dl = defer.DeferredList(dlist)
         d = defer.Deferred()
         dl.addCallback(self.ok, d)
         return d
         
     except Exception, e:
         print 'FATAL: Error while configuring glassfish'
         print e
         return False
Пример #2
0
def phase_configure_glassfish(client_list):
    print 'reconfiguring glassfish ...'
    logger.info('reconfiguring glassfish')
    
    try:
        
        dlist = []
        
        for target in hosts.get_hosts('target'):
            print '   * configuring glassfish on target %s' % (target)
            
            # mysql_name = target.replace('glassfish', 'mysql')
            mysql_name = 'localhost'
            print '     using mysql name: %s' % (mysql_name)
            drones.prepare_drone('glassfish_configure', 'domain.xml', mysql_server=mysql_name)
            drones.create_drone('glassfish_configure')
            
            d = base.launch(client_list, target, 'glassfish_configure', wait=True)
            dlist.append(d)
        
        # Wait for all drones to finish and set phase
        dl = defer.DeferredList(dlist)
        
        dl.addCallback(phase_start_glassfish_database, client_list)
        # dl.addCallback(finished, client_list)
        
    except Exception, e:
        print e
        finished(None, client_list)
Пример #3
0
 def action(self):
     print 'starting rain DRIVER_NODES...'
     logger.info('starting rain DRIVER_NODES')
     
     # Dump profile
     profiles.dump(logger)
     
     dlist = []
 
     targets = hosts.get_hosts('target')
     target_count = len(targets)
     
     DRIVER_NODES = hosts.get_hosts('load')
     driver_count = len(DRIVER_NODES)
     
     targets_per_driver = int(math.ceil(float(target_count) / float(driver_count)))
     
     for i in range(0, driver_count):
         driver = DRIVER_NODES[i]
         
         # Build targets for configuration
         config_targets = []
         for target in targets[i * targets_per_driver : (i + 1) * targets_per_driver]:
             config_target = {}
             config_target['target'] = target
             
             # Important: Load the USER workload profile
             config_target['profile'] = domains.user_profile_by_name(target)
             config_targets.append(config_target)
 
         print config_targets
 
         # Configure drone
         drones.prepare_drone('rain_start', 'rain.config.specj.json', targets=config_targets)
         drones.create_drone('rain_start')
         
         # Launch this drone
         d = base.wait_for_message(self.blackboard.client_list, driver, 'rain_start', 'Waiting for start signal...', '/opt/rain/rain.log')
         dlist.append(d)
     
     
     # Wait for all load DRIVER_NODES to start
     d = defer.Deferred()
     dl = defer.DeferredList(dlist)
     dl.addCallback(self.ok, d)
     return d
Пример #4
0
 def action(self):
     print 'Starting rain DRIVER_NODES...'
     logger.info('starting rain DRIVER_NODES')
     
     # Deferred list
     dlist = []
 
     # Get all driver hosts
     DRIVER_NODES = self.blackboard.hosts.get_hosts('load')
     driver_count = len(DRIVER_NODES)
     
     # Load schedules as JSON
     from schedule import schedule_builder
     json_schedules = schedule_builder.load_entries(conf_schedule.SCHEDULE_ID)
     
     # For each Rain driver
     for i in range(0, driver_count):
         # Driver host 
         driver = DRIVER_NODES[i]
         
         # Create launch drone with appropriate schedule
         drones.prepare_drone('rain_start', 'rain.config.specj.json',
                               schedule=json_schedules[i])
         drones.create_drone('rain_start')
         
         # Launch this drone
         logger.info('Launching Rain: %s' % driver)
         d = base.wait_for_message(self.blackboard.hosts, self.blackboard.client_list, driver, 'rain_start', 'Waiting for start signal...', '/opt/rain/rain.log')
         dlist.append(d)
     
     
     # Wait for all Rain drivers to start
     dl = defer.DeferredList(dlist)
     d = defer.Deferred()
     dl.addCallback(self.ok, d)
     return d