forked from avocado-framework/avocado-vt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
env_process: Refactor Libvirtd debug log setup/cleanup into a Setuper
Move the setup/cleanup steps of the Libvirtd debug log from the env_process.{pre,post}process into a Setuper subclass. The env_process setup_manager will call the setup/cleanup methods when appropriate. Signed-off-by: bgartzi <[email protected]>
- Loading branch information
Showing
2 changed files
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from virttest.test_setup.core import Setuper | ||
from virttest import test_setup | ||
|
||
|
||
class LibvirtdDebugLogConfig(Setuper): | ||
def setup(self): | ||
if ( | ||
self.params.get("vm_type") == "libvirt" | ||
and self.params.get("enable_libvirtd_debug_log", "yes") == "yes" | ||
): | ||
# By default log the info level | ||
log_level = self.params.get("libvirtd_debug_level", "2") | ||
log_file = self.params.get("libvirtd_debug_file", "") | ||
log_filters = self.params.get("libvirtd_debug_filters", f"{log_level}:*") | ||
log_permission = self.params.get("libvirtd_log_permission") | ||
libvirtd_debug_log = test_setup.LibvirtdDebugLog( | ||
self.test, log_level, log_file, log_filters, log_permission | ||
) | ||
libvirtd_debug_log.enable() | ||
|
||
def cleanup(self): | ||
if ( | ||
self.params.get("vm_type") == "libvirt" | ||
and self.params.get("enable_libvirtd_debug_log", "yes") == "yes" | ||
): | ||
libvirtd_debug_log = test_setup.LibvirtdDebugLog(self.test) | ||
libvirtd_debug_log.disable() |