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:
Michal Privoznik 2014-06-17 11:22:05 +02:00 committed by Michal Privoznik
parent 1ad78434c7
commit f4dc812c9e
18 changed files with 31 additions and 4 deletions

4
cfg.mk
View File

@ -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)$$

View File

@ -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;
}

View 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

View File

@ -0,0 +1 @@
CPUs: 1/1, MHz: 697, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
none

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
0

View File

@ -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)