]> git.proxmox.com Git - pve-common.git/commitdiff
correctly count sockets
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 31 Dec 2012 07:23:05 +0000 (08:23 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 31 Dec 2012 07:24:49 +0000 (08:24 +0100)
Physical IDs may not start at 0.

bump version to 1.0-41

Makefile
data/PVE/ProcFSTools.pm
debian/changelog

index d477f33dbd70c86c14f65afda085e2ebab105d99..fb329a1bffe6d6762a33a1cd91f38bbe27688dd0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-RELEASE=2.2
+RELEASE=2.3
 
 VERSION=1.0
 
 VERSION=1.0
-PKGREL=40
+PKGREL=41
 
 PACKAGE=libpve-common-perl
 
 
 PACKAGE=libpve-common-perl
 
index d501082f2efe07e0a5a325d01495ff17f6c8b53a..4c1591cd8049b01dc488d7d908133c92ac2fc84a 100644 (file)
@@ -26,6 +26,7 @@ sub read_cpuinfo {
     my $fh = IO::File->new ($fn, "r");
     return $res if !$fh;
 
     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) {
     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) {
        } 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;
     $res->{cpus} = $count;
 
     $fh->close;
index ad9b356018b929f7cb54b39241d6d8f721163066..5d1cb69835a90df77a84bfbc5fd7cae1c87b4f01 100644 (file)
@@ -1,3 +1,9 @@
+libpve-common-perl (1.0-41) unstable; urgency=low
+
+  * correctly count physical sockets
+
+ -- Proxmox Support Team <support@proxmox.com>  Mon, 31 Dec 2012 08:24:40 +0100
+
 libpve-common-perl (1.0-40) unstable; urgency=low
 
   * run_command: implement afterfork callback
 libpve-common-perl (1.0-40) unstable; urgency=low
 
   * run_command: implement afterfork callback