VirtualBox

Changeset 42489 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 31, 2012 7:02:49 PM (13 years ago)
Author:
vboxsync
Message:

Main/Machine: get the conditions right when the group association can be changed, and fix a long standing issue with not being able to save settings of a VM which has saved state. While at it allow changing the VM description in this case, too.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/MachineImpl.h

    r42442 r42489  
    9595    enum StateDependency
    9696    {
    97         AnyStateDep = 0, MutableStateDep, MutableOrSavedStateDep
     97        AnyStateDep = 0,
     98        MutableStateDep,
     99        MutableOrSavedStateDep,
     100        OfflineStateDep
    98101    };
    99102
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r42442 r42489  
    10291029    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    10301030
    1031     HRESULT rc = checkStateDependency(MutableStateDep);
     1031    // this can be done in principle in any state as it doesn't affect the VM
     1032    // significantly, but play safe by not messing around while complex
     1033    // activities are going on
     1034    HRESULT rc = checkStateDependency(MutableOrSavedStateDep);
    10321035    if (FAILED(rc)) return rc;
    10331036
     
    10871090    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    10881091
    1089     rc = checkStateDependency(MutableStateDep);
     1092    // changing machine groups is possible while the VM is offline
     1093    rc = checkStateDependency(OfflineStateDep);
    10901094    if (FAILED(rc)) return rc;
    10911095
     
    47094713    /* when there was auto-conversion, we want to save the file even if
    47104714     * the VM is saved */
    4711     HRESULT rc = checkStateDependency(MutableStateDep);
     4715    HRESULT rc = checkStateDependency(MutableOrSavedStateDep);
    47124716    if (FAILED(rc)) return rc;
    47134717
     
    76577661 *  properties when it is in the saved state.
    76587662 *
     7663 *  When @a aDepType is OfflineStateDep, this method returns S_OK if the
     7664 *  state is one of the 4 offline states (PoweredOff, Saved, Teleported,
     7665 *  Aborted).
     7666 *
    76597667 *  @param aDepType     Dependency type to check.
    76607668 *
     
    77067714                return setError(VBOX_E_INVALID_VM_STATE,
    77077715                                tr("The machine is not mutable (state is %s)"),
     7716                                Global::stringifyMachineState(mData->mMachineState));
     7717            break;
     7718        }
     7719        case OfflineStateDep:
     7720        {
     7721            if (   mData->mRegistered
     7722                && (   !isSessionMachine()
     7723                    || (   mData->mMachineState != MachineState_PoweredOff
     7724                        && mData->mMachineState != MachineState_Saved
     7725                        && mData->mMachineState != MachineState_Aborted
     7726                        && mData->mMachineState != MachineState_Teleported
     7727                       )
     7728                   )
     7729               )
     7730                return setError(VBOX_E_INVALID_VM_STATE,
     7731                                tr("The machine is not offline (state is %s)"),
    77087732                                Global::stringifyMachineState(mData->mMachineState));
    77097733            break;
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