
On Thu, Dec 4, 2014 at 5:18 AM, Michal Privoznik <mprivozn@redhat.com> wrote:
On 14.11.2014 17:03, Conrad Meyer wrote:
+ status = kev.data; + if (WIFSIGNALED(status) && WCOREDUMP(status)) { + VIR_ERROR("Guest %s got signal %d and crashed", mon->vm->def->name, + WTERMSIG(status));
This needs to be virReportError(). And since you're doing gettext translations _() you need to change po/POTFILES.in too.
Sorry, I am pretty unfamiliar with gettext translations!
+ virBhyveProcessStop(mon->driver, mon->vm, + VIR_DOMAIN_SHUTOFF_CRASHED); + } else if (WIFEXITED(status)) { + if (WEXITSTATUS(status) == 0) { + /* 0 - reboot */ + /* TODO: Implementing reboot is a little more complicated. */ + VIR_INFO("Guest %s rebooted; destroying domain.", + mon->vm->def->name); + virBhyveProcessStop(mon->driver, mon->vm, + VIR_DOMAIN_SHUTOFF_SHUTDOWN); + } else if (WEXITSTATUS(status) < 3) { + /* 1 - shutdown, 2 - halt, 3 - triple fault. others - error */ + VIR_INFO("Guest %s shut itself down; destroying domain.", + mon->vm->def->name); + virBhyveProcessStop(mon->driver, mon->vm, + VIR_DOMAIN_SHUTOFF_SHUTDOWN); + } else { + VIR_INFO("Guest %s had an error and exited with status %d; destroying domain.", + mon->vm->def->name, WEXITSTATUS(status)); + virBhyveProcessStop(mon->driver, mon->vm, + VIR_DOMAIN_SHUTOFF_UNKNOWN); + } + } + } +}
ACKed with this squashed in:
diff --git a/po/POTFILES.in b/po/POTFILES.in index f17b35f..d07b75a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -11,6 +11,7 @@ src/access/viraccessmanager.c src/bhyve/bhyve_command.c src/bhyve/bhyve_device.c src/bhyve/bhyve_driver.c +src/bhyve/bhyve_monitor.c src/bhyve/bhyve_process.c src/conf/capabilities.c src/conf/cpu_conf.c diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c index cd3cf6e..7f19c6e 100644 --- a/src/bhyve/bhyve_monitor.c +++ b/src/bhyve/bhyve_monitor.c @@ -84,8 +84,10 @@ bhyveMonitorIO(int watch, int kq, int events ATTRIBUTE_UNUSED, void *opaque)
status = kev.data; if (WIFSIGNALED(status) && WCOREDUMP(status)) { - VIR_ERROR("Guest %s got signal %d and crashed", mon->vm->def->name, - WTERMSIG(status)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Guest %s got signal %d and crashed"), + mon->vm->def->name, + WTERMSIG(status)); virBhyveProcessStop(mon->driver, mon->vm, VIR_DOMAIN_SHUTOFF_CRASHED); } else if (WIFEXITED(status)) {
Fixed and pushed.
Michal
Thanks for fixing it up! Looks good to me. Conrad