Exemple #1
0
    def __init__(self):
        self._service_name = SERVICE_NAME
        ServiceCtlHandler.__init__(self, SERVICE_NAME,
                                   initdv2.lookup(SERVICE_NAME))
        bus.on("init", self.on_init)
        bus.define_events(
            'before_postgresql_data_bundle',
            'postgresql_data_bundle',

            # @param host: New master hostname
            'before_postgresql_change_master',

            # @param host: New master hostname
            'postgresql_change_master',
            'before_slave_promote_to_master',
            'slave_promote_to_master')

        self._phase_postgresql = 'Configure PostgreSQL'
        self._phase_data_bundle = self._op_data_bundle = 'PostgreSQL data bundle'
        self._phase_backup = self._op_backup = 'PostgreSQL backup'
        self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
        self._step_accept_scalr_conf = 'Accept Scalr configuration'
        self._step_patch_conf = 'Patch configuration files'
        self._step_create_storage = 'Create storage'
        self._step_init_master = 'Initialize Master'
        self._step_init_slave = 'Initialize Slave'
        self._step_create_data_bundle = 'Create data bundle'
        self._step_change_replication_master = 'Change replication Master'
        self._step_collect_host_up_data = 'Collect HostUp data'

        self.on_reload()
Exemple #2
0
    def __init__(self):
        self.mysql = mysql_svc.MySQL()
        cnf_ctl = MysqlCnfController() if __mysql__['behavior'] in ('mysql2', 'percona') else None  # mariadb dont do old presets 
        ServiceCtlHandler.__init__(self,
                        __mysql__['behavior'],
                        self.mysql.service,
                        cnf_ctl)

        self.preset_provider = mysql_svc.MySQLPresetProvider()
        preset_service.services[__mysql__['behavior']] = self.preset_provider

        bus.on(init=self.on_init, reload=self.on_reload)
        bus.define_events(
                'before_mysql_data_bundle',
                'mysql_data_bundle',
                # @param host: New master hostname
                'before_mysql_change_master',
                # @param host: New master hostname
                # @param log_file: log file to start from
                # @param log_pos: log pos to start from
                'mysql_change_master'
                'before_slave_promote_to_master',
                'slave_promote_to_master'
        )

        self._mysql_api = mysql_api.MySQLAPI()
        self._op_api = operation_api.OperationAPI()
        self._backup_id = None
        self._data_bundle_id = None
        self.on_reload()
Exemple #3
0
 def __init__(self):
     self._service_name = SERVICE_NAME
     ServiceCtlHandler.__init__(self, SERVICE_NAME, initdv2.lookup(SERVICE_NAME))
     bus.on("init", self.on_init)
     bus.define_events(
         'before_postgresql_data_bundle',
         
         'postgresql_data_bundle',
         
         # @param host: New master hostname 
         'before_postgresql_change_master',
         
         # @param host: New master hostname 
         'postgresql_change_master',
         
         'before_slave_promote_to_master',
         
         'slave_promote_to_master'
     )   
     
     self._phase_postgresql = 'Configure PostgreSQL'
     self._phase_data_bundle = self._op_data_bundle = 'PostgreSQL data bundle'
     self._phase_backup = self._op_backup = 'PostgreSQL backup'
     self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
     self._step_accept_scalr_conf = 'Accept Scalr configuration'
     self._step_patch_conf = 'Patch configuration files'
     self._step_create_storage = 'Create storage'
     self._step_init_master = 'Initialize Master'
     self._step_init_slave = 'Initialize Slave'
     self._step_create_data_bundle = 'Create data bundle'
     self._step_change_replication_master = 'Change replication Master'
     self._step_collect_host_up_data = 'Collect HostUp data'
     
     self.on_reload()        
Exemple #4
0
 def __init__(self):
     self.preset_provider = MemcachedPresetProvider()
     preset_service.services[BEHAVIOUR] = self.preset_provider
     ServiceCtlHandler.__init__(self, SERVICE_NAME, initdv2.lookup('memcached'), MemcachedCnfController())
     FarmSecurityMixin.__init__(self, [11211])
     self._logger = logging.getLogger(__name__)
     self._queryenv = bus.queryenv_service
     bus.on("init", self.on_init)
Exemple #5
0
 def __init__(self):
     self.preset_provider = MemcachedPresetProvider()
     preset_service.services[BEHAVIOUR] = self.preset_provider
     FarmSecurityMixin.__init__(self, [11211])
     ServiceCtlHandler.__init__(self, BEHAVIOUR, MemcachedInitScript())
     self._logger = logging.getLogger(__name__)
     self._queryenv = bus.queryenv_service
     bus.on("init", self.on_init)
Exemple #6
0
 def __init__(self):
     self.preset_provider = MemcachedPresetProvider()
     preset_service.services[BEHAVIOUR] = self.preset_provider
     ServiceCtlHandler.__init__(self, SERVICE_NAME,
                                initdv2.lookup('memcached'),
                                MemcachedCnfController())
     FarmSecurityMixin.__init__(self, [11211])
     self._logger = logging.getLogger(__name__)
     self._queryenv = bus.queryenv_service
     bus.on("init", self.on_init)
Exemple #7
0
    def __init__(self):
        self._cnf = bus.cnf
        ServiceCtlHandler.__init__(self, BEHAVIOUR, initdv2.lookup('nginx'), NginxCnfController())

        self._logger = logging.getLogger(__name__)
        self.preset_provider = NginxPresetProvider()
        self.api = NginxAPI()
        self._terminating_servers = []
        preset_service.services[BEHAVIOUR] = self.preset_provider

        bus.define_events("nginx_upstream_reload")
        bus.on(init=self.on_init, reload=self.on_reload)
        self.on_reload()
Exemple #8
0
    def __init__(self):
        self._cnf = bus.cnf
        self._nginx_v2_flag_filepath = os.path.join(bus.etc_path, "private.d/nginx_v2")
        ServiceCtlHandler.__init__(self, BEHAVIOUR, initdv2.lookup('nginx'), NginxCnfController())

        self._logger = logging.getLogger(__name__)
        self.preset_provider = NginxPresetProvider()
        self.api = NginxAPI()
        self.api.init_service()
        self._terminating_servers = []

        bus.define_events("nginx_upstream_reload")
        bus.on(init=self.on_init, reload=self.on_reload)
        self.on_reload()
Exemple #9
0
    def __init__(self):
        self._redis_api = redis_api.RedisAPI()
        self.preset_provider = redis.RedisPresetProvider()
        preset_service.services[BEHAVIOUR] = self.preset_provider

        from_port = __redis__['ports_range'][0]
        to_port = __redis__['ports_range'][-1]
        handlers.FarmSecurityMixin.__init__(self, ["{0}:{1}".format(from_port, to_port)])

        ServiceCtlHandler.__init__(self, SERVICE_NAME, cnf_ctl=RedisCnfController())

        bus.on("init", self.on_init)
        bus.define_events(
                'before_%s_data_bundle' % BEHAVIOUR,

                '%s_data_bundle' % BEHAVIOUR,

                # @param host: New master hostname
                'before_%s_change_master' % BEHAVIOUR,

                # @param host: New master hostname
                '%s_change_master' % BEHAVIOUR,

                'before_slave_promote_to_master',

                'slave_promote_to_master'
        )

        self._phase_redis = 'Configure Redis'
        self._phase_data_bundle = self._op_data_bundle = 'Redis data bundle'
        self._phase_backup = self._op_backup = 'Redis backup'
        self._step_copy_database_file = 'Copy database file'
        self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
        self._step_accept_scalr_conf = 'Accept Scalr configuration'
        self._step_patch_conf = 'Patch configuration files'
        self._step_create_storage = 'Create storage'
        self._step_init_master = 'Initialize Master'
        self._step_init_slave = 'Initialize Slave'
        self._step_create_data_bundle = 'Create data bundle'
        self._step_change_replication_master = 'Change replication Master'
        self._step_collect_host_up_data = 'Collect HostUp data'

        self.on_reload()

        if self._cnf.state == ScalarizrState.RUNNING:
            # Fix to enable access outside farm when use_passwords=True
            if self.use_passwords:
                self.security_off()
Exemple #10
0
    def __init__(self):
        self._redis_api = redis_api.RedisAPI()
        self.preset_provider = redis.RedisPresetProvider()
        preset_service.services[BEHAVIOUR] = self.preset_provider

        from_port = __redis__['ports_range'][0]
        to_port = __redis__['ports_range'][-1]
        handlers.FarmSecurityMixin.__init__(
            self, ["{0}:{1}".format(from_port, to_port)])

        ServiceCtlHandler.__init__(self,
                                   SERVICE_NAME,
                                   cnf_ctl=RedisCnfController())

        bus.on("init", self.on_init)
        bus.define_events(
            'before_%s_data_bundle' % BEHAVIOUR,
            '%s_data_bundle' % BEHAVIOUR,

            # @param host: New master hostname
            'before_%s_change_master' % BEHAVIOUR,

            # @param host: New master hostname
            '%s_change_master' % BEHAVIOUR,
            'before_slave_promote_to_master',
            'slave_promote_to_master')

        self._phase_redis = 'Configure Redis'
        self._phase_data_bundle = self._op_data_bundle = 'Redis data bundle'
        self._phase_backup = self._op_backup = 'Redis backup'
        self._step_copy_database_file = 'Copy database file'
        self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
        self._step_accept_scalr_conf = 'Accept Scalr configuration'
        self._step_patch_conf = 'Patch configuration files'
        self._step_create_storage = 'Create storage'
        self._step_init_master = 'Initialize Master'
        self._step_init_slave = 'Initialize Slave'
        self._step_create_data_bundle = 'Create data bundle'
        self._step_change_replication_master = 'Change replication Master'
        self._step_collect_host_up_data = 'Collect HostUp data'

        self.on_reload()

        if self._cnf.state == ScalarizrState.RUNNING:
            # Fix to enable access outside farm when use_passwords=True
            if self.use_passwords:
                self.security_off()
Exemple #11
0
    def __init__(self):
        self._hir_volume_growth = None
        self._redis_api = redis_api.RedisAPI()
        self.preset_provider = redis.RedisPresetProvider()

        from_port = __redis__['ports_range'][0]
        to_port = __redis__['ports_range'][-1]
        handlers.FarmSecurityMixin.__init__(self)
        ServiceCtlHandler.__init__(self, SERVICE_NAME, cnf_ctl=RedisCnfController())

        bus.on("init", self.on_init)
        bus.define_events(
                'before_%s_data_bundle' % BEHAVIOUR,

                '%s_data_bundle' % BEHAVIOUR,

                # @param host: New master hostname
                'before_%s_change_master' % BEHAVIOUR,

                # @param host: New master hostname
                '%s_change_master' % BEHAVIOUR,

                'before_slave_promote_to_master',

                'slave_promote_to_master'
        )

        self._phase_redis = 'Configure Redis'
        self._phase_data_bundle = self._op_data_bundle = 'Redis data bundle'
        self._phase_backup = self._op_backup = 'Redis backup'
        self._step_copy_database_file = 'Copy database file'
        self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
        self._step_accept_scalr_conf = 'Accept Scalr configuration'
        self._step_patch_conf = 'Patch configuration files'
        self._step_create_storage = 'Create storage'
        self._step_init_master = 'Initialize Master'
        self._step_init_slave = 'Initialize Slave'
        self._step_create_data_bundle = 'Create data bundle'
        self._step_change_replication_master = 'Change replication Master'
        self._step_collect_host_up_data = 'Collect HostUp data'

        self.on_reload()
    def __init__(self):
        self._service_name = SERVICE_NAME
        ServiceCtlHandler.__init__(self, SERVICE_NAME,
                                   initdv2.lookup(SERVICE_NAME))
        bus.on("init", self.on_init)
        bus.define_events(
            'before_postgresql_data_bundle',
            'postgresql_data_bundle',

            # @param host: New master hostname
            'before_postgresql_change_master',

            # @param host: New master hostname
            'postgresql_change_master',
            'before_slave_promote_to_master',
            'slave_promote_to_master')

        self._hir_volume_growth = None
        self._postgresql_api = postgresql_api.PostgreSQLAPI()

        self.on_reload()
Exemple #13
0
    def __init__(self):
        self._hir_volume_growth = None
        self._redis_api = redis_api.RedisAPI()
        self.preset_provider = redis.RedisPresetProvider()

        from_port = __redis__['ports_range'][0]
        to_port = __redis__['ports_range'][-1]
        handlers.FarmSecurityMixin.__init__(self)
        ServiceCtlHandler.__init__(self,
                                   SERVICE_NAME,
                                   cnf_ctl=RedisCnfController())

        bus.on("init", self.on_init)
        bus.define_events(
            'before_%s_data_bundle' % BEHAVIOUR,
            '%s_data_bundle' % BEHAVIOUR,

            # @param host: New master hostname
            'before_%s_change_master' % BEHAVIOUR,

            # @param host: New master hostname
            '%s_change_master' % BEHAVIOUR,
            'before_slave_promote_to_master',
            'slave_promote_to_master')

        self._phase_redis = 'Configure Redis'
        self._phase_data_bundle = self._op_data_bundle = 'Redis data bundle'
        self._phase_backup = self._op_backup = 'Redis backup'
        self._step_copy_database_file = 'Copy database file'
        self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
        self._step_accept_scalr_conf = 'Accept Scalr configuration'
        self._step_patch_conf = 'Patch configuration files'
        self._step_create_storage = 'Create storage'
        self._step_init_master = 'Initialize Master'
        self._step_init_slave = 'Initialize Slave'
        self._step_create_data_bundle = 'Create data bundle'
        self._step_change_replication_master = 'Change replication Master'
        self._step_collect_host_up_data = 'Collect HostUp data'

        self.on_reload()
Exemple #14
0
	def __init__(self):
		self.mysql = mysql_svc.MySQL()
		ServiceCtlHandler.__init__(self, 
				__mysql__['behavior'], 
				self.mysql.service, 
				MysqlCnfController())



		bus.on(init=self.on_init, reload=self.on_reload)
		bus.define_events(
			'before_mysql_data_bundle',
			'mysql_data_bundle',
			# @param host: New master hostname 
			'before_mysql_change_master',
			# @param host: New master hostname 
			# @param log_file: log file to start from 
			# @param log_pos: log pos to start from 
			'mysql_change_master'
			'before_slave_promote_to_master',
			'slave_promote_to_master'
		)
		
		self._phase_mysql = 'Configure MySQL'
		self._phase_data_bundle = self._op_data_bundle = 'MySQL data bundle'
		self._phase_backup = self._op_backup = 'MySQL backup'
		self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
		self._step_accept_scalr_conf = 'Accept Scalr configuration'
		self._step_patch_conf = 'Patch my.cnf configuration file'
		self._step_create_storage = 'Create storage'
		self._step_move_datadir = 'Move data directory to storage'
		self._step_create_users = 'Create Scalr users'
		self._step_restore_users = 'Restore Scalr users'
		self._step_create_data_bundle = 'Create data bundle'
		self._step_change_replication_master = 'Change replication Master'
		self._step_innodb_recovery = 'InnoDB recovery'
		self._step_collect_hostup_data = 'Collect HostUp data'
		
		
		self.on_reload()	
Exemple #15
0
    def __init__(self):
        self.preset_provider = redis.RedisPresetProvider()
        preset_service.services[BEHAVIOUR] = self.preset_provider

        handlers.FarmSecurityMixin.__init__(self, ["%s:%s" %
                 (redis.DEFAULT_PORT, redis.DEFAULT_PORT+redis.MAX_CUSTOM_PROCESSES)])
        ServiceCtlHandler.__init__(self, SERVICE_NAME, cnf_ctl=RedisCnfController())
        bus.on("init", self.on_init)
        bus.define_events(
                'before_%s_data_bundle' % BEHAVIOUR,

                '%s_data_bundle' % BEHAVIOUR,

                # @param host: New master hostname
                'before_%s_change_master' % BEHAVIOUR,

                # @param host: New master hostname
                '%s_change_master' % BEHAVIOUR,

                'before_slave_promote_to_master',

                'slave_promote_to_master'
        )

        self._phase_redis = 'Configure Redis'
        self._phase_data_bundle = self._op_data_bundle = 'Redis data bundle'
        self._phase_backup = self._op_backup = 'Redis backup'
        self._step_copy_database_file = 'Copy database file'
        self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
        self._step_accept_scalr_conf = 'Accept Scalr configuration'
        self._step_patch_conf = 'Patch configuration files'
        self._step_create_storage = 'Create storage'
        self._step_init_master = 'Initialize Master'
        self._step_init_slave = 'Initialize Slave'
        self._step_create_data_bundle = 'Create data bundle'
        self._step_change_replication_master = 'Change replication Master'
        self._step_collect_host_up_data = 'Collect HostUp data'

        self.on_reload()
 def test_comparator(self):
     ctl = ServiceCtlHandler(None, None)
     self.assertFalse(
         ctl.preset_changed({
             '1': 'one',
             '2': 'two'
         }, {
             '1': 'one',
             '2': 'two',
             '3': 'three'
         }))
     self.assertFalse(
         ctl.preset_changed(
             {
                 '1': 'one',
                 '2': 'two',
                 'key_cache_age_threshold': ''
             }, {
                 '1': 'one',
                 '2': 'two',
                 'join_buffer_size': ''
             }))
Exemple #17
0
    def __init__(self):
        self._service_name = SERVICE_NAME
        ServiceCtlHandler.__init__(self, SERVICE_NAME, initdv2.lookup(SERVICE_NAME))
        bus.on("init", self.on_init)
        bus.define_events(
            'before_postgresql_data_bundle',
            
            'postgresql_data_bundle',
            
            # @param host: New master hostname 
            'before_postgresql_change_master',
            
            # @param host: New master hostname 
            'postgresql_change_master',
            
            'before_slave_promote_to_master',
            
            'slave_promote_to_master'
        )   

        self._postgresql_api = postgresql_api.PostgreSQLAPI()

        self.on_reload()        
 def test_comparator(self):
     ctl = ServiceCtlHandler(None, None)
     self.assertFalse(ctl.preset_changed({'1':'one', '2':'two'}, {'1':'one', '2':'two', '3':'three'}))
     self.assertFalse(ctl.preset_changed({'1':'one', '2':'two', 'key_cache_age_threshold':''}, {'1':'one', '2':'two', 'join_buffer_size':''}))
Exemple #19
0
	def __init__(self):
		ServiceCtlHandler.__init__(self, SERVICE_NAME, initdv2.lookup('memcached'), MemcachedCnfController())
		FarmSecurityMixin.__init__(self, [11211])
		self._logger = logging.getLogger(__name__)		
		self._queryenv = bus.queryenv_service
		bus.on("init", self.on_init)