mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 11669: report host cpu freq from /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq. It's a bug in libvirt: http://comments.gmane.org/gmane.comp.emulators.libvirt/33277
status 11669: resolved fixed bug 11669: divide 1000, mgt server needs Mhz status 11669: resolved fixed
This commit is contained in:
parent
962bbcd5a0
commit
29e389eb87
@ -19,11 +19,15 @@
|
||||
|
||||
package com.cloud.agent.resource.computing;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@ -2882,9 +2886,24 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
try {
|
||||
Connect conn = LibvirtConnection.getConnection();
|
||||
final NodeInfo hosts = conn.nodeInfo();
|
||||
|
||||
boolean result = false;
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"));
|
||||
speed = Long.parseLong(in.readLine())/1000;
|
||||
result = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
speed = hosts.mhz;
|
||||
}
|
||||
|
||||
cpus = hosts.cpus;
|
||||
speed = hosts.mhz;
|
||||
ram = hosts.memory * 1024L;
|
||||
LibvirtCapXMLParser parser = new LibvirtCapXMLParser();
|
||||
parser.parseCapabilitiesXML(conn.getCapabilities());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user