def test_do_configs_require_restart(self):
     overrides = {'autocommit' : True}
     b_restart = configurations.do_configs_require_restart(overrides, "mysql")
     self.assertTrue(b_restart == False, overrides)
     
     
     overrides = {'innodb_buffer_pool_size' : 100}
     b_restart = configurations.do_configs_require_restart(overrides, "mysql")
     self.assertTrue(b_restart == True, overrides)
Exemplo n.º 2
0
 def update_overrides(self, overrides):
     LOG.debug("Updating or removing overrides for instance %s" % self.id)
     need_restart = do_configs_require_restart(
         overrides, datastore_manager=self.ds_version.manager)
     LOG.debug("config overrides has non-dynamic settings, "
               "requires a restart: %s" % need_restart)
     if need_restart:
         self.update_db(task_status=InstanceTasks.RESTART_REQUIRED)
     task_api.API(self.context).update_overrides(self.id, overrides)
Exemplo n.º 3
0
 def update_overrides(self, overrides):
     LOG.debug(_("Updating or removing overrides for instance %s")
               % self.id)
     need_restart = do_configs_require_restart(
         overrides, datastore_manager=self.ds_version.manager)
     LOG.debug(_("config overrides has non-dynamic settings, "
                 "requires a restart: %s") % need_restart)
     if need_restart:
         self.update_db(task_status=InstanceTasks.RESTART_REQUIRED)
     task_api.API(self.context).update_overrides(self.id, overrides)
Exemplo n.º 4
0
    def update_overrides(self, overrides, remove=False):
        LOG.debug("Updating configuration overrides on instance %s" % self.id)
        LOG.debug("overrides: %s" % overrides)
        LOG.debug("self.ds_version: %s" % self.ds_version.__dict__)
        # todo(cp16net) How do we know what datastore type we have?
        need_restart = do_configs_require_restart(overrides, datastore_manager=self.ds_version.manager)
        LOG.debug("do we need a restart?: %s" % need_restart)
        if need_restart:
            status = inst_models.InstanceTasks.RESTART_REQUIRED
            self.update_db(task_status=status)

        flavor = self.nova_client.flavors.get(self.flavor_id)

        config_overrides = self._render_override_config(flavor, overrides=overrides)

        try:
            self.guest.update_overrides(config_overrides.config_contents, remove=remove)
            self.guest.apply_overrides(overrides)
            LOG.debug("Configuration overrides update successful.")
        except GuestError:
            LOG.error(_("Failed to update configuration overrides."))