提交 f477f555 编写于 作者: R Roman Bogorodskiy

bhyve: silent destroy command errors on cleanup

When virBhyveProcessStart() fails, it tries to unload
a guest that could have been already loaded using
bhyveload(8) to make sure not to leave it hanging in memory.

However, we could fail before loading a VM into memory,
so 'bhyvectl --destroy' command will fail and print
an error message that looks confusing to users.

So ignore errors when running this in cleanup.
上级 5c1f82ef
...@@ -189,12 +189,13 @@ virBhyveProcessStart(virConnectPtr conn, ...@@ -189,12 +189,13 @@ virBhyveProcessStart(virConnectPtr conn,
cleanup: cleanup:
if (ret < 0) { if (ret < 0) {
int exitstatus; /* Needed to avoid logging non-zero status */
virCommandPtr destroy_cmd; virCommandPtr destroy_cmd;
if ((destroy_cmd = virBhyveProcessBuildDestroyCmd(driver, if ((destroy_cmd = virBhyveProcessBuildDestroyCmd(driver,
vm->def)) != NULL) { vm->def)) != NULL) {
virCommandSetOutputFD(load_cmd, &logfd); virCommandSetOutputFD(load_cmd, &logfd);
virCommandSetErrorFD(load_cmd, &logfd); virCommandSetErrorFD(load_cmd, &logfd);
ignore_value(virCommandRun(destroy_cmd, NULL)); ignore_value(virCommandRun(destroy_cmd, &exitstatus));
virCommandFree(destroy_cmd); virCommandFree(destroy_cmd);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册