Remove the local kvmpath variable from virHostCPUGetThreadsPerSubcore() and use the global KVM_DEVICE define instead. --- src/util/virhostcpu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index a34d983..055fa1f 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1238,7 +1238,6 @@ int virHostCPUGetThreadsPerSubcore(virArch arch) { int threads_per_subcore = 0; - const char *kvmpath = "/dev/kvm"; int kvmfd; if (ARCH_IS_PPC64(arch)) { @@ -1248,17 +1247,17 @@ virHostCPUGetThreadsPerSubcore(virArch arch) * b. the kvm module might not be installed or enabled * In either case, falling back to the subcore-unaware thread * counting logic is the right thing to do */ - if (!virFileExists(kvmpath)) + if (!virFileExists(KVM_DEVICE)) goto out; - if ((kvmfd = open(kvmpath, O_RDONLY)) < 0) { + if ((kvmfd = open(KVM_DEVICE, O_RDONLY)) < 0) { /* This can happen when running as a regular user if * permissions are tight enough, in which case erroring out * is better than silently falling back and reporting * different nodeinfo depending on the user */ virReportSystemError(errno, _("Failed to open '%s'"), - kvmpath); + KVM_DEVICE); threads_per_subcore = -1; goto out; } -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list