Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
boinc
Commits
afd34b80
Commit
afd34b80
authored
10 years ago
by
Rom Walton
Browse files
Options
Downloads
Patches
Plain Diff
VBOX: Check for the completion file regardless if the VM is running or not.
parent
6f3fa7e3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
samples/vboxwrapper/vbox.cpp
+7
-0
7 additions, 0 deletions
samples/vboxwrapper/vbox.cpp
samples/vboxwrapper/vbox.h
+1
-1
1 addition, 1 deletion
samples/vboxwrapper/vbox.h
samples/vboxwrapper/vboxwrapper.cpp
+16
-26
16 additions, 26 deletions
samples/vboxwrapper/vboxwrapper.cpp
with
24 additions
and
27 deletions
samples/vboxwrapper/vbox.cpp
+
7
−
0
View file @
afd34b80
...
...
@@ -1941,6 +1941,13 @@ bool VBOX_VM::is_logged_failure_guest_job_out_of_memory() {
return
false
;
}
bool
VBOX_VM
::
is_logged_completion_file_exists
()
{
char
path
[
MAXPATHLEN
];
sprintf
(
path
,
"shared/%s"
,
completion_trigger_file
.
c_str
());
if
(
boinc_file_exists
(
path
))
return
true
;
return
false
;
}
bool
VBOX_VM
::
is_virtualbox_version_newer
(
int
maj
,
int
min
,
int
rel
)
{
int
vbox_major
=
0
,
vbox_minor
=
0
,
vbox_release
=
0
;
if
(
3
==
sscanf
(
virtualbox_version
.
c_str
(),
"%d.%d.%d"
,
&
vbox_major
,
&
vbox_minor
,
&
vbox_release
))
{
...
...
This diff is collapsed.
Click to expand it.
samples/vboxwrapper/vbox.h
+
1
−
1
View file @
afd34b80
...
...
@@ -205,7 +205,6 @@ public:
int
pause
();
int
resume
();
void
check_trickle_triggers
();
void
check_completion_trigger
();
int
create_snapshot
(
double
elapsed_time
);
int
cleanup_snapshots
(
bool
delete_active
);
int
restore_snapshot
();
...
...
@@ -223,6 +222,7 @@ public:
bool
is_logged_failure_vm_extensions_not_supported
();
bool
is_logged_failure_host_out_of_memory
();
bool
is_logged_failure_guest_job_out_of_memory
();
bool
is_logged_completion_file_exists
();
bool
is_virtualbox_version_newer
(
int
maj
,
int
min
,
int
rel
);
bool
is_virtualbox_error_recoverable
(
int
retval
);
...
...
This diff is collapsed.
Click to expand it.
samples/vboxwrapper/vboxwrapper.cpp
+
16
−
26
View file @
afd34b80
...
...
@@ -407,40 +407,22 @@ void set_remote_desktop_info(APP_INIT_DATA& /* aid */, VBOX_VM& vm) {
}
}
// check for completion trigger file
//
void
VBOX_VM
::
check_completion_trigger
()
{
void
extract_completion_file_info
(
VBOX_VM
&
vm
,
unsigned
long
&
exit_code
,
string
&
message
)
{
char
path
[
MAXPATHLEN
];
static
double
detect_time
=
0
;
char
buf
[
1024
]
;
if
(
detect_time
)
{
if
(
dtime
()
>
detect_time
+
60
)
{
cleanup
();
dump_hypervisor_logs
(
true
);
boinc_finish
(
0
);
}
return
;
}
sprintf
(
path
,
"shared/%s"
,
completion_trigger_file
.
c_str
());
if
(
!
boinc_file_exists
(
path
))
return
;
detect_time
=
dtime
();
#if 0
int exit_code = 0;
sprintf
(
path
,
"shared/%s"
,
vm
.
completion_trigger_file
.
c_str
());
FILE
*
f
=
fopen
(
path
,
"r"
);
if
(
f
)
{
char buf[1024]
;
message
=
""
;
if
(
fgets
(
buf
,
1024
,
f
)
!=
NULL
)
{
exit_code
=
atoi
(
buf
);
}
while
(
fgets
(
buf
,
1024
,
f
)
!=
NULL
)
{
fputs(buf, stderr)
;
message
+=
buf
;
}
fclose
(
f
);
}
cleanup();
dump_hypervisor_logs(true);
boinc_finish(exit_code);
#endif
}
// check for trickle trigger files, and send trickles if find them.
...
...
@@ -1074,6 +1056,17 @@ int main(int argc, char** argv) {
vm
.
dump_hypervisor_logs
(
true
);
boinc_finish
(
EXIT_ABORTED_BY_CLIENT
);
}
if
(
vm
.
is_logged_completion_file_exists
())
{
vm
.
reset_vm_process_priority
();
vm
.
cleanup
();
fprintf
(
stderr
,
"%s VM Completion File Detected.
\n
"
,
vboxwrapper_msg_prefix
(
buf
,
sizeof
(
buf
))
);
extract_completion_file_info
(
vm
,
vm_exit_code
,
message
);
boinc_finish
(
vm_exit_code
);
}
if
(
!
vm
.
online
)
{
// Is this a type of event we can recover from?
if
(
vm
.
is_logged_failure_host_out_of_memory
())
{
...
...
@@ -1160,9 +1153,6 @@ int main(int argc, char** argv) {
if
((
loop_iteration
%
10
)
==
0
)
{
current_cpu_time
=
starting_cpu_time
+
vm
.
get_vm_cpu_time
();
vm
.
check_trickle_triggers
();
if
(
!
vm
.
completion_trigger_file
.
empty
())
{
vm
.
check_completion_trigger
();
}
}
if
(
vm
.
job_duration
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment