mirror of https://github.com/BOINC/boinc.git
- client: Add support to detect VirtualBox VM software.
client/ client_state.cpp hostinfo_win.cpp lib/ hostinfo.cpp, .h svn path=/trunk/boinc/; revision=22702
This commit is contained in:
parent
8d9cf013c5
commit
f0ae0b832d
|
@ -8119,3 +8119,13 @@ David 17 Nov 2010
|
|||
work_fetch.cpp
|
||||
html/ops/
|
||||
team_export.php
|
||||
|
||||
Rom 17 Nov 2010
|
||||
- client: Add support to detect VirtualBox VM software.
|
||||
|
||||
client/
|
||||
client_state.cpp
|
||||
hostinfo_win.cpp
|
||||
lib/
|
||||
hostinfo.cpp, .h
|
||||
|
|
@ -187,6 +187,13 @@ void CLIENT_STATE::show_host_info() {
|
|||
msg_printf(0, MSG_INFO, "Local time is UTC %s%d hours",
|
||||
tz<0?"":"+", tz
|
||||
);
|
||||
|
||||
if (strlen(host_info.vm_version)) {
|
||||
msg_printf(NULL, MSG_INFO,
|
||||
"Detected: %s %s",
|
||||
host_info.vm_name, host_info.vm_version
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void check_no_apps(PROJECT* p) {
|
||||
|
|
|
@ -1058,7 +1058,6 @@ int get_processor_info(
|
|||
// detect the network usage totals for the host.
|
||||
//
|
||||
int get_network_usage_totals(unsigned int& total_received, unsigned int& total_sent) {
|
||||
|
||||
// Declare and initialize variables.
|
||||
int i;
|
||||
int iRetVal = 0;
|
||||
|
@ -1102,7 +1101,45 @@ int get_network_usage_totals(unsigned int& total_received, unsigned int& total_s
|
|||
}
|
||||
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
// Check, if any, virtual machine technology is supported on the host
|
||||
//
|
||||
int get_virtualmachine_information(
|
||||
char* vm_name, int /*vm_name_size*/, char* vm_version, int vm_version_size
|
||||
)
|
||||
{
|
||||
HKEY hKey;
|
||||
char szInstallDir[256];
|
||||
char szVersion[256];
|
||||
DWORD dwInstallDir = sizeof(szInstallDir);
|
||||
DWORD dwVersion = sizeof(szVersion);
|
||||
LONG lRet;
|
||||
|
||||
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
|
||||
"SOFTWARE\\Oracle\\VirtualBox",
|
||||
0, KEY_QUERY_VALUE, &hKey );
|
||||
if( lRet == ERROR_SUCCESS ) {
|
||||
|
||||
lRet = RegQueryValueEx( hKey, "InstallDir", NULL, NULL,
|
||||
(LPBYTE) szInstallDir, &dwInstallDir);
|
||||
if( (lRet != ERROR_SUCCESS) || (dwInstallDir > sizeof(szInstallDir)) ) return 1;
|
||||
|
||||
lRet = RegQueryValueEx( hKey, "Version", NULL, NULL,
|
||||
(LPBYTE) szVersion, &dwVersion);
|
||||
if( (lRet != ERROR_SUCCESS) || (dwVersion > sizeof(szVersion)) ) return 1;
|
||||
|
||||
strncat(szInstallDir, "\\virtualbox.exe", sizeof(szInstallDir) - strlen(szInstallDir));
|
||||
|
||||
if (boinc_file_exists(szInstallDir)) {
|
||||
strcpy(vm_name, "VirtualBox");
|
||||
strncpy(vm_version, szVersion, vm_version_size - strlen(szVersion));
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey( hKey );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1115,6 +1152,9 @@ int HOST_INFO::get_host_info() {
|
|||
get_os_information(
|
||||
os_name, sizeof(os_name), os_version, sizeof(os_version)
|
||||
);
|
||||
get_virtualmachine_information(
|
||||
vm_name, sizeof(vm_name), vm_version, sizeof(vm_version)
|
||||
);
|
||||
get_processor_info(
|
||||
p_vendor, sizeof(p_vendor),
|
||||
p_model, sizeof(p_model),
|
||||
|
|
|
@ -68,6 +68,9 @@ void HOST_INFO::clear_host_info() {
|
|||
strcpy(os_name, "");
|
||||
strcpy(os_version, "");
|
||||
|
||||
strcpy(vm_name, "");
|
||||
strcpy(vm_version, "");
|
||||
|
||||
coprocs.clear();
|
||||
}
|
||||
|
||||
|
@ -109,6 +112,8 @@ int HOST_INFO::parse(MIOFILE& in, bool benchmarks_only) {
|
|||
else if (parse_double(buf, "<d_free>", d_free)) continue;
|
||||
else if (parse_str(buf, "<os_name>", os_name, sizeof(os_name))) continue;
|
||||
else if (parse_str(buf, "<os_version>", os_version, sizeof(os_version))) continue;
|
||||
else if (parse_str(buf, "<vm_name>", vm_name, sizeof(vm_name))) continue;
|
||||
else if (parse_str(buf, "<vm_version>", vm_version, sizeof(vm_version))) continue;
|
||||
else if (match_tag(buf, "<coprocs>")) {
|
||||
coprocs.parse(in);
|
||||
}
|
||||
|
@ -126,7 +131,7 @@ int HOST_INFO::parse(MIOFILE& in, bool benchmarks_only) {
|
|||
int HOST_INFO::write(
|
||||
MIOFILE& out, bool include_net_info, bool include_coprocs
|
||||
) {
|
||||
char pv[265], pm[256], pf[256], osn[256], osv[256];
|
||||
char pv[265], pm[256], pf[256], osn[256], osv[256], vmn[256], vmv[256];
|
||||
out.printf(
|
||||
"<host_info>\n"
|
||||
" <timezone>%d</timezone>\n",
|
||||
|
@ -145,6 +150,8 @@ int HOST_INFO::write(
|
|||
xml_escape(p_features, pf, sizeof(pf));
|
||||
xml_escape(os_name, osn, sizeof(osn));
|
||||
xml_escape(os_version, osv, sizeof(osv));
|
||||
xml_escape(vm_name, vmn, sizeof(vmn));
|
||||
xml_escape(vm_version, vmv, sizeof(vmv));
|
||||
out.printf(
|
||||
" <host_cpid>%s</host_cpid>\n"
|
||||
" <p_ncpus>%d</p_ncpus>\n"
|
||||
|
@ -161,7 +168,9 @@ int HOST_INFO::write(
|
|||
" <d_total>%f</d_total>\n"
|
||||
" <d_free>%f</d_free>\n"
|
||||
" <os_name>%s</os_name>\n"
|
||||
" <os_version>%s</os_version>\n",
|
||||
" <os_version>%s</os_version>\n"
|
||||
" <vm_name>%s</vm_name>\n"
|
||||
" <vm_version>%s</vm_version>\n",
|
||||
host_cpid,
|
||||
p_ncpus,
|
||||
pv,
|
||||
|
@ -177,7 +186,9 @@ int HOST_INFO::write(
|
|||
d_total,
|
||||
d_free,
|
||||
osn,
|
||||
osv
|
||||
osv,
|
||||
vmn,
|
||||
vmv
|
||||
);
|
||||
if (include_coprocs) {
|
||||
coprocs.write_xml(out, false);
|
||||
|
|
|
@ -58,6 +58,9 @@ public:
|
|||
char os_name[256];
|
||||
char os_version[256];
|
||||
|
||||
char vm_name[256];
|
||||
char vm_version[256];
|
||||
|
||||
COPROCS coprocs;
|
||||
|
||||
HOST_INFO();
|
||||
|
|
Loading…
Reference in New Issue