VBOX: If <disable_automatic_checkpoints/> is specified, automatically report completed checkpoints to the client as soon as the API requests them.

This commit is contained in:
Rom Walton 2015-04-16 18:48:38 -04:00
parent f63b3dea25
commit 1432538891
1 changed files with 26 additions and 5 deletions

View File

@ -369,6 +369,7 @@ int main(int argc, char** argv) {
APP_INIT_DATA aid;
VBOX_VM* pVM = NULL;
VBOX_CHECKPOINT checkpoint;
double desired_checkpoint_interval = 0;
double random_checkpoint_factor = 0;
double elapsed_time = 0;
double fraction_done = 0;
@ -496,6 +497,7 @@ int main(int argc, char** argv) {
srand((int)(vm_image_stat.st_mtime * time(NULL)));
}
random_checkpoint_factor = (double)(((int)(drand() * 100000.0)) % 600);
vboxlog_msg("Feature: Checkpoint interval offset (%d seconds)", (int)random_checkpoint_factor);
// Display trickle value if specified
@ -1035,10 +1037,17 @@ int main(int argc, char** argv) {
pVM->dump_hypervisor_status_reports();
}
// Real VM checkpoints (snapshots) are expensive, don't do them very often.
//
// If the project has disabled automatic checkpoints, just report that we have
// successfully completed the checkpoint as soon as the API reports that we should
// checkpoint.
//
if (boinc_time_to_checkpoint()) {
// Only peform a VM checkpoint every ten minutes or so.
//
if (elapsed_time >= last_checkpoint_elapsed_time + pVM->minimum_checkpoint_interval + random_checkpoint_factor) {
if (
(elapsed_time >= last_checkpoint_elapsed_time + desired_checkpoint_interval + random_checkpoint_factor) ||
pVM->disable_automatic_checkpoints
) {
// Basic interleave factor is only needed once.
if (random_checkpoint_factor > 0) {
random_checkpoint_factor = 0.0;
@ -1064,12 +1073,14 @@ int main(int argc, char** argv) {
}
}
// send elapsed-time trickle message if needed
// Send elapsed-time trickle message if needed
//
if (trickle_period) {
check_trickle_period(elapsed_time, trickle_period);
}
// Changes detected, re-read preferences
//
if (boinc_status.reread_init_data_file) {
boinc_status.reread_init_data_file = false;
@ -1079,7 +1090,17 @@ int main(int argc, char** argv) {
boinc_get_init_data_p(&aid);
set_throttles(aid, *pVM);
vboxlog_msg("Checkpoint Interval is now %d seconds.", (int)aid.checkpoint_period);
desired_checkpoint_interval = aid.checkpoint_period;
if (pVM->minimum_checkpoint_interval > aid.checkpoint_period) {
desired_checkpoint_interval = pVM->minimum_checkpoint_interval;
}
vboxlog_msg(
"Setting checkpoint interval to %d seconds. (Higher value of (Preference: %d seconds) or (Vbox_job.xml: %d seconds))",
(int)desired_checkpoint_interval,
(int)aid.checkpoint_period,
(int)pVM->minimum_checkpoint_interval
);
}
// if the VM has a maximum amount of time it is allowed to run,