[libvirt] [PATCH v8 1/5] nodeinfo: Fix output on PPC64 KVM hosts
Andrea Bolognani
abologna at redhat.com
Wed Jul 29 08:45:46 UTC 2015
On Wed, 2015-07-29 at 13:12 +0530, Shivaprasad bhat wrote:
>
> > +#if HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT)
> > + if (ARCH_IS_PPC64(arch)) {
> > +
> > + kvmfd = open("/dev/kvm", O_RDONLY);
> > + if (kvmfd < 0) {
> > + threads_per_subcore = -1;
>
> Its okay for a guest to not have kvm/qemu packages installed and
> open()
> would fail.
> The caller goes to cleanup because of -1 and we get this error
>
> error: failed to get node information
> error: An error occurred, but the cause is unknown
>
> If we remove the -1 assignment we should be good. Even on a host,
> user might not want to use kvm that should also be treated with the
> usual
> cpu counting.
What about checking for the file's existence before trying
to open it?
That way we can ignore the cases where we're okay with not
having /dev/kvm, eg. the kvm modules are not installed or
loaded, and we can still error out when something else is
wrong, eg. permission error.
Cheers.
--
Andrea Bolognani
Software Engineer - Virtualization Team
More information about the libvir-list
mailing list