mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virt-host-validate: Turn failure to read /proc/cmdline into an error
When validating secure guests support on s390(x) we may read /proc/cmdline and look for "prot_virt" argument. Reading the kernel command line is done via virFileReadValueString() which may fail. In such case caller won't see any error message. But we can produce the same warning/error as if "prot_virt" argument wasn't found. Not only this lets users know about the problem, it also terminates the "Checking for ...." line correctly. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
This commit is contained in:
parent
52d2571b58
commit
7ea5a80dc1
@ -470,14 +470,12 @@ int virHostValidateSecureGuests(const char *hvname,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virFileReadValueString(&cmdline, "/proc/cmdline") < 0)
|
|
||||||
return VIR_HOST_VALIDATE_FAILURE(level);
|
|
||||||
|
|
||||||
/* we're prefix matching rather than equality matching here, because
|
/* we're prefix matching rather than equality matching here, because
|
||||||
* kernel would treat even something like prot_virt='yFOO' as
|
* kernel would treat even something like prot_virt='yFOO' as
|
||||||
* enabled
|
* enabled
|
||||||
*/
|
*/
|
||||||
if (virKernelCmdlineMatchParam(cmdline, "prot_virt", kIBMValues,
|
if (virFileReadValueString(&cmdline, "/proc/cmdline") >= 0 &&
|
||||||
|
virKernelCmdlineMatchParam(cmdline, "prot_virt", kIBMValues,
|
||||||
G_N_ELEMENTS(kIBMValues),
|
G_N_ELEMENTS(kIBMValues),
|
||||||
VIR_KERNEL_CMDLINE_FLAGS_SEARCH_FIRST |
|
VIR_KERNEL_CMDLINE_FLAGS_SEARCH_FIRST |
|
||||||
VIR_KERNEL_CMDLINE_FLAGS_CMP_PREFIX)) {
|
VIR_KERNEL_CMDLINE_FLAGS_CMP_PREFIX)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user