]> xenbits.xensource.com Git - libvirt.git/commitdiff
bhyve: silent destroy command errors on cleanup
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Fri, 13 Jun 2014 18:51:18 +0000 (22:51 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Fri, 13 Jun 2014 20:22:35 +0000 (00:22 +0400)
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.

src/bhyve/bhyve_process.c

index b8db0763667c5b1c06c4b6dc6cc45e21ecc380ae..f3898f5fc088663f19f821b11b7ee8c9a6e07ef8 100644 (file)
@@ -189,12 +189,13 @@ virBhyveProcessStart(virConnectPtr conn,
 
  cleanup:
     if (ret < 0) {
+        int exitstatus; /* Needed to avoid logging non-zero status */
         virCommandPtr destroy_cmd;
         if ((destroy_cmd = virBhyveProcessBuildDestroyCmd(driver,
                                                           vm->def)) != NULL) {
             virCommandSetOutputFD(load_cmd, &logfd);
             virCommandSetErrorFD(load_cmd, &logfd);
-            ignore_value(virCommandRun(destroy_cmd, NULL));
+            ignore_value(virCommandRun(destroy_cmd, &exitstatus));
             virCommandFree(destroy_cmd);
         }