Re: [PATCH v8 1/5] nodeinfo: Fix output on PPC64 KVM hosts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]