- client and scheduler: a client host may have multiple VM systems installed.

TODO: check for VirtualBox on Mac, Linux

svn path=/trunk/boinc/; revision=22704
This commit is contained in:
David Anderson 2010-11-17 23:19:07 +00:00
parent 1564a49816
commit 3355b66241
7 changed files with 58 additions and 42 deletions

View File

@ -8137,3 +8137,17 @@ Rom 17 Nov 2010
boinc_db.h
sched/
sched_types.cpp
David 17 Nov 2010
- client and scheduler: a client host may have multiple VM systems installed.
TODO: check for VirtualBox on Mac, Linux
client/
client_state.cpp
hostinfo_win.cpp
db/
boinc_db.h
lib/
hostinfo.cpp,h
sched/
sched_types.cpp

View File

@ -188,10 +188,10 @@ void CLIENT_STATE::show_host_info() {
tz<0?"":"+", tz
);
if (strlen(host_info.vm_version)) {
if (strlen(host_info.virtualbox_version)) {
msg_printf(NULL, MSG_INFO,
"Detected: %s %s",
host_info.vm_name, host_info.vm_version
"VirtualBox version: %s",
host_info.virtualbox_version
);
}
}

View File

@ -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;
DWORD dwSize = 0;
@ -1104,12 +1103,9 @@ int get_network_usage_totals(unsigned int& total_received, unsigned int& total_s
}
// Check, if any, virtual machine technology is supported on the host
// see if Virtualbox is installed
//
int get_virtualmachine_information(
char* vm_name, int /*vm_name_size*/, char* vm_version, int vm_version_size
)
{
int HOST_INFO::get_virtualbox_version() {
HKEY hKey;
char szInstallDir[256];
char szVersion[256];
@ -1117,24 +1113,29 @@ int get_virtualmachine_information(
DWORD dwVersion = sizeof(szVersion);
LONG lRet;
strcpy(virtualbox_version, "");
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"SOFTWARE\\Oracle\\VirtualBox",
0, KEY_QUERY_VALUE, &hKey );
if( lRet == ERROR_SUCCESS ) {
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, "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;
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));
safe_strcpy(virtualbox_version, szVersion);
}
}
@ -1152,9 +1153,7 @@ 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_virtualbox_version();
get_processor_info(
p_vendor, sizeof(p_vendor),
p_model, sizeof(p_model),

View File

@ -334,8 +334,7 @@ struct HOST {
// the following not stored in DB
//
char p_features[1024];
char vm_name[256];
char vm_version[256];
char virtualbox_version[256];
int parse(FILE*);
int parse_time_stats(FILE*);

View File

@ -68,8 +68,7 @@ void HOST_INFO::clear_host_info() {
strcpy(os_name, "");
strcpy(os_version, "");
strcpy(vm_name, "");
strcpy(vm_version, "");
strcpy(virtualbox_version, "");
coprocs.clear();
}
@ -112,8 +111,7 @@ 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 (parse_str(buf, "<virtualbox_version>", virtualbox_version, sizeof(virtualbox_version))) continue;
else if (match_tag(buf, "<coprocs>")) {
coprocs.parse(in);
}
@ -131,7 +129,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], vmn[256], vmv[256];
char pv[265], pm[256], pf[256], osn[256], osv[256];
out.printf(
"<host_info>\n"
" <timezone>%d</timezone>\n",
@ -150,8 +148,6 @@ 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"
@ -168,9 +164,7 @@ 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"
" <vm_name>%s</vm_name>\n"
" <vm_version>%s</vm_version>\n",
" <os_version>%s</os_version>\n",
host_cpid,
p_ncpus,
pv,
@ -186,10 +180,16 @@ int HOST_INFO::write(
d_total,
d_free,
osn,
osv,
vmn,
vmv
osv
);
if (strlen(virtualbox_version)) {
char buf[256];
xml_escape(virtualbox_version, buf, sizeof(buf));
out.printf(
" <virtualbox_version>%s</virtualbox_version>\n",
buf
);
}
if (include_coprocs) {
coprocs.write_xml(out, false);
}

View File

@ -31,6 +31,8 @@
#include "miofile.h"
#include "coproc.h"
// if you add fields, update clear_host_info()
class HOST_INFO {
public:
int timezone; // local STANDARD time - UTC time (in seconds)
@ -58,8 +60,10 @@ public:
char os_name[256];
char os_version[256];
char vm_name[256];
char vm_version[256];
// the following are non-empty if that VM system is installed
//
char virtualbox_version[256];
// ... add entries for VMWare, others
COPROCS coprocs;
@ -78,6 +82,7 @@ public:
#endif
int get_host_info();
int get_local_network_info();
int get_virtualbox_version();
void clear_host_info();
void make_random_string(const char* salt, char* out);
void generate_host_cpid();

View File

@ -1170,8 +1170,7 @@ int HOST::parse(FILE* fin) {
if (parse_double(buf, "<n_bwup>", n_bwup)) continue;
if (parse_double(buf, "<n_bwdown>", n_bwdown)) continue;
if (parse_str(buf, "<p_features>", p_features, sizeof(p_features))) continue;
if (parse_str(buf, "<vm_name>", vm_name, sizeof(vm_name))) continue;
if (parse_str(buf, "<vm_version>", vm_version, sizeof(vm_version))) continue;
if (parse_str(buf, "<virtualbox_version>", virtualbox_version, sizeof(virtualbox_version))) continue;
// parse deprecated fields to avoid error messages
//