From 4235c2f396f36cf0f8898c5179d261ad66ac68f7 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 31 Dec 2012 08:23:05 +0100 Subject: [PATCH] correctly count sockets Physical IDs may not start at 0. bump version to 1.0-41 --- Makefile | 4 ++-- data/PVE/ProcFSTools.pm | 7 ++++--- debian/changelog | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d477f33..fb329a1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -RELEASE=2.2 +RELEASE=2.3 VERSION=1.0 -PKGREL=40 +PKGREL=41 PACKAGE=libpve-common-perl diff --git a/data/PVE/ProcFSTools.pm b/data/PVE/ProcFSTools.pm index d501082..4c1591c 100644 --- a/data/PVE/ProcFSTools.pm +++ b/data/PVE/ProcFSTools.pm @@ -26,6 +26,7 @@ sub read_cpuinfo { my $fh = IO::File->new ($fn, "r"); return $res if !$fh; + my $idhash = {}; my $count = 0; while (defined(my $line = <$fh>)) { if ($line =~ m/^processor\s*:\s*\d+\s*$/i) { @@ -37,12 +38,12 @@ sub read_cpuinfo { } elsif ($line =~ m/^flags\s*:.*(vmx|svm)/) { $res->{hvm} = 1; # Hardware Virtual Machine (Intel VT / AMD-V) } elsif ($line =~ m/^physical id\s*:\s*(\d+)\s*$/i) { - my $sid = $1 + 1; - $res->{sockets} = $sid if $sid > $res->{sockets}; + $idhash->{$1} = 1; } - } + $res->{sockets} = scalar(keys %$idhash) || 1; + $res->{cpus} = $count; $fh->close; diff --git a/debian/changelog b/debian/changelog index ad9b356..5d1cb69 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libpve-common-perl (1.0-41) unstable; urgency=low + + * correctly count physical sockets + + -- Proxmox Support Team Mon, 31 Dec 2012 08:24:40 +0100 + libpve-common-perl (1.0-40) unstable; urgency=low * run_command: implement afterfork callback -- 2.39.2