VirtualBox

Changeset 84575 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 27, 2020 5:14:25 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138305
Message:

Guest Control/VBoxManage: Added "controlvm [...] reboot|shutdown" commands to reboot or shut down the guest OS. bugref:9320

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

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

    r82968 r84575  
    677677            CHECK_ERROR_BREAK(console, SleepButton());
    678678        }
     679        else if (   !strcmp(a->argv[1], "reboot")
     680                 || !strcmp(a->argv[1], "shutdown")) /* With shutdown we mean gracefully powering off the VM by letting the guest OS do its thing. */
     681        {
     682            ComPtr<IGuest> guest;
     683            CHECK_ERROR_BREAK(console, COMGETTER(Guest)(guest.asOutParam()));
     684
     685            const bool fReboot = !strcmp(a->argv[1], "reboot");
     686
     687            com::SafeArray<GuestShutdownFlag_T> aShutdownFlags;
     688            if (fReboot)
     689                aShutdownFlags.push_back(GuestShutdownFlag_Reboot);
     690            else
     691                aShutdownFlags.push_back(GuestShutdownFlag_PowerOff);
     692            CHECK_ERROR(guest, Shutdown(ComSafeArrayAsInParam(aShutdownFlags)));
     693            if (FAILED(rc))
     694            {
     695                if (rc == VBOX_E_NOT_SUPPORTED)
     696                    RTPrintf("Current installed Guest Additions don't support %s the guest.",
     697                             fReboot ? "rebooting" : "shutting down");
     698            }
     699        }
    679700        else if (!strcmp(a->argv[1], "keyboardputscancode"))
    680701        {
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r82968 r84575  
    833833                           "%s controlvm %s       <uuid|vmname>\n"
    834834                     "                            pause|resume|reset|poweroff|savestate|\n"
     835                     "                            reboot|shutdown|\n"
    835836                     "                            acpipowerbutton|acpisleepbutton|\n"
    836837                     "                            keyboardputscancode <hex> [<hex> ...]|\n"
Note: See TracChangeset for help on using the changeset viewer.

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