Skip to content

Commit 4278754

Browse files
authored
Merge pull request jiangcuo#161 from jiangcuo/pve-common2
add cpuname parse on arm64
2 parents 3fdd2b9 + 762d02f commit 4278754

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
2+
index 3826fcc..8d7151b 100644
3+
--- a/src/PVE/ProcFSTools.pm
4+
+++ b/src/PVE/ProcFSTools.pm
5+
@@ -10,7 +10,8 @@ use POSIX;
6+
use Socket qw(PF_INET PF_INET6 SOCK_DGRAM IPPROTO_IP);
7+
use Time::HiRes qw (gettimeofday);
8+
9+
-use PVE::Tools;
10+
+use PVE::Tools qw(get_host_arch);
11+
+use JSON;
12+
13+
use constant IFF_UP => 1;
14+
use constant IFNAMSIZ => 16;
15+
@@ -57,6 +58,21 @@ sub read_cpuinfo {
16+
}
17+
}
18+
19+
+ my $arch = get_host_arch();
20+
+ my $hardinfo = '/run/pve/query-machine-info';
21+
+
22+
+ if ($arch eq 'aarch64' && $res->{model} eq 'unknown' && -e $hardinfo){
23+
+ $hardinfo = IO::File->new ($hardinfo, "r");
24+
+ return if !$hardinfo;
25+
+ my $data = do { local $/; <$hardinfo> };
26+
+ $data = decode_json($data);
27+
+ foreach my $item (@$data) {
28+
+ if (exists $item->{cpu}) {
29+
+ $res->{model} = $item->{cpu};
30+
+ }
31+
+ }
32+
+ $hardinfo->close;
33+
+ }
34+
# Hardware Virtual Machine (Intel VT / AMD-V)
35+
$res->{hvm} = $res->{flags} =~ m/\s(vmx|svm)\s/;
36+

‎packages/pve-common/series‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
patches/001-add-for-port.patch
22
patches/changelog/001-add-changlog.patch
3+
patches/002-add-cpuname-parse-on-arm64.patch

0 commit comments

Comments
 (0)