Bug 250671 - error reporting with bhyvectl could be improved
Summary: error reporting with bhyvectl could be improved
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bhyve (show other bugs)
Version: 12.1-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-virtualization (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-27 13:13 UTC by marko
Modified: 2021-07-02 05:31 UTC (History)
3 users (show)

See Also:


Attachments
svn diff output of the relevant changes (742 bytes, text/plain)
2020-10-27 13:13 UTC, marko
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description marko 2020-10-27 13:13:55 UTC
Created attachment 219145 [details]
svn diff output of the relevant changes

Currently bhyvectl only can have only one type of message when it is unable to establish comms with VM.
---8<----
VM:free12.1 is not created.
---8<----
First time I encountered this lead me astray, as the access issue had to do with user permissions.

Easy way to get more info is to report what system call gave as an error code.

Including a patch as attachment which should address this issue. The libvmmapi change is there so that sysctlbyname() done within vm_destroy() would not override errno set by earlier syscall to open().
Comment 1 Peter Grehan freebsd_committer freebsd_triage 2020-11-05 06:52:04 UTC
This looks fine.
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-03-07 06:30:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6bb140e3ca895a148f32c93d50f93619bf735f73

commit 6bb140e3ca895a148f32c93d50f93619bf735f73
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2021-03-07 06:19:30 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-03-07 06:19:30 +0000

    bhyvectl: print a better error message when vm_open() fails

    Use errno to print a more descriptive error message when vm_open() fails

    libvmm: preserve errno when vm_device_open() fails

    vm_destroy() squashes errno by making a dive into sysctlbyname() - we
    can safely skip vm_destroy() here since it's not doing any critical
    clean up at this point. Replace vm_destroy() with a free() call.

    PR:             250671
    MFC after:      3 days
    Submitted by:   marko@apache.org
    Reviewed by:    grehan
    Differential Revision:  https://reviews.freebsd.org/D29109

 lib/libvmmapi/vmmapi.c       | 2 +-
 usr.sbin/bhyvectl/bhyvectl.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-07-02 05:13:51 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f65cb8fda02c4f643c476f04655de843e31e563

commit 3f65cb8fda02c4f643c476f04655de843e31e563
Author:     Marko <marko@apache.org>
AuthorDate: 2021-03-07 06:19:30 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-07-02 03:17:12 +0000

    bhyvectl: print a better error message when vm_open() fails

    libvmm: explicitly save and restore errno in vm_open()

    Use errno to print a more descriptive error message when vm_open() fails

    PR:             250671
    Reviewed by:    grehan
    Differential Revision:  https://reviews.freebsd.org/D29109

    (cherry picked from commit 6bb140e3ca895a148f32c93d50f93619bf735f73)
    (cherry picked from commit a7f81b488df2d4a5dcd785b4112e04ffb6ca0442)

 lib/libvmmapi/vmmapi.c       | 5 ++++-
 usr.sbin/bhyvectl/bhyvectl.c | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-07-02 05:24:54 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e63372af710790e6d583a0f1f7d0a3a6e55b5369

commit e63372af710790e6d583a0f1f7d0a3a6e55b5369
Author:     Marko <marko@apache.org>
AuthorDate: 2021-03-07 06:19:30 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-07-02 03:18:54 +0000

    bhyvectl: print a better error message when vm_open() fails

    libvmm: explicitly save and restore errno in vm_open()

    Use errno to print a more descriptive error message when vm_open() fails

    PR:             250671
    Reviewed by:    grehan
    Differential Revision:  https://reviews.freebsd.org/D29109

    (cherry picked from commit 6bb140e3ca895a148f32c93d50f93619bf735f73)
    (cherry picked from commit a7f81b488df2d4a5dcd785b4112e04ffb6ca0442)

 lib/libvmmapi/vmmapi.c       | 5 ++++-
 usr.sbin/bhyvectl/bhyvectl.c | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)