Changeset 37709 in vbox
- Timestamp:
- Jun 30, 2011 1:51:51 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/user_VBoxManage.xml
r37651 r37709 1510 1510 [--setparentuuid <uuid>] 1511 1511 [--passthrough on|off] 1512 [--tempeject on|off] 1512 1513 [--bandwidthgroup name|none] 1513 1514 [--forceunmount] … … 1670 1671 support (currently experimental; see <xref 1671 1672 linkend="storage-cds" />).</para> 1673 </glossdef> 1674 </glossentry> 1675 1676 <glossentry> 1677 <glossterm>tempeject</glossterm> 1678 1679 <glossdef> 1680 <para>For a virtual DVD drive only, you can configure the behavior 1681 for guest-triggered medium eject. If this is set to "on", the eject 1682 has only temporary effects. If the VM is powered off and restarted 1683 the originally configured medium will be still in the drive.</para> 1672 1684 </glossdef> 1673 1685 </glossentry> -
trunk/include/VBox/settings.h
r37502 r37709 806 806 : deviceType(DeviceType_Null), 807 807 fPassThrough(false), 808 fTempEject(false), 808 809 lPort(0), 809 810 lDevice(0) … … 816 817 // DVDs can be in pass-through mode: 817 818 bool fPassThrough; 819 820 // Whether guest-triggered eject of DVDs will keep the medium in the 821 // VM config or not: 822 bool fTempEject; 818 823 819 824 int32_t lPort; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r37543 r37709 466 466 " [--setparentuuid <uuid>]\n" 467 467 " [--passthrough on|off]\n" 468 " [--tempeject on|off]\n" 468 469 " [--bandwidthgroup <name>]\n" 469 470 " [--forceunmount]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r37674 r37709 52 52 { "--mtype", 'M', RTGETOPT_REQ_STRING }, 53 53 { "--passthrough", 'h', RTGETOPT_REQ_STRING }, 54 { "--tempeject", 'e', RTGETOPT_REQ_STRING }, 54 55 { "--bandwidthgroup", 'b', RTGETOPT_REQ_STRING }, 55 56 { "--forceunmount", 'f', RTGETOPT_REQ_NOTHING }, … … 84 85 const char *pszMedium = NULL; 85 86 const char *pszPassThrough = NULL; 87 const char *pszTempEject = NULL; 86 88 const char *pszBandwidthGroup = NULL; 87 89 Bstr bstrNewUuid; … … 162 164 if (ValueUnion.psz) 163 165 pszPassThrough = ValueUnion.psz; 166 else 167 rc = E_FAIL; 168 break; 169 } 170 171 case 'e': // tempeject <on|off> 172 { 173 if (ValueUnion.psz) 174 pszTempEject = ValueUnion.psz; 164 175 else 165 176 rc = E_FAIL; … … 682 693 } 683 694 695 if ( pszTempEject 696 && (SUCCEEDED(rc))) 697 { 698 ComPtr<IMediumAttachment> mattach; 699 CHECK_ERROR(machine, GetMediumAttachment(Bstr(pszCtl).raw(), port, 700 device, mattach.asOutParam())); 701 702 if (SUCCEEDED(rc)) 703 { 704 if (!RTStrICmp(pszTempEject, "on")) 705 { 706 CHECK_ERROR(machine, TemporaryEjectDevice(Bstr(pszCtl).raw(), 707 port, device, TRUE)); 708 } 709 else if (!RTStrICmp(pszTempEject, "off")) 710 { 711 CHECK_ERROR(machine, TemporaryEjectDevice(Bstr(pszCtl).raw(), 712 port, device, FALSE)); 713 } 714 else 715 throw Utf8StrFmt("Invalid --tempeject argument '%s'", pszTempEject); 716 } 717 else 718 throw Utf8StrFmt("Couldn't find the controller attachment for the controller '%s'\n", pszCtl); 719 } 720 684 721 if ( pszBandwidthGroup 685 722 && !fRunTime -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r37695 r37709 4643 4643 </method> 4644 4644 4645 <method name="temporaryEjectDevice"> 4646 <desc> 4647 Sets the behavior for guest-triggered medium eject. In some situations 4648 it is desirable that such ejects update the VM configuration, and in 4649 others the eject should keep the VM configuration. The device must 4650 already exist; see <link to="IMachine::attachDevice"/> for how to 4651 attach a new device. 4652 4653 The @a controllerPort and @a device parameters specify the device slot and 4654 have have the same meaning as with <link to="IMachine::attachDevice" />. 4655 4656 <result name="E_INVALIDARG"> 4657 SATA device, SATA port, IDE port or IDE slot out of range. 4658 </result> 4659 <result name="VBOX_E_INVALID_OBJECT_STATE"> 4660 Attempt to modify an unregistered virtual machine. 4661 </result> 4662 <result name="VBOX_E_INVALID_VM_STATE"> 4663 Invalid machine state. 4664 </result> 4665 4666 </desc> 4667 <param name="name" type="wstring" dir="in"> 4668 <desc>Name of the storage controller.</desc> 4669 </param> 4670 <param name="controllerPort" type="long" dir="in"> 4671 <desc>Storage controller port.</desc> 4672 </param> 4673 <param name="device" type="long" dir="in"> 4674 <desc>Device slot in the given port.</desc> 4675 </param> 4676 <param name="temporaryEject" type="boolean" dir="in"> 4677 <desc>New value for the eject behavior.</desc> 4678 </param> 4679 </method> 4680 4645 4681 <method name="setBandwidthGroupForDevice"> 4646 4682 <desc> … … 9572 9608 <interface 9573 9609 name="IMediumAttachment" extends="$unknown" 9574 uuid=" 8d48f68f-807a-4e4e-9449-827fe9ea8498"9610 uuid="b5dfbb8c-7498-48c3-bf10-78fc60f064e1" 9575 9611 wsmap="struct" 9576 9612 > … … 9783 9819 <attribute name="passthrough" type="boolean" readonly="yes"> 9784 9820 <desc>Pass I/O requests through to a device on the host.</desc> 9821 </attribute> 9822 9823 <attribute name="temporaryEject" type="boolean" readonly="yes"> 9824 <desc>Whether guest-triggered eject results in unmounting the medium.</desc> 9785 9825 </attribute> 9786 9826 -
trunk/src/VBox/Main/include/MachineImpl.h
r37687 r37709 477 477 STDMETHOD(DetachDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice); 478 478 STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough); 479 STDMETHOD(TemporaryEjectDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aTempEject); 479 480 STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort, 480 481 LONG aDevice, IBandwidthGroup *aBandwidthGroup); -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r37695 r37709 47 47 LONG aDevice, 48 48 DeviceType_T aType, 49 bool fImplicit, 49 50 bool fPassthrough, 51 bool fTempEject, 50 52 const Utf8Str &strBandwidthGroup); 51 53 void uninit(); … … 61 63 STDMETHOD(COMGETTER(Type))(DeviceType_T *aType); 62 64 STDMETHOD(COMGETTER(Passthrough))(BOOL *aPassthrough); 65 STDMETHOD(COMGETTER(TemporaryEject))(BOOL *aTemporaryEject); 63 66 STDMETHOD(COMGETTER(IsEjected))(BOOL *aIsEjected); 64 67 STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup); … … 79 82 DeviceType_T getType() const; 80 83 bool getPassthrough() const; 84 bool getTempEject() const; 81 85 const Utf8Str& getBandwidthGroup() const; 82 86 … … 88 92 /** Must be called from under this object's write lock. */ 89 93 void updatePassthrough(bool aPassthrough); 94 95 /** Must be called from under this object's write lock. */ 96 void updateTempEject(bool aTempEject); 90 97 91 98 /** Must be called from under this object's write lock. */ -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r37704 r37709 3802 3802 aType, 3803 3803 fIndirect, 3804 false /* fPassthrough */, 3805 false /* fTempEject */, 3804 3806 Utf8Str::Empty); 3805 3807 if (FAILED(rc)) return rc; … … 3955 3957 aDevice, aControllerPort, aControllerName); 3956 3958 pAttach->updatePassthrough(!!aPassthrough); 3959 3960 return S_OK; 3961 } 3962 3963 STDMETHODIMP Machine::TemporaryEjectDevice(IN_BSTR aControllerName, LONG aControllerPort, 3964 LONG aDevice, BOOL aTemporaryEject) 3965 { 3966 CheckComArgStrNotEmptyOrNull(aControllerName); 3967 3968 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld aTemporaryEject=%d\n", 3969 aControllerName, aControllerPort, aDevice, aTemporaryEject)); 3970 3971 AutoCaller autoCaller(this); 3972 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3973 3974 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3975 3976 HRESULT rc = checkStateDependency(MutableStateDep); 3977 if (FAILED(rc)) return rc; 3978 3979 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments, 3980 aControllerName, 3981 aControllerPort, 3982 aDevice); 3983 if (!pAttach) 3984 return setError(VBOX_E_OBJECT_NOT_FOUND, 3985 tr("No storage device attached to device slot %d on port %d of controller '%ls'"), 3986 aDevice, aControllerPort, aControllerName); 3987 3988 3989 setModified(IsModified_Storage); 3990 mMediaData.backup(); 3991 3992 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 3993 3994 if (pAttach->getType() != DeviceType_DVD) 3995 return setError(E_INVALIDARG, 3996 tr("Setting passthrough rejected as the device attached to device slot %d on port %d of controller '%ls' is not a DVD"), 3997 aDevice, aControllerPort, aControllerName); 3998 pAttach->updateTempEject(!!aTemporaryEject); 3957 3999 3958 4000 return S_OK; … … 8053 8095 dev.lDevice, 8054 8096 dev.deviceType, 8097 false, 8055 8098 dev.fPassThrough, 8099 dev.fTempEject, 8056 8100 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->getName()); 8057 8101 if (FAILED(rc)) break; … … 9000 9044 dev.uuid = pMedium->getId(); 9001 9045 dev.fPassThrough = pAttach->getPassthrough(); 9046 dev.fTempEject = pAttach->getTempEject(); 9002 9047 } 9003 9048 … … 9321 9366 DeviceType_HardDisk, 9322 9367 true /* aImplicit */, 9368 false /* aPassthrough */, 9369 false /* aTempEject */, 9323 9370 pAtt->getBandwidthGroup()); 9324 9371 if (FAILED(rc)) throw rc; … … 11653 11700 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 11654 11701 11655 /* Need to query the details first, as the IMediumAttachment reference11656 * might be to the original settings, which we are going to change. */11657 Bstr ctrlName;11658 HRESULT rc = aAttachment->COMGETTER(Controller)(ctrlName.asOutParam());11659 AssertComRC(rc);11660 LONG lDev;11661 rc = aAttachment->COMGETTER(Device)(&lDev);11662 AssertComRC(rc);11663 LONG lPort;11664 rc = aAttachment->COMGETTER(Port)(&lPort);11665 AssertComRC(rc);11666 11667 11702 // request the host lock first, since might be calling Host methods for getting host drives; 11668 11703 // next, protect the media tree all the while we're in here, as well as our member variables … … 11673 11708 ComObjPtr<MediumAttachment> pAttach = static_cast<MediumAttachment *>(aAttachment); 11674 11709 11675 /* Remember previously mounted medium. The medium before taking the 11676 * backup is not necessarily the same thing. */ 11677 ComObjPtr<Medium> oldmedium; 11678 oldmedium = pAttach->getMedium(); 11679 11680 setModified(IsModified_Storage); 11681 mMediaData.backup(); 11682 11683 GuidList llRegistriesThatNeedSaving; 11684 11685 { 11710 Bstr ctrlName; 11711 LONG lPort; 11712 LONG lDevice; 11713 bool fTempEject; 11714 { 11715 AutoCaller autoAttachCaller(this); 11716 if (FAILED(autoAttachCaller.rc())) return autoAttachCaller.rc(); 11717 11718 AutoReadLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 11719 11720 /* Need to query the details first, as the IMediumAttachment reference 11721 * might be to the original settings, which we are going to change. */ 11722 ctrlName = pAttach->getControllerName(); 11723 lPort = pAttach->getPort(); 11724 lDevice = pAttach->getDevice(); 11725 fTempEject = pAttach->getTempEject(); 11726 } 11727 11728 if (!fTempEject) 11729 { 11730 /* Remember previously mounted medium. The medium before taking the 11731 * backup is not necessarily the same thing. */ 11732 ComObjPtr<Medium> oldmedium; 11733 oldmedium = pAttach->getMedium(); 11734 11735 setModified(IsModified_Storage); 11736 mMediaData.backup(); 11737 11686 11738 // The backup operation makes the pAttach reference point to the 11687 11739 // old settings. Re-get the correct reference. … … 11689 11741 ctrlName.raw(), 11690 11742 lPort, 11691 lDev); 11692 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 11693 if (!oldmedium.isNull()) 11694 oldmedium->removeBackReference(mData->mUuid); 11695 11696 pAttach->updateMedium(NULL); 11697 pAttach->updateEjected(); 11698 11699 pAttach.queryInterfaceTo(aNewAttachment); 11700 } 11701 11702 setModified(IsModified_Storage); 11703 11704 multiLock.release(); 11705 11706 mParent->saveRegistries(llRegistriesThatNeedSaving); 11707 11708 return rc; 11743 lDevice); 11744 11745 { 11746 AutoCaller autoAttachCaller(this); 11747 if (FAILED(autoAttachCaller.rc())) return autoAttachCaller.rc(); 11748 11749 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 11750 if (!oldmedium.isNull()) 11751 oldmedium->removeBackReference(mData->mUuid); 11752 11753 pAttach->updateMedium(NULL); 11754 pAttach->updateEjected(); 11755 } 11756 11757 setModified(IsModified_Storage); 11758 } 11759 else 11760 { 11761 { 11762 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 11763 pAttach->updateEjected(); 11764 } 11765 } 11766 11767 pAttach.queryInterfaceTo(aNewAttachment); 11768 11769 return S_OK; 11709 11770 } 11710 11771 -
trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
r37695 r37709 40 40 type(DeviceType_Null), 41 41 fPassthrough(false), 42 fTempEject(false), 42 43 fImplicit(false) 43 44 { } … … 56 57 const DeviceType_T type; 57 58 bool fPassthrough; 59 bool fTempEject; 58 60 bool fImplicit; 59 61 }; … … 112 114 LONG aDevice, 113 115 DeviceType_T aType, 116 bool aImplicit, 114 117 bool aPassthrough, 118 bool aTempEject, 115 119 const Utf8Str &strBandwidthGroup) 116 120 { 117 121 LogFlowThisFuncEnter(); 118 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d a Passthrough=%d\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aPassthrough));122 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject)); 119 123 120 124 if (aType == DeviceType_HardDisk) … … 138 142 139 143 m->bd->fPassthrough = aPassthrough; 140 /* Newly created attachments never have an implicitly created medium 141 * associated with them. Implicit diff image creation happens later. */ 142 m->bd->fImplicit = false; 144 m->bd->fTempEject = aTempEject; 145 m->bd->fImplicit = aImplicit; 143 146 144 147 /* Confirm a successful initialization when it's the case */ … … 282 285 } 283 286 287 STDMETHODIMP MediumAttachment::COMGETTER(TemporaryEject)(BOOL *aTemporaryEject) 288 { 289 LogFlowThisFuncEnter(); 290 291 CheckComArgOutPointerValid(aTemporaryEject); 292 293 AutoCaller autoCaller(this); 294 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 295 296 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 297 298 *aTemporaryEject = m->bd->fTempEject; 299 300 LogFlowThisFuncLeave(); 301 return S_OK; 302 } 303 284 304 STDMETHODIMP MediumAttachment::COMGETTER(IsEjected)(BOOL *aEjected) 285 305 { … … 403 423 } 404 424 425 bool MediumAttachment::getTempEject() const 426 { 427 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 428 return m->bd->fTempEject; 429 } 430 405 431 const Utf8Str& MediumAttachment::getBandwidthGroup() const 406 432 { … … 439 465 440 466 /** Must be called from under this object's write lock. */ 467 void MediumAttachment::updateTempEject(bool aTempEject) 468 { 469 Assert(isWriteLockOnCurrentThread()); 470 471 m->bd.backup(); 472 m->bd->fTempEject = aTempEject; 473 } 474 475 /** Must be called from under this object's write lock. */ 441 476 void MediumAttachment::updateEjected() 442 477 { -
trunk/src/VBox/Main/xml/Settings.cpp
r37606 r37709 1691 1691 || ( (deviceType == a.deviceType) 1692 1692 && (fPassThrough == a.fPassThrough) 1693 && (fTempEject == a.fTempEject) 1693 1694 && (lPort == a.lPort) 1694 1695 && (lDevice == a.lDevice) … … 2991 2992 att.deviceType = DeviceType_DVD; 2992 2993 pelmAttached->getAttributeValue("passthrough", att.fPassThrough); 2994 pelmAttached->getAttributeValue("tempeject", att.fTempEject); 2993 2995 } 2994 2996 else if (strTemp == "Floppy") … … 3062 3064 att.lDevice = 0; 3063 3065 pelmHwChild->getAttributeValue("passthrough", att.fPassThrough); 3066 pelmHwChild->getAttributeValue("tempeject", att.fTempEject); 3064 3067 3065 3068 const xml::ElementNode *pDriveChild; … … 3685 3688 3686 3689 pelmDVD->setAttribute("passthrough", att.fPassThrough); 3690 if (att.fTempEject) 3691 pelmDVD->setAttribute("tempeject", att.fTempEject); 3687 3692 if (!att.uuid.isEmpty()) 3688 3693 pelmDVD->createChild("Image")->setAttribute("uuid", att.uuid.toStringCurly()); … … 4229 4234 pcszType = "DVD"; 4230 4235 pelmDevice->setAttribute("passthrough", att.fPassThrough); 4236 if (att.fTempEject) 4237 pelmDevice->setAttribute("tempeject", att.fTempEject); 4231 4238 break; 4232 4239
Note:
See TracChangeset
for help on using the changeset viewer.