def start_db_with_conf_changes(self, context, config_contents): """Restarts the PgSql instance with a new configuration.""" LOG.info(_("{guest_id}: Going into restart mode for config file changes.").format(guest_id=CONF.guest_id)) PgSqlAppStatus.get().begin_restart() self.stop_db(context) self.reset_configuration(context, config_contents) self.start_db(context) LOG.info(_("{guest_id}: Ending restart mode for config file changes.").format(guest_id=CONF.guest_id)) PgSqlAppStatus.get().end_restart()
def restart(self, context): """Restart the PgSql service.""" LOG.info( _("{guest_id}: Restarting database engine.").format( guest_id=CONF.guest_id, )) try: PgSqlAppStatus.get().begin_restart() self.stop_db(context) self.start_db(context) finally: PgSqlAppStatus.get().end_install_or_restart()
def restart(self, context): """Restart the PgSql service.""" LOG.info( _("{guest_id}: Restarting database engine.").format( guest_id=CONF.guest_id, ) ) try: PgSqlAppStatus.get().begin_restart() self.stop_db(context) self.start_db(context) finally: PgSqlAppStatus.get().end_install_or_restart()
def start_db_with_conf_changes(self, context, config_contents): """Restarts the PgSql instance with a new configuration.""" LOG.info( _("{guest_id}: Going into restart mode for config file changes."). format(guest_id=CONF.guest_id, )) PgSqlAppStatus.get().begin_restart() self.stop_db(context) self.reset_configuration(context, config_contents) self.start_db(context) LOG.info( _("{guest_id}: Ending restart mode for config file changes."). format(guest_id=CONF.guest_id, )) PgSqlAppStatus.get().end_restart()
def start_db_with_conf_changes(self, context, config_contents): """Starts the PgSql instance with a new configuration.""" if PgSqlAppStatus.get().is_running: raise RuntimeError(_("The service is still running.")) self.configuration_manager.save_configuration(config_contents) # The configuration template has to be updated with # guestagent-controlled settings. self.apply_initial_guestagent_configuration() self.start_db(context)
def stop_db(self, context, do_not_start_on_reboot=False, update_db=False): PgSqlAppStatus.get().stop_db_service( self.SERVICE_CANDIDATES, CONF.state_change_wait_time, disable_on_boot=do_not_start_on_reboot, update_db=update_db)
def start_db(self, context, enable_on_boot=True, update_db=False): PgSqlAppStatus.get().start_db_service( self.SERVICE_CANDIDATES, CONF.state_change_wait_time, enable_on_boot=enable_on_boot, update_db=update_db)
def restart(self, context): PgSqlAppStatus.get().restart_db_service( self.SERVICE_CANDIDATES, CONF.state_change_wait_time) self.set_guest_log_status(guest_log.LogStatus.Restart_Completed)
def install(self, context, packages): """Install one or more packages that postgresql needs to run. The packages parameter is a string representing the package names that should be given to the system's package manager. """ LOG.debug("{guest_id}: Beginning PgSql package installation.".format( guest_id=CONF.guest_id)) PgSqlAppStatus.get().begin_install() packager = pkg.Package() if not packager.pkg_is_installed(packages): try: LOG.info( _("{guest_id}: Installing ({packages}).").format( guest_id=CONF.guest_id, packages=packages, )) packager.pkg_install(packages, {}, 1000) except (pkg.PkgAdminLockError, pkg.PkgPermissionError, pkg.PkgPackageStateError, pkg.PkgNotFoundError, pkg.PkgTimeout, pkg.PkgScriptletError, pkg.PkgDownloadError, pkg.PkgSignError, pkg.PkgBrokenError): LOG.exception( "{guest_id}: There was a package manager error while " "trying to install ({packages}).".format( guest_id=CONF.guest_id, packages=packages, )) PgSqlAppStatus.get().end_install_or_restart() PgSqlAppStatus.get().set_status( instance.ServiceStatuses.FAILED) except Exception: LOG.exception( "{guest_id}: The package manager encountered an unknown " "error while trying to install ({packages}).".format( guest_id=CONF.guest_id, packages=packages, )) PgSqlAppStatus.get().end_install_or_restart() PgSqlAppStatus.get().set_status( instance.ServiceStatuses.FAILED) else: self.start_db(context) PgSqlAppStatus.get().end_install_or_restart() LOG.debug("{guest_id}: Completed package installation.".format( guest_id=CONF.guest_id, ))
def restart(self, context): PgSqlAppStatus.get().restart_db_service( self.SERVICE_CANDIDATES, CONF.state_change_wait_time)
def install(self, context, packages): """Install one or more packages that postgresql needs to run. The packages parameter is a string representing the package names that should be given to the system's package manager. """ LOG.debug( "{guest_id}: Beginning PgSql package installation.".format( guest_id=CONF.guest_id ) ) PgSqlAppStatus.get().begin_install() packager = pkg.Package() if not packager.pkg_is_installed(packages): try: LOG.info( _("{guest_id}: Installing ({packages}).").format( guest_id=CONF.guest_id, packages=packages, ) ) packager.pkg_install(packages, {}, 1000) except (pkg.PkgAdminLockError, pkg.PkgPermissionError, pkg.PkgPackageStateError, pkg.PkgNotFoundError, pkg.PkgTimeout, pkg.PkgScriptletError, pkg.PkgDownloadError, pkg.PkgSignError, pkg.PkgBrokenError): LOG.exception( "{guest_id}: There was a package manager error while " "trying to install ({packages}).".format( guest_id=CONF.guest_id, packages=packages, ) ) PgSqlAppStatus.get().end_install_or_restart() PgSqlAppStatus.get().set_status( instance.ServiceStatuses.FAILED ) except Exception: LOG.exception( "{guest_id}: The package manager encountered an unknown " "error while trying to install ({packages}).".format( guest_id=CONF.guest_id, packages=packages, ) ) PgSqlAppStatus.get().end_install_or_restart() PgSqlAppStatus.get().set_status( instance.ServiceStatuses.FAILED ) else: self.start_db(context) PgSqlAppStatus.get().end_install_or_restart() LOG.debug( "{guest_id}: Completed package installation.".format( guest_id=CONF.guest_id, ) )
def restart(self, context): PgSqlAppStatus.get().restart_db_service(PGSQL_SERVICE_CANDIDATES, CONF.state_change_wait_time)