VirtualBox

Changeset 84585 in vbox


Ignore:
Timestamp:
May 28, 2020 12:14:17 PM (4 years ago)
Author:
vboxsync
Message:

Main + FE/VBoxManage: Fixes / better logging for reboot / shutdown support.

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp

    r84576 r84585  
    681681                 || !strcmp(a->argv[1], "shutdown")) /* With shutdown we mean gracefully powering off the VM by letting the guest OS do its thing. */
    682682        {
    683             ComPtr<IGuest> guest;
    684             CHECK_ERROR_BREAK(console, COMGETTER(Guest)(guest.asOutParam()));
     683            ComPtr<IGuest> pGuest;
     684            CHECK_ERROR_BREAK(console, COMGETTER(Guest)(pGuest.asOutParam()));
     685            if (!pGuest)
     686            {
     687                RTMsgError("Guest not running");
     688                rc = E_FAIL;
     689                break;
     690            }
    685691
    686692            const bool fReboot = !strcmp(a->argv[1], "reboot");
    687693
    688694            com::SafeArray<GuestShutdownFlag_T> aShutdownFlags;
     695            aShutdownFlags.resize(1);
     696
    689697            if (fReboot)
    690698                aShutdownFlags.push_back(GuestShutdownFlag_Reboot);
    691699            else
    692700                aShutdownFlags.push_back(GuestShutdownFlag_PowerOff);
    693             CHECK_ERROR(guest, Shutdown(ComSafeArrayAsInParam(aShutdownFlags)));
     701            CHECK_ERROR(pGuest, Shutdown(ComSafeArrayAsInParam(aShutdownFlags)));
    694702            if (FAILED(rc))
    695703            {
  • trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp

    r84555 r84585  
    513513        return setError(E_INVALIDARG, tr("Invalid combination of flags (%#x)"), fFlags);
    514514
     515    Utf8Str strAction = (fFlags & GuestShutdownFlag_Reboot) ? tr("Rebooting") : tr("Shutting down");
     516
    515517    /*
    516518     * Create an anonymous session. This is required to run shutting down / rebooting
     
    518520     */
    519521    GuestSessionStartupInfo startupInfo;
    520     startupInfo.mName = "Shutting down guest";
     522    startupInfo.mName = strAction + " guest";
    521523
    522524    GuestCredentials guestCreds;
     
    541543                    case VERR_NOT_SUPPORTED:
    542544                        hrc = setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc,
    543                                            tr("Shutting down not supported by installed Guest Additions"), vrc);
     545                                           tr("%s not supported by installed Guest Additions"), strAction.c_str());
    544546                        break;
    545547
     
    548550                        if (vrc == VERR_GSTCTL_GUEST_ERROR)
    549551                            vrc = rcGuest;
    550                         hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not shut down guest: %Rrc"), vrc);
     552                        hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Error %s guest: %Rrc"), strAction.c_str(), vrc);
    551553                        break;
    552554                    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette