mirror of https://github.com/BOINC/boinc.git
VBOX: Make the VM memory size something that can be overridden via the command line.
TODO: Refactor how command line options and vbox_job.xml options are handled. This was a ugly hack.
This commit is contained in:
parent
514a132bfc
commit
99c8c678dd
|
@ -480,10 +480,10 @@ int VBOX_VM::create_vm() {
|
|||
stderr,
|
||||
"%s Setting Memory Size for VM. (%sMB)\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf)),
|
||||
memory_size_mb.c_str()
|
||||
vm_memory_size_mb.c_str()
|
||||
);
|
||||
command = "modifyvm \"" + vm_name + "\" ";
|
||||
command += "--memory " + memory_size_mb + " ";
|
||||
command += "--memory " + vm_memory_size_mb + " ";
|
||||
|
||||
retval = vbm_popen(command, output, "modifymem");
|
||||
if (retval) return retval;
|
||||
|
|
|
@ -92,8 +92,8 @@ public:
|
|||
// unique name for the VM or UUID of a stale VM if deregistering it
|
||||
std::string vm_cpu_count;
|
||||
// required CPU core count
|
||||
std::string memory_size_mb;
|
||||
// size of the memory allocation for the VM, in megabytes
|
||||
std::string vm_memory_size_mb;
|
||||
// required size of the memory allocation for the VM, in megabytes
|
||||
std::string image_filename;
|
||||
// name of the virtual machine disk image file
|
||||
std::string iso_image_filename;
|
||||
|
@ -132,6 +132,8 @@ public:
|
|||
// the type of disk controller to emulate
|
||||
std::string vm_disk_controller_model;
|
||||
// the disk controller model to emulate
|
||||
double memory_size_mb;
|
||||
// size of the memory allocation for the VM, in megabytes
|
||||
bool enable_cern_dataformat;
|
||||
// whether to use CERN specific data structures
|
||||
bool enable_isocontextualization;
|
||||
|
|
|
@ -193,7 +193,7 @@ int parse_job_file(VBOX_VM& vm) {
|
|||
else if (xp.parse_string("vm_disk_controller_type", vm.vm_disk_controller_type)) continue;
|
||||
else if (xp.parse_string("vm_disk_controller_model", vm.vm_disk_controller_model)) continue;
|
||||
else if (xp.parse_string("os_name", vm.os_name)) continue;
|
||||
else if (xp.parse_string("memory_size_mb", vm.memory_size_mb)) continue;
|
||||
else if (xp.parse_double("memory_size_mb", vm.memory_size_mb)) continue;
|
||||
else if (xp.parse_double("job_duration", vm.job_duration)) continue;
|
||||
else if (xp.parse_double("minimum_checkpoint_interval", vm.minimum_checkpoint_interval)) continue;
|
||||
else if (xp.parse_string("fraction_done_filename", vm.fraction_done_filename)) continue;
|
||||
|
@ -514,6 +514,7 @@ int main(int argc, char** argv) {
|
|||
double bytes_sent = 0;
|
||||
double bytes_received = 0;
|
||||
double ncpus = 0;
|
||||
double memory_size_mb = 0;
|
||||
double timeout = 0.0;
|
||||
bool report_net_usage = false;
|
||||
double net_usage_timer = 600;
|
||||
|
@ -527,9 +528,12 @@ int main(int argc, char** argv) {
|
|||
if (!strcmp(argv[i], "--trickle")) {
|
||||
trickle_period = atof(argv[++i]);
|
||||
}
|
||||
if (!strcmp(argv[i], "--nthreads")) {
|
||||
if (!strcmp(argv[i], "--ncpus")) {
|
||||
ncpus = atof(argv[++i]);
|
||||
}
|
||||
if (!strcmp(argv[i], "--memory_size_mb")) {
|
||||
memory_size_mb = atof(argv[++i]);
|
||||
}
|
||||
if (!strcmp(argv[i], "--vmimage")) {
|
||||
vm_image = atoi(argv[++i]);
|
||||
}
|
||||
|
@ -831,7 +835,14 @@ int main(int argc, char** argv) {
|
|||
} else {
|
||||
vm.vm_cpu_count = "1";
|
||||
}
|
||||
|
||||
if (vm.memory_size_mb > 1.0 || memory_size_mb > 1.0) {
|
||||
if (memory_size_mb) {
|
||||
sprintf(buf, "%d", (int)ceil(memory_size_mb));
|
||||
} else {
|
||||
sprintf(buf, "%d", (int)ceil(vm.memory_size_mb));
|
||||
}
|
||||
vm.vm_memory_size_mb = buf;
|
||||
}
|
||||
if (aid.vbox_window && !aid.using_sandbox) {
|
||||
vm.headless = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue