VirtualBox

Changeset 84575 in vbox


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
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/man_VBoxManage-controlvm.xml

    r82969 r84575  
    100100    </cmdsynopsis>
    101101
     102    <cmdsynopsis id="synopsis-vboxmanage-controlvm-reboot">
     103      <command>VBoxManage controlvm</command>
     104      <group choice="req">
     105        <arg choice="plain"><replaceable>uuid</replaceable></arg>
     106        <arg choice="plain"><replaceable>vmname</replaceable></arg>
     107      </group>
     108      <arg choice="plain">reboot</arg>
     109    </cmdsynopsis>
     110
     111    <cmdsynopsis id="synopsis-vboxmanage-controlvm-shutdown">
     112      <command>VBoxManage controlvm</command>
     113      <group choice="req">
     114        <arg choice="plain"><replaceable>uuid</replaceable></arg>
     115        <arg choice="plain"><replaceable>vmname</replaceable></arg>
     116      </group>
     117      <arg choice="plain">shutdown</arg>
     118    </cmdsynopsis>
     119
    102120    <cmdsynopsis id="synopsis-vboxmanage-controlvm-keyboardputscancode">
    103121      <command>VBoxManage controlvm</command>
     
    787805        this command triggers a proper sleep mechanism from within the
    788806        VM.
     807      </para>
     808    </refsect2>
     809    <refsect2 id="vboxmanage-controlvm-reboot">
     810      <title>Reboot the guest OS</title>
     811      <remark role="help-copy-synopsis"/>
     812      <para>
     813        The <command>VBoxManage controlvm
     814        <replaceable>vmname</replaceable> reboot</command>
     815        command asks the guest OS to reboot itself.
     816      </para>
     817      <para>
     818        This commands new recent Guest Additions installed.
     819      </para>
     820    </refsect2>
     821    <refsect2 id="vboxmanage-controlvm-shutdown">
     822      <title>Shut down the guest OS</title>
     823      <remark role="help-copy-synopsis"/>
     824      <para>
     825        The <command>VBoxManage controlvm
     826        <replaceable>vmname</replaceable> shutdown</command>
     827        command asks the guest OS to halt + shutdown.
     828      </para>
     829      <para>
     830        This commands new recent Guest Additions installed.
    789831      </para>
    790832    </refsect2>
  • 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