Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging: setup: Always use formerly-engine-specific PostgreSql conf #600

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions packaging/setup/ovirt_engine_setup/engine_common/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ovirt_engine_setup import constants as osetupcons
from ovirt_engine_setup import util as osetuputil
from ovirt_engine_setup.engine_common import constants as oengcommcons
from ovirt_engine_setup.engine_common.constants import ProvisioningEnv

from ovirt_setup_lib import dialog
from ovirt_setup_lib import hostname as osetuphostname
Expand Down Expand Up @@ -952,6 +953,78 @@ def _pg_conf_info(self):
oengcommcons.ProvisioningEnv.POSTGRES_EXTRA_CONFIG_ITEMS,
()
) + (
{
'key': 'autovacuum_vacuum_scale_factor',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_VACUUM_SCALE_FACTOR
],
'ok': lambda key, current, expected: (
float(current) <= float(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific='%s' % AT_MOST_EXPECTED,
)
},
{
'key': 'autovacuum_analyze_scale_factor',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_ANALYZE_SCALE_FACTOR
],
'ok': lambda key, current, expected: (
float(current) <= float(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific=AT_MOST_EXPECTED,
)
},
{
'key': 'autovacuum_max_workers',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_MAX_WORKERS
],
'ok': lambda key, current, expected: (
int(current) >= int(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific=AT_LEAST_EXPECTED,
)
},
{
'key': 'maintenance_work_mem',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_MAINTENANCE_WORK_MEM
],
'useQueryForValue': True,
'ok': lambda key, current, expected: (
int(current) >= int(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific='%s' % AT_LEAST_EXPECTED,
)
},
{
'key': 'work_mem',
'expected': self.environment[
ProvisioningEnv.PG_WORK_MEM_KB
],
'useQueryForValue': True,
'ok': lambda key, current, expected: (
int(current) >= int(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific='%s' % AT_LEAST_EXPECTED,
)
},
{
'key': 'server_encoding',
'expected': 'UTF8',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from ovirt_engine_setup.engine_common import constants as oengcommcons
from ovirt_engine_setup.engine_common import database
from ovirt_engine_setup.engine_common import postgres
from ovirt_engine_setup.engine_common.constants import ProvisioningEnv


def _(m):
Expand Down Expand Up @@ -67,82 +66,6 @@ def _suggestAutoFixing(self):
elif autofix_approved.upper() == _("No").upper():
raise RuntimeError(_('Aborted by user'))

def _pg_conf_items(self):
return (
{
'key': 'autovacuum_vacuum_scale_factor',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_VACUUM_SCALE_FACTOR
],
'ok': lambda key, current, expected: (
float(current) <= float(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific='%s' % database.AT_MOST_EXPECTED,
)
},
{
'key': 'autovacuum_analyze_scale_factor',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_ANALYZE_SCALE_FACTOR
],
'ok': lambda key, current, expected: (
float(current) <= float(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific=database.AT_MOST_EXPECTED,
)
},
{
'key': 'autovacuum_max_workers',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_MAX_WORKERS
],
'ok': lambda key, current, expected: (
int(current) >= int(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific=database.AT_LEAST_EXPECTED,
)
},
{
'key': 'maintenance_work_mem',
'expected': self.environment[
ProvisioningEnv.PG_AUTOVACUUM_MAINTENANCE_WORK_MEM
],
'useQueryForValue': True,
'ok': lambda key, current, expected: (
int(current) >= int(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific='%s' % database.AT_LEAST_EXPECTED,
)
},
{
'key': 'work_mem',
'expected': self.environment[
ProvisioningEnv.PG_WORK_MEM_KB
],
'useQueryForValue': True,
'ok': lambda key, current, expected: (
int(current) >= int(expected)
),
'check_on_use': True,
'needed_on_create': True,
'error_msg': '{specific}'.format(
specific='%s' % database.AT_LEAST_EXPECTED,
)
},
)

# Checks if uuid-ossp extension was installed in DB
def _uuidOsspInstalled(self):
dbstatement = database.Statement(
Expand Down Expand Up @@ -179,14 +102,6 @@ def _init(self):
()
)

@plugin.event(
stage=plugin.Stages.STAGE_SETUP,
)
def _setup(self):
self.environment[
oengcommcons.ProvisioningEnv.POSTGRES_EXTRA_CONFIG_ITEMS
] += self._pg_conf_items()

@plugin.event(
stage=plugin.Stages.STAGE_CUSTOMIZATION,
condition=lambda self: (
Expand Down