=====================================
service check design and implementation¶
Background:
Customer report an issue which specific service can’t start after migration, so migration team decide do service check before and after migration process in OpenQA.
Design specific:
we want to check some services before migration and after migration, there are some different check point for before and after migration, which listed below chart.
For migration test we need to check following steps before the migration: they are
install_service
enable_service
start_service
check_service
check_function
And after migration finished we need to check following steps, they are:
check_service
check_function
Services that need be check:
Currently we need cover the following service check before and after migration:
apache2
SuSEfirewall2
firewall
ntp
chrony
postfix
bind
snmp
nfs
rpcbind
autofs
cups
radvd
cron
apparm
dhcp
kdump
Detail info you can check progress ticket: 54995
https://progress.opensuse.org/issues/54995
How to implementation?
We add these services in a hash list in lib/service_check.pm which will be called by installation/install_service.pm before migration and console/check_upgraded_service.pm
after migration.
You can check out the current service_check.pm for how it looks like.
https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/lib/service_check.pm
For each service that to be added to the service check we have 2 options.
1) if there’s no existed service lib/utils then we need to add a service.pm to lib/services/ directory.
2) if there’s existed service lib/utils then we can use the existed lib/utils to avoid code duplication.
For each service module we need provide following interfaces:
1) install_service
Parameter: None.
Description:
install the service by zypper in services_name
2) enable_service
Parameter: None
Description:
use systemctl enable to start the service after reboot.
3) configure_service
Parameter: None.
Description:
setup and configure the test service to make it ready to check the function.
3) start_service
Parameter: None
Description:
use systemctl start to start the service.
4) service_check
Parameter: None
Description:
check if a service is enabled and active by ‘systemctl status service’
5) function_check
Parameter:
1.test type
before: means pre-migratoin check
after : means post-migration check
Description:
The function_check will check the service function but for some service we just check the basic function while the original function module will do the fully function check.
Above functions will be called both by migration (lib/service_check.pm) and module service.pm
Code example:
you can check out this link as example:
https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/lib/services/apache.pm
For more information on the implementation and code example please check out our apache2 service check.
https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/7643