Changeset 38873 in vbox for trunk/src/VBox
- Timestamp:
- Sep 27, 2011 8:58:22 AM (13 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r38871 r38873 3627 3627 <interface 3628 3628 name="IMachine" extends="$unknown" 3629 uuid="5 eaa9319-62fc-4b0a-843c-0cb1940f8a91"3629 uuid="5a8e9425-aa0d-4703-9f28-2353fc4ee623" 3630 3630 wsmap="managed" 3631 3631 > … … 4763 4763 </method> 4764 4764 4765 <method name="discardDevice"> 4766 <desc> 4767 Sets a flag in the device information which indicates that the medium 4768 supports discarding unsused blocks (called trimming for SATA or unmap 4769 for SCSI devices) .This may or may not be supported by a particular drive, 4770 and is silently ignored in the latter case. At the moment only hard disks 4771 (which is a misnomer in this context) accept this setting. Changing the 4772 setting while the VM is running is forbidden. The device must already 4773 exist; see <link to="IMachine::attachDevice"/> for how to attach a new 4774 device. 4775 4776 The @a controllerPort and @a device parameters specify the device slot and 4777 have have the same meaning as with <link to="IMachine::attachDevice" />. 4778 4779 <result name="E_INVALIDARG"> 4780 SATA device, SATA port, SCSI port out of range. 4781 </result> 4782 <result name="VBOX_E_INVALID_OBJECT_STATE"> 4783 Attempt to modify an unregistered virtual machine. 4784 </result> 4785 <result name="VBOX_E_INVALID_VM_STATE"> 4786 Invalid machine state. 4787 </result> 4788 4789 </desc> 4790 <param name="name" type="wstring" dir="in"> 4791 <desc>Name of the storage controller.</desc> 4792 </param> 4793 <param name="controllerPort" type="long" dir="in"> 4794 <desc>Storage controller port.</desc> 4795 </param> 4796 <param name="device" type="long" dir="in"> 4797 <desc>Device slot in the given port.</desc> 4798 </param> 4799 <param name="discard" type="boolean" dir="in"> 4800 <desc>New value for the discard device flag.</desc> 4801 </param> 4802 </method> 4803 4765 4804 <method name="setBandwidthGroupForDevice"> 4766 4805 <desc> … … 9793 9832 <interface 9794 9833 name="IMediumAttachment" extends="$unknown" 9795 uuid=" b5dfbb8c-7498-48c3-bf10-78fc60f064e1"9834 uuid="5ee464d6-0613-4331-b154-7ce12170ef9f" 9796 9835 wsmap="struct" 9797 9836 > … … 10017 10056 <attribute name="nonRotational" type="boolean" readonly="yes"> 10018 10057 <desc>Whether the associated medium is non-rotational.</desc> 10058 </attribute> 10059 10060 <attribute name="discard" type="boolean" readonly="yes"> 10061 <desc>Whether the associated medium supports discarding unused blocks.</desc> 10019 10062 </attribute> 10020 10063 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r37851 r38873 528 528 unsigned uMergeTarget, 529 529 const char *pcszBwGroup, 530 bool fDiscard, 530 531 IMedium *pMedium, 531 532 MachineState_T aMachineState, -
trunk/src/VBox/Main/include/MachineImpl.h
r38820 r38873 479 479 STDMETHOD(TemporaryEjectDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aTempEject); 480 480 STDMETHOD(NonRotationalDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aNonRotational); 481 STDMETHOD(DiscardDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aDiscard); 481 482 STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort, 482 483 LONG aDevice, IBandwidthGroup *aBandwidthGroup); -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r38718 r38873 51 51 bool fTempEject, 52 52 bool fNonRotational, 53 bool fDiscard, 53 54 const Utf8Str &strBandwidthGroup); 54 55 HRESULT initCopy(Machine *aParent, MediumAttachment *aThat); … … 68 69 STDMETHOD(COMGETTER(IsEjected))(BOOL *aIsEjected); 69 70 STDMETHOD(COMGETTER(NonRotational))(BOOL *aNonRotational); 71 STDMETHOD(COMGETTER(Discard))(BOOL *aDiscard); 70 72 STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup); 71 73 … … 87 89 bool getTempEject() const; 88 90 bool getNonRotational() const; 91 bool getDiscard() const; 89 92 const Utf8Str& getBandwidthGroup() const; 90 93 … … 102 105 /** Must be called from under this object's write lock. */ 103 106 void updateNonRotational(bool aNonRotational); 107 108 /** Must be called from under this object's write lock. */ 109 void updateDiscard(bool aDiscard); 104 110 105 111 /** Must be called from under this object's write lock. */ -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r38702 r38873 2877 2877 BOOL fNonRotational; 2878 2878 hrc = pMediumAtt->COMGETTER(NonRotational)(&fNonRotational); H(); 2879 BOOL fDiscard; 2880 hrc = pMediumAtt->COMGETTER(Discard)(&fDiscard); H(); 2879 2881 2880 2882 unsigned uLUN; … … 3174 3176 uMergeTarget, 3175 3177 strBwGroup.isEmpty() ? NULL : Utf8Str(strBwGroup).c_str(), 3178 fDiscard, 3176 3179 pMedium, 3177 3180 aMachineState, … … 3215 3218 unsigned uMergeTarget, 3216 3219 const char *pcszBwGroup, 3220 bool fDiscard, 3217 3221 IMedium *pMedium, 3218 3222 MachineState_T aMachineState, … … 3403 3407 if (pcszBwGroup) 3404 3408 InsertConfigString(pCfg, "BwGroup", pcszBwGroup); 3409 3410 if (fDiscard) 3411 InsertConfigInteger(pCfg, "Discard", 1); 3405 3412 3406 3413 /* Pass all custom parameters. */ -
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; -
trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
r38718 r38873 42 42 fTempEject(false), 43 43 fNonRotational(false), 44 fDiscard(false), 44 45 fImplicit(false) 45 46 { } … … 60 61 bool fTempEject; 61 62 bool fNonRotational; 63 bool fDiscard; 62 64 bool fImplicit; 63 65 }; … … 120 122 bool aTempEject, 121 123 bool aNonRotational, 124 bool aDiscard, 122 125 const Utf8Str &strBandwidthGroup) 123 126 { … … 147 150 m->bd->fTempEject = aTempEject; 148 151 m->bd->fNonRotational = aNonRotational; 152 m->bd->fDiscard = aDiscard; 149 153 m->bd->fImplicit = aImplicit; 150 154 … … 370 374 } 371 375 376 STDMETHODIMP MediumAttachment::COMGETTER(Discard)(BOOL *aDiscard) 377 { 378 LogFlowThisFuncEnter(); 379 380 CheckComArgOutPointerValid(aDiscard); 381 382 AutoCaller autoCaller(this); 383 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 384 385 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 386 387 *aDiscard = m->bd->fDiscard; 388 389 LogFlowThisFuncLeave(); 390 return S_OK; 391 } 392 372 393 STDMETHODIMP MediumAttachment::COMGETTER(BandwidthGroup) (IBandwidthGroup **aBwGroup) 373 394 { … … 486 507 } 487 508 509 bool MediumAttachment::getDiscard() const 510 { 511 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 512 return m->bd->fDiscard; 513 } 514 488 515 const Utf8Str& MediumAttachment::getBandwidthGroup() const 489 516 { … … 547 574 } 548 575 576 /** Must be called from under this object's write lock. */ 577 void MediumAttachment::updateDiscard(bool aDiscard) 578 { 579 Assert(isWriteLockOnCurrentThread()); 580 581 m->bd.backup(); 582 m->bd->fDiscard = aDiscard; 583 } 584 549 585 void MediumAttachment::updateBandwidthGroup(const Utf8Str &aBandwidthGroup) 550 586 { -
trunk/src/VBox/Main/xml/Settings.cpp
r38100 r38873 1693 1693 && (fTempEject == a.fTempEject) 1694 1694 && (fNonRotational == a.fNonRotational) 1695 && (fDiscard == a.fDiscard) 1695 1696 && (lPort == a.lPort) 1696 1697 && (lDevice == a.lDevice) … … 2989 2990 att.deviceType = DeviceType_HardDisk; 2990 2991 pelmAttached->getAttributeValue("nonrotational", att.fNonRotational); 2992 pelmAttached->getAttributeValue("discard", att.fDiscard); 2991 2993 } 2992 2994 else if (m->sv >= SettingsVersion_v1_9) … … 4237 4239 if (att.fNonRotational) 4238 4240 pelmDevice->setAttribute("nonrotational", att.fNonRotational); 4241 if (att.fDiscard) 4242 pelmDevice->setAttribute("discard", att.fDiscard); 4239 4243 break; 4240 4244 … … 4603 4607 { 4604 4608 // VirtualBox 4.0 adds HD audio, CPU priorities, fault tolerance, 4605 // per-machine media registries, VRDE, JRockitVE, bandwidth g orups,4609 // per-machine media registries, VRDE, JRockitVE, bandwidth groups, 4606 4610 // ICH9 chipset 4607 4611 if ( hardwareMachine.audioAdapter.controllerType == AudioControllerType_HDA
Note:
See TracChangeset
for help on using the changeset viewer.