vboxwrapper: if VM memory size is < 512MB, set it to 512MB

Add 'boinc_resolve' script: use within a VM to resolve soft links
(useful now that we can share the project dir)

worker (example app for Vbox tests):
    take in/out filenames as args

create_work: make the default 1 (total) result.

update_versions: add --verbose option
This commit is contained in:
David Anderson 2023-12-14 00:34:32 -08:00
parent 6910361c26
commit 6951d1c1d7
7 changed files with 83 additions and 43 deletions

View File

@ -0,0 +1,3 @@
#! /bin/sh
sed 's/<soft_link>..\/..\/projects\///; s/[^\/]*\//\/root\/project\//; s/<\/soft_link>//' $1 | tr -d '\r\n'

View File

@ -767,6 +767,13 @@ int main(int argc, char** argv) {
pVM->memory_size_mb = memory_size_mb;
}
if (pVM->memory_size_mb < MIN_MEMORY_SIZE_MB) {
vboxlog_msg("Memory size %dMB is too small; setting to %dMB",
pVM->memory_size_mb, MIN_MEMORY_SIZE_MB
);
pVM->memory_size_mb = MIN_MEMORY_SIZE_MB;
}
if (aid.vbox_window && !aid.using_sandbox) {
pVM->headless = false;
}

View File

@ -19,6 +19,8 @@
#ifndef BOINC_VBOXWRAPPER_H
#define BOINC_VBOXWRAPPER_H
#define MIN_MEMORY_SIZE_MB 512
#define IMAGE_FILENAME_COMPLETE "vm_image.vdi"
#define IMAGE_FILENAME "vm_image"
#define IMAGE_FILENAME_EXTENSION "vdi"

View File

@ -1,7 +1,7 @@
CXXFLAGS += -g
CXX ?= g++
WORKER_RELEASE = 1_x86_64-pc-linux-gnu
WORKER_RELEASE = 2_x86_64-pc-linux-gnu
PROGS = worker_$(WORKER_RELEASE)

View File

@ -18,12 +18,11 @@
// worker - application without BOINC runtime system;
// used for testing wrappers.
//
// worker [--std] [--file] nsecs
// worker [--nsecs N] infile outfile
//
// --std: stdin to stdout
// --file_copy: "in" to "out"
// In both cases, convert to uppercase
// nsecs: use this much CPU time (default 10 sec)
// copy infile to outfile, converting to uppercase
// if infile is 'stdin', use stdin; same for stdout
// --nsecs: use about N sec of CPU time
//
// THIS PROGRAM CAN'T USE ANY BOINC CODE. That's the whole point.
@ -58,45 +57,49 @@ void copy_uc(FILE* fin, FILE* fout) {
}
int main(int argc, char** argv) {
FILE* in, *out;
int i, nsec = 10;
bool std = false, file = false;
FILE* in=0, *out=0;
int i, nsecs = 0;
char c;
for (i=1; i<argc; i++) {
if (!strcmp(argv[i], "--std")) {
std = true;
if (!strcmp(argv[i], "--nsecs")) {
nsecs = atoi(argv[++i]);
}
if (!strcmp(argv[i], "--file")) {
file = true;
if (!in) {
if (!strcmp(argv[i], "stdin")) {
in = stdin;
} else {
in = fopen(argv[i], "r");
if (!in) {
fprintf(stderr, "missing input file\n");
exit(1);
}
}
} else {
if (!strcmp(argv[i], "stdout")) {
out = stdout;
} else {
out = fopen(argv[i], "w");
if (!out) {
fprintf(stderr, "missing output file\n");
exit(1);
}
}
}
nsec = atoi(argv[i]);
}
if (!in || !out) {
fprintf(stderr, "worker: no files specified\n");
exit(1);
}
fprintf(stderr, "worker: starting\n");
if (file) {
in = fopen("in", "r");
if (!in) {
fprintf(stderr, "missing input file\n");
exit(1);
}
out = fopen("out", "w");
if (!out) {
fprintf(stderr, "can't open output file\n");
exit(1);
}
copy_uc(in, out);
}
if (std) {
copy_uc(stdin, stdout);
}
copy_uc(in, out);
int start = (int)time(0);
i=0;
while (time(0) < start+nsec) {
while (time(0) < start+nsecs) {
do_a_giga_flop(i++);
}

View File

@ -28,9 +28,9 @@
//
#define DEFAULT_MIN_QUORUM 1
#define DEFAULT_TARGET_NRESULTS 1
#define DEFAULT_MAX_ERROR_RESULTS 3
#define DEFAULT_MAX_TOTAL_RESULTS 10
#define DEFAULT_MAX_SUCCESS_RESULTS 6
#define DEFAULT_MAX_ERROR_RESULTS 1
#define DEFAULT_MAX_TOTAL_RESULTS 1
#define DEFAULT_MAX_SUCCESS_RESULTS 1
#define DEFAULT_RSC_FPOPS_EST 3600.e9
#define DEFAULT_RSC_FPOPS_BOUND 86400.e9
#define DEFAULT_RSC_MEMORY_BOUND 5.e8

View File

@ -22,6 +22,10 @@
// script to create app versions,
// and stage their files in the download dir.
// See https://github.com/BOINC/boinc/wiki/AppVersionNew
//
// options:
// --noconfirm: don't ask for confirmation of anything
// --verbose: print details
error_reporting(E_ALL);
@ -36,6 +40,7 @@ chdir ("../..");
$apps = BoincApp::enum("");
$platforms = BoincPlatform::enum("");
$confirm = true;
$verbose = false;
$config = file_get_contents("config.xml");
if (!$config) die("config.xml not found. Run this in project root dir.\n");
@ -162,15 +167,17 @@ function update_file($fds, $fd) {
// move file to download dir, check immutability, fill in $fd->url
//
function stage_file($a, $v, $p, $fd) {
global $download_url, $download_dir;
global $download_url, $download_dir, $verbose;
$name = $fd->physical_name;
$path = "apps/$a/$v/$p/$name";
$dl_path = "$download_dir/$name";
if (is_file($dl_path)) {
if ($verbose) echo "md5 check start\n";
if (md5_file($path) != md5_file($dl_path)) {
die ("Error: files $path and $dl_path differ.\nBOINC files are immutable.\nIf you change a file, you must give it a new name.\n");
}
if ($verbose) echo "md5 check end\n";
} else {
$subdirs = dirname($name);
if ($subdirs) {
@ -214,8 +221,9 @@ function get_api_version($a, $v, $p, $fds) {
$sig_gen_confirmed = false;
function confirm_sig_gen($name) {
global $sig_gen_confirmed;
global $sig_gen_confirmed, $confirm;
if (!$confirm) return true;
if ($sig_gen_confirmed) return true;
echo "
@ -238,7 +246,12 @@ function confirm_sig_gen($name) {
// process a file
//
function process_file($a, $v, $p, $name, $fds) {
global $key_dir, $confirm;
global $key_dir, $confirm, $verbose;
if ($verbose) {
echo "process_file(): $a/$v/$p/$name\n";
}
$fd = lookup_file($fds, $name);
if (!$fd) {
$fd = new StdClass;
@ -271,7 +284,9 @@ function process_file($a, $v, $p, $name, $fds) {
}
}
if ($verbose) echo "stage start\n";
$fd = stage_file($a, $v, $p, $fd);
if ($verbose) echo "stage done\n";
if (!isset($fd->executable)) {
$perms = fileperms($path);
@ -422,12 +437,16 @@ function convert_simplexml($x) {
}
function process_version($a, $v, $p) {
global $confirm;
echo "Found app version directory for: $a $v $p\n";
global $confirm, $verbose;
if ($verbose) {
echo "Found app version directory for: $a $v $p\n";
}
$app = lookup_app($a);
parse_platform_name($p, $platform, $plan_class);
if (already_exists($a, $v, $platform, $plan_class)) {
echo " (already exists in database)\n";
if ($verbose) {
echo " (already exists in database)\n";
}
return;
}
$vfile = "apps/$a/$v/$p/version.xml";
@ -556,8 +575,14 @@ function scan_apps() {
}
}
if (count($argv)>1 && $argv[1]=='--noconfirm') {
$confirm = false;
foreach (array_slice($argv, 1) as $arg) {
if ($arg == '--noconfirm') {
$confirm = false;
} else if ($arg == '--verbose') {
$verbose = true;
} else {
die("unknown arg $arg\n");
}
}
scan_apps();