Changeset 54791 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Mar 16, 2015 4:04:03 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r54645 r54791 5 5 6 6 /* 7 * Copyright (C) 2004-201 4Oracle Corporation7 * Copyright (C) 2004-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1025 1025 // significantly, but play safe by not messing around while complex 1026 1026 // activities are going on 1027 HRESULT rc = i_checkStateDependency(MutableOrSaved StateDep);1027 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 1028 1028 if (FAILED(rc)) return rc; 1029 1029 … … 1065 1065 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1066 1066 1067 // changing machine groups is possible while the VM is offline 1068 rc = i_checkStateDependency(OfflineStateDep); 1067 rc = i_checkStateDependency(MutableStateDep); 1069 1068 if (FAILED(rc)) return rc; 1070 1069 … … 2619 2618 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2620 2619 2621 HRESULT rc = i_checkStateDependency(Mutable StateDep);2620 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 2622 2621 if (FAILED(rc)) return rc; 2623 2622 … … 2826 2825 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2827 2826 2828 HRESULT rc = i_checkStateDependency(Mutable StateDep);2827 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 2829 2828 if (FAILED(rc)) return rc; 2830 2829 … … 2980 2979 2981 2980 /* @todo deal with running state change. */ 2982 HRESULT rc = i_checkStateDependency(Mutable StateDep);2981 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 2983 2982 if (FAILED(rc)) return rc; 2984 2983 … … 3692 3691 AutoWriteLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3693 3692 3694 HRESULT rc = i_checkStateDependency(Mutable StateDep);3693 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep); 3695 3694 if (FAILED(rc)) return rc; 3696 3695 … … 4256 4255 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4257 4256 4258 HRESULT rc = i_checkStateDependency(Mutable StateDep);4257 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep); 4259 4258 if (FAILED(rc)) return rc; 4260 4259 … … 4880 4879 { 4881 4880 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); // hold read lock only while looking up 4881 4882 // For snapshots don't even think about allowing changes, extradata 4883 // is global for a machine, so there is nothing snapshot specific. 4884 if (i_isSnapshotMachine()) 4885 return setError(VBOX_E_INVALID_VM_STATE, 4886 tr("Cannot set extradata for a snapshot")); 4887 4888 // check if the right IMachine instance is used 4889 if (!i_isSessionMachine()) 4890 return setError(VBOX_E_INVALID_VM_STATE, 4891 tr("Cannot set extradata for an immutable machine")); 4892 4882 4893 settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find(aKey); 4883 4894 if (it != mData->pMachineConfigFile->mapExtraDataItems.end()) … … 4911 4922 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4912 4923 4913 if (i_isSnapshotMachine())4914 {4915 HRESULT rc = i_checkStateDependency(MutableStateDep);4916 if (FAILED(rc)) return rc;4917 }4918 4919 4924 if (aValue.isEmpty()) 4920 4925 mData->pMachineConfigFile->mapExtraDataItems.erase(aKey); … … 4956 4961 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 4957 4962 4958 /* when there was auto-conversion, we want to save the file even if 4959 * the VM is saved */ 4960 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep); 4963 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 4961 4964 if (FAILED(rc)) return rc; 4962 4965 … … 4984 4987 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4985 4988 4986 HRESULT rc = i_checkStateDependency(Mutable StateDep);4989 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 4987 4990 if (FAILED(rc)) return rc; 4988 4991 … … 5637 5640 HRESULT rc = S_OK; 5638 5641 5639 rc = i_checkStateDependency(Mutable StateDep);5642 rc = i_checkStateDependency(MutableOrSavedStateDep); 5640 5643 if (FAILED(rc)) return rc; 5641 5644 … … 6840 6843 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6841 6844 6842 HRESULT hrc = i_checkStateDependency(Mutable StateDep);6845 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 6843 6846 if ( SUCCEEDED(hrc) 6844 6847 && mHWData->mAutostart.fAutostartEnabled != !!aAutostartEnabled) … … 6888 6891 { 6889 6892 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6890 HRESULT hrc = i_checkStateDependency(Mutable StateDep);6893 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 6891 6894 if (SUCCEEDED(hrc)) 6892 6895 { … … 6913 6916 { 6914 6917 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6915 HRESULT hrc = i_checkStateDependency(Mutable StateDep);6918 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 6916 6919 if ( SUCCEEDED(hrc) 6917 6920 && mHWData->mAutostart.enmAutostopType != aAutostopType) … … 7968 7971 * properties when it is in the saved state. 7969 7972 * 7970 * When @a aDepType is OfflineStateDep, this method returns S_OK if the 7971 * state is one of the 4 offline states (PoweredOff, Saved, Teleported, 7972 * Aborted). 7973 * When @a aDepType is MutableOrRunningStateDep, this method returns S_OK only 7974 * if the current state of this machine object allows to change runtime 7975 * changeable settings of the machine (i.e. the machine is not registered, or 7976 * registered but either running or not running and not saved). It is useful 7977 * to call this method from Machine setters before performing any changes to 7978 * runtime changeable settings. 7979 * 7980 * When @a aDepType is MutableOrSavedOrRunningStateDep, this method behaves 7981 * the same as for MutableOrRunningStateDep except that if the machine is 7982 * saved, S_OK is also returned. This is useful in setters which allow 7983 * changing runtime and saved state changeable machine properties. 7973 7984 * 7974 7985 * @param aDepType Dependency type to check. … … 7992 8003 { 7993 8004 if ( mData->mRegistered 7994 && ( !i_isSessionMachine() /** @todo This was just converted raw; Check if Running and 7995 Paused should actually be included here... (Live Migration) */ 7996 || ( mData->mMachineState != MachineState_Paused 7997 && mData->mMachineState != MachineState_Running 7998 && mData->mMachineState != MachineState_Aborted 8005 && ( !i_isSessionMachine() 8006 || ( mData->mMachineState != MachineState_Aborted 7999 8007 && mData->mMachineState != MachineState_Teleported 8000 8008 && mData->mMachineState != MachineState_PoweredOff … … 8010 8018 { 8011 8019 if ( mData->mRegistered 8012 && ( !i_isSessionMachine() /** @todo This was just converted raw; Check if Running and 8013 Paused should actually be included here... (Live Migration) */ 8014 || ( mData->mMachineState != MachineState_Paused 8015 && mData->mMachineState != MachineState_Running 8016 && mData->mMachineState != MachineState_Aborted 8020 && ( !i_isSessionMachine() 8021 || ( mData->mMachineState != MachineState_Aborted 8017 8022 && mData->mMachineState != MachineState_Teleported 8018 8023 && mData->mMachineState != MachineState_Saved … … 8026 8031 break; 8027 8032 } 8028 case OfflineStateDep:8033 case MutableOrRunningStateDep: 8029 8034 { 8030 8035 if ( mData->mRegistered 8031 8036 && ( !i_isSessionMachine() 8032 || ( mData->mMachineState != MachineState_PoweredOff 8033 && mData->mMachineState != MachineState_Saved 8034 && mData->mMachineState != MachineState_Aborted 8037 || ( mData->mMachineState != MachineState_Aborted 8035 8038 && mData->mMachineState != MachineState_Teleported 8039 && mData->mMachineState != MachineState_PoweredOff 8040 && !Global::IsOnline(mData->mMachineState) 8036 8041 ) 8037 8042 ) 8038 8043 ) 8039 8044 return setError(VBOX_E_INVALID_VM_STATE, 8040 tr("The machine is not offline (state is %s)"), 8045 tr("The machine is not mutable (state is %s)"), 8046 Global::stringifyMachineState(mData->mMachineState)); 8047 break; 8048 } 8049 case MutableOrSavedOrRunningStateDep: 8050 { 8051 if ( mData->mRegistered 8052 && ( !i_isSessionMachine() 8053 || ( mData->mMachineState != MachineState_Aborted 8054 && mData->mMachineState != MachineState_Teleported 8055 && mData->mMachineState != MachineState_Saved 8056 && mData->mMachineState != MachineState_PoweredOff 8057 && !Global::IsOnline(mData->mMachineState) 8058 ) 8059 ) 8060 ) 8061 return setError(VBOX_E_INVALID_VM_STATE, 8062 tr("The machine is not mutable (state is %s)"), 8041 8063 Global::stringifyMachineState(mData->mMachineState)); 8042 8064 break;
Note:
See TracChangeset
for help on using the changeset viewer.