Skip to content

Commit

Permalink
[virt_autotest] Adapt SLE automation from monolithic to modular libvi…
Browse files Browse the repository at this point in the history
…rt daemons on 15SP6
  • Loading branch information
guoxuguang committed Aug 9, 2023
1 parent e4729ec commit 93ac7cd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/virt_autotest/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@ sub is_xen_host {
return get_var("XEN") || check_var("SYSTEM_ROLE", "xen") || check_var("HOST_HYPERVISOR", "xen") || check_var("REGRESSION", "xen-hypervisor");
}

# Usage: check_modular_libvirt_daemons([daemon1_name daemon2_name ...]). For example:
# to specify daemons which will be checked: check_modular_libvirt_daemons(qemu storage ...)
# to check all required modular daemons without any daemons passed
sub check_modular_libvirt_daemons {
my @daemons;

if (@_ == 0) {
if (is_xen_host) {
@daemons = qw(xen network nodedev nwfilter secret storage);
} else {
@daemons = qw(qemu network nodedev nwfilter secret storage);
}
} else {
@daemons = @_;
}

foreach my $daemon (@daemons) {
systemctl("status virt${daemon}d.service");
systemctl("status virt${daemon}d\{,-ro,-admin\}.socket");
}

record_info("Libvirt daemons checked", join(' ', @daemons));
save_screenshot;
}

# Usage: restart_modular_libvirt_daemons([daemon1_name daemon2_name ...]). For example:
# to specify daemons which will be restarted: restart_modular_libvirt_daemons(virtqemud virtstoraged ...)
# to restart all modular daemons without any daemons passed
Expand Down Expand Up @@ -98,6 +123,7 @@ sub restart_modular_libvirt_daemons {
}

record_info("Libvirt daemons restarted", join(' ', @daemons));
check_modular_libvirt_daemons;
}

#return 1 if it is a VMware test judging by REGRESSION variable
Expand Down

0 comments on commit 93ac7cd

Please sign in to comment.