client and API: pass list of app version files in init_data.xml

This lets wrappers check that executables specified in job.xml are signed.
This commit is contained in:
David Anderson 2015-08-19 21:01:09 -07:00
parent 52a9a3e746
commit 21817420af
4 changed files with 64 additions and 50 deletions

View File

@ -195,26 +195,27 @@ int ACTIVE_TASK::get_shmem_seg_name() {
}
void ACTIVE_TASK::init_app_init_data(APP_INIT_DATA& aid) {
PROJECT* project = wup->project;
aid.major_version = BOINC_MAJOR_VERSION;
aid.minor_version = BOINC_MINOR_VERSION;
aid.release = BOINC_RELEASE;
aid.app_version = app_version->version_num;
safe_strcpy(aid.app_name, wup->app->name);
safe_strcpy(aid.symstore, wup->project->symstore);
safe_strcpy(aid.symstore, project->symstore);
safe_strcpy(aid.acct_mgr_url, gstate.acct_mgr_info.master_url);
if (wup->project->project_specific_prefs.length()) {
if (project->project_specific_prefs.length()) {
aid.project_preferences = strdup(
wup->project->project_specific_prefs.c_str()
project->project_specific_prefs.c_str()
);
}
aid.userid = wup->project->userid;
aid.teamid = wup->project->teamid;
aid.hostid = wup->project->hostid;
safe_strcpy(aid.user_name, wup->project->user_name);
safe_strcpy(aid.team_name, wup->project->team_name);
safe_strcpy(aid.project_dir, wup->project->project_dir_absolute());
aid.userid = project->userid;
aid.teamid = project->teamid;
aid.hostid = project->hostid;
safe_strcpy(aid.user_name, project->user_name);
safe_strcpy(aid.team_name, project->team_name);
safe_strcpy(aid.project_dir, project->project_dir_absolute());
relative_to_absolute("", aid.boinc_dir);
safe_strcpy(aid.authenticator, wup->project->authenticator);
safe_strcpy(aid.authenticator, project->authenticator);
aid.slot = slot;
#ifdef _WIN32
if (strstr(gstate.host_info.os_name, "Windows 2000")) {
@ -229,13 +230,13 @@ void ACTIVE_TASK::init_app_init_data(APP_INIT_DATA& aid) {
#endif
safe_strcpy(aid.wu_name, wup->name);
safe_strcpy(aid.result_name, result->name);
aid.user_total_credit = wup->project->user_total_credit;
aid.user_expavg_credit = wup->project->user_expavg_credit;
aid.host_total_credit = wup->project->host_total_credit;
aid.host_expavg_credit = wup->project->host_expavg_credit;
aid.user_total_credit = project->user_total_credit;
aid.user_expavg_credit = project->user_expavg_credit;
aid.host_total_credit = project->host_total_credit;
aid.host_expavg_credit = project->host_expavg_credit;
double rrs = gstate.runnable_resource_share(RSC_TYPE_CPU);
if (rrs) {
aid.resource_share_fraction = wup->project->resource_share/rrs;
aid.resource_share_fraction = project->resource_share/rrs;
} else {
aid.resource_share_fraction = 1;
}
@ -287,6 +288,11 @@ void ACTIVE_TASK::init_app_init_data(APP_INIT_DATA& aid) {
aid.shmem_seg_name = shmem_seg_name;
#endif
aid.wu_cpu_time = checkpoint_cpu_time;
APP_VERSION* avp = app_version;
for (unsigned int i=0; i<avp->app_files.size(); i++) {
FILE_REF& fref = avp->app_files[i];
aid.app_files.push_back(string(fref.file_name));
}
}
// write the app init file.

View File

@ -217,7 +217,7 @@ int PROJECT::parse_state(XML_PARSER& xp) {
}
if (xp.parse_int("nrpc_failures", nrpc_failures)) continue;
if (xp.parse_int("master_fetch_failures", master_fetch_failures)) continue;
if (xp.parse_double("min_rpc_time", min_rpc_time)) continue;
if (xp.parse_double("min_rpc_time", x)) continue;
if (xp.parse_bool("master_url_fetch_pending", master_url_fetch_pending)) continue;
if (xp.parse_int("sched_rpc_pending", sched_rpc_pending)) continue;
if (xp.parse_double("next_rpc_time", next_rpc_time)) continue;

View File

@ -79,45 +79,46 @@ void APP_INIT_DATA::copy(const APP_INIT_DATA& a) {
// use assignment for the rest, especially the classes
// (so that the overloaded operators are called!)
major_version = a.major_version;
minor_version = a.minor_version;
release = a.release;
app_version = a.app_version;
userid = a.userid;
teamid = a.teamid;
hostid = a.hostid;
slot = a.slot;
client_pid = a.client_pid;
user_total_credit = a.user_total_credit;
user_expavg_credit = a.user_expavg_credit;
host_total_credit = a.host_total_credit;
host_expavg_credit = a.host_expavg_credit;
resource_share_fraction = a.resource_share_fraction;
host_info = a.host_info;
proxy_info = a.proxy_info;
global_prefs = a.global_prefs;
starting_elapsed_time = a.starting_elapsed_time;
using_sandbox = a.using_sandbox;
vm_extensions_disabled = a.vm_extensions_disabled;
rsc_fpops_est = a.rsc_fpops_est;
rsc_fpops_bound = a.rsc_fpops_bound;
rsc_memory_bound = a.rsc_memory_bound;
rsc_disk_bound = a.rsc_disk_bound;
computation_deadline = a.computation_deadline;
fraction_done_start = a.fraction_done_start;
fraction_done_end = a.fraction_done_end;
gpu_device_num = a.gpu_device_num;
gpu_opencl_dev_index = a.gpu_opencl_dev_index;
gpu_usage = a.gpu_usage;
ncpus = a.ncpus;
checkpoint_period = a.checkpoint_period;
wu_cpu_time = a.wu_cpu_time;
major_version = a.major_version;
minor_version = a.minor_version;
release = a.release;
app_version = a.app_version;
userid = a.userid;
teamid = a.teamid;
hostid = a.hostid;
slot = a.slot;
client_pid = a.client_pid;
user_total_credit = a.user_total_credit;
user_expavg_credit = a.user_expavg_credit;
host_total_credit = a.host_total_credit;
host_expavg_credit = a.host_expavg_credit;
resource_share_fraction = a.resource_share_fraction;
host_info = a.host_info;
proxy_info = a.proxy_info;
global_prefs = a.global_prefs;
starting_elapsed_time = a.starting_elapsed_time;
using_sandbox = a.using_sandbox;
vm_extensions_disabled = a.vm_extensions_disabled;
rsc_fpops_est = a.rsc_fpops_est;
rsc_fpops_bound = a.rsc_fpops_bound;
rsc_memory_bound = a.rsc_memory_bound;
rsc_disk_bound = a.rsc_disk_bound;
computation_deadline = a.computation_deadline;
fraction_done_start = a.fraction_done_start;
fraction_done_end = a.fraction_done_end;
gpu_device_num = a.gpu_device_num;
gpu_opencl_dev_index = a.gpu_opencl_dev_index;
gpu_usage = a.gpu_usage;
ncpus = a.ncpus;
checkpoint_period = a.checkpoint_period;
wu_cpu_time = a.wu_cpu_time;
if (a.project_preferences) {
project_preferences = strdup(a.project_preferences);
} else {
project_preferences = NULL;
}
vbox_window = a.vbox_window;
vbox_window = a.vbox_window;
app_files = a.app_files;
}
int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
@ -238,6 +239,9 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
ai.host_info.write(mf, true, true);
ai.proxy_info.write(mf);
ai.global_prefs.write(mf);
for (unsigned int i=0; i<ai.app_files.size(); i++) {
fprintf(f, "<app_file>%s</app_file>\n", ai.app_files[i].c_str());
}
fprintf(f, "</app_init_data>\n");
return 0;
}

View File

@ -202,6 +202,10 @@ struct APP_INIT_DATA {
//
bool vbox_window; // whether to open a console window for VM apps
// list of files in the app version (for wrappers)
//
std::vector<std::string> app_files;
// Items used by the BOINC runtime system
//
double checkpoint_period; // recommended checkpoint period