mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virNodeParseSocket: Take ARM into account
The virNodeParseSocket() function tries to get socked ID from 'topology/physical_package_id' file. However, on some architectures the file contains the -1 constant which makes in turn libvirt think the info extraction was unsuccessful. If that's the case, we need to overwrite the obtained integer with zero like we are doing for other architectures. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
1ad78434c7
commit
f4dc812c9e
4
cfg.mk
4
cfg.mk
@ -1093,7 +1093,7 @@ exclude_file_name_regexp--sc_require_config_h_first = \
|
||||
^(examples/|tools/virsh-edit\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_trailing_blank = \
|
||||
/qemuhelpdata/|/sysinfodata/.*\.data$$
|
||||
/qemuhelpdata/|/sysinfodata/.*\.data|/nodeinfodata/.*\.cpuinfo$$
|
||||
|
||||
exclude_file_name_regexp--sc_unmarked_diagnostics = \
|
||||
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
|
||||
@ -1124,4 +1124,4 @@ exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
|
||||
^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_empty_first_line = \
|
||||
^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/vmwareverdata/fusion-5.0.3.txt)$$
|
||||
^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/vmwareverdata/fusion-5.0.3.txt|tests/nodeinfodata/linux-raspberrypi/cpu/offline)$$
|
||||
|
@ -395,8 +395,8 @@ virNodeParseSocket(const char *dir,
|
||||
{
|
||||
int ret = virNodeGetCpuValue(dir, cpu, "topology/physical_package_id", 0);
|
||||
|
||||
if (ARCH_IS_PPC(arch) || ARCH_IS_S390(arch)) {
|
||||
/* ppc and s390(x) has -1 */
|
||||
if (ARCH_IS_ARM(arch) || ARCH_IS_PPC(arch) || ARCH_IS_S390(arch)) {
|
||||
/* arm, ppc and s390(x) has -1 */
|
||||
if (ret < 0)
|
||||
ret = 0;
|
||||
}
|
||||
|
12
tests/nodeinfodata/linux-armv6l-raspberrypi.cpuinfo
Normal file
12
tests/nodeinfodata/linux-armv6l-raspberrypi.cpuinfo
Normal file
@ -0,0 +1,12 @@
|
||||
Processor : ARMv6-compatible processor rev 7 (v6l)
|
||||
BogoMIPS : 697.95
|
||||
Features : swp half thumb fastmult vfp edsp java tls
|
||||
CPU implementer : 0x41
|
||||
CPU architecture: 7
|
||||
CPU variant : 0x0
|
||||
CPU part : 0xb76
|
||||
CPU revision : 7
|
||||
|
||||
Hardware : BCM2708
|
||||
Revision : 1000003
|
||||
Serial : 000000008fbfc895
|
1
tests/nodeinfodata/linux-armv6l-raspberrypi.expected
Normal file
1
tests/nodeinfodata/linux-armv6l-raspberrypi.expected
Normal file
@ -0,0 +1 @@
|
||||
CPUs: 1/1, MHz: 697, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1
|
@ -0,0 +1 @@
|
||||
0
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
0
|
@ -0,0 +1 @@
|
||||
-1
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
0
|
@ -0,0 +1 @@
|
||||
none
|
@ -0,0 +1 @@
|
||||
menu
|
1
tests/nodeinfodata/linux-raspberrypi/cpu/kernel_max
Normal file
1
tests/nodeinfodata/linux-raspberrypi/cpu/kernel_max
Normal file
@ -0,0 +1 @@
|
||||
0
|
1
tests/nodeinfodata/linux-raspberrypi/cpu/offline
Normal file
1
tests/nodeinfodata/linux-raspberrypi/cpu/offline
Normal file
@ -0,0 +1 @@
|
||||
|
1
tests/nodeinfodata/linux-raspberrypi/cpu/online
Normal file
1
tests/nodeinfodata/linux-raspberrypi/cpu/online
Normal file
@ -0,0 +1 @@
|
||||
0
|
1
tests/nodeinfodata/linux-raspberrypi/cpu/possible
Normal file
1
tests/nodeinfodata/linux-raspberrypi/cpu/possible
Normal file
@ -0,0 +1 @@
|
||||
0
|
1
tests/nodeinfodata/linux-raspberrypi/cpu/present
Normal file
1
tests/nodeinfodata/linux-raspberrypi/cpu/present
Normal file
@ -0,0 +1 @@
|
||||
0
|
@ -245,6 +245,7 @@ mymain(void)
|
||||
{"test6", VIR_ARCH_X86_64},
|
||||
{"test7", VIR_ARCH_X86_64},
|
||||
{"test8", VIR_ARCH_X86_64},
|
||||
{"raspberrypi", VIR_ARCH_ARMV6L},
|
||||
};
|
||||
|
||||
if (virInitialize() < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user