Changeset 38873 in vbox for trunk/src/VBox/Main/src-server/MachineImpl.cpp
- Timestamp:
- Sep 27, 2011 8:58:22 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r38820 r38873 3807 3807 false /* fTempEject */, 3808 3808 false /* fNonRotational */, 3809 false /* fDiscard */, 3809 3810 Utf8Str::Empty); 3810 3811 if (FAILED(rc)) return rc; … … 4045 4046 aDevice, aControllerPort, aControllerName); 4046 4047 pAttach->updateNonRotational(!!aNonRotational); 4048 4049 return S_OK; 4050 } 4051 4052 STDMETHODIMP Machine::DiscardDevice(IN_BSTR aControllerName, LONG aControllerPort, 4053 LONG aDevice, BOOL aDiscard) 4054 { 4055 CheckComArgStrNotEmptyOrNull(aControllerName); 4056 4057 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aDiscard=%d\n", 4058 aControllerName, aControllerPort, aDevice, aDiscard)); 4059 4060 AutoCaller autoCaller(this); 4061 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4062 4063 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4064 4065 HRESULT rc = checkStateDependency(MutableStateDep); 4066 if (FAILED(rc)) return rc; 4067 4068 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); 4069 4070 if (Global::IsOnlineOrTransient(mData->mMachineState)) 4071 return setError(VBOX_E_INVALID_VM_STATE, 4072 tr("Invalid machine state: %s"), 4073 Global::stringifyMachineState(mData->mMachineState)); 4074 4075 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments, 4076 aControllerName, 4077 aControllerPort, 4078 aDevice); 4079 if (!pAttach) 4080 return setError(VBOX_E_OBJECT_NOT_FOUND, 4081 tr("No storage device attached to device slot %d on port %d of controller '%ls'"), 4082 aDevice, aControllerPort, aControllerName); 4083 4084 4085 setModified(IsModified_Storage); 4086 mMediaData.backup(); 4087 4088 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 4089 4090 if (pAttach->getType() != DeviceType_HardDisk) 4091 return setError(E_INVALIDARG, 4092 tr("Setting the discard medium flag rejected as the device attached to device slot %d on port %d of controller '%ls' is not a hard disk"), 4093 aDevice, aControllerPort, aControllerName); 4094 pAttach->updateDiscard(!!aDiscard); 4047 4095 4048 4096 return S_OK; … … 8184 8232 dev.fTempEject, 8185 8233 dev.fNonRotational, 8234 dev.fDiscard, 8186 8235 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->getName()); 8187 8236 if (FAILED(rc)) break; … … 9131 9180 dev.fPassThrough = pAttach->getPassthrough(); 9132 9181 dev.fTempEject = pAttach->getTempEject(); 9133 dev.f NonRotational = pAttach->getNonRotational();9182 dev.fDiscard = pAttach->getDiscard(); 9134 9183 } 9135 9184 … … 9475 9524 false /* aTempEject */, 9476 9525 pAtt->getNonRotational(), 9526 pAtt->getDiscard(), 9477 9527 pAtt->getBandwidthGroup()); 9478 9528 if (FAILED(rc)) throw rc;
Note:
See TracChangeset
for help on using the changeset viewer.