Changeset 48879 in vbox
- Timestamp:
- Oct 4, 2013 8:37:50 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89551
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r48538 r48879 978 978 // Whether the medium supports discarding unused blocks: 979 979 bool fDiscard; 980 981 // Whether the medium is hot-pluggable: 982 bool fHotPluggable; 980 983 981 984 int32_t lPort; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r48824 r48879 4122 4122 <interface 4123 4123 name="IMachine" extends="$unknown" 4124 uuid=" 7108c7c7-2c0a-47ee-9c69-022fe2a466bf"4124 uuid="480cf695-2d8d-4256-9c7c-cce4184fa048" 4125 4125 wsmap="managed" 4126 4126 > … … 5564 5564 </method> 5565 5565 5566 <method name="setHotPluggableForDevice"> 5567 <desc> 5568 Sets a flag in the device information which indicates that the attached 5569 device is hot pluggable or not. This may or may not be supported by a 5570 particular controller and/or drive, and is silently ignored in the 5571 latter case. Changing the setting while the VM is running is forbidden. 5572 The device must already exist; see <link to="IMachine::attachDevice"/> 5573 for how to attach a new device. 5574 5575 The @a controllerPort and @a device parameters specify the device slot and 5576 have have the same meaning as with <link to="IMachine::attachDevice" />. 5577 5578 <result name="E_INVALIDARG"> 5579 SATA device, SATA port, IDE port or IDE slot out of range. 5580 </result> 5581 <result name="VBOX_E_INVALID_OBJECT_STATE"> 5582 Attempt to modify an unregistered virtual machine. 5583 </result> 5584 <result name="VBOX_E_INVALID_VM_STATE"> 5585 Invalid machine state. 5586 </result> 5587 <result name="VBOX_E_NOT_SUPPORTED"> 5588 Controller doesn't support hot plugging. 5589 </result> 5590 </desc> 5591 5592 <param name="name" type="wstring" dir="in"> 5593 <desc>Name of the storage controller.</desc> 5594 </param> 5595 <param name="controllerPort" type="long" dir="in"> 5596 <desc>Storage controller port.</desc> 5597 </param> 5598 <param name="device" type="long" dir="in"> 5599 <desc>Device slot in the given port.</desc> 5600 </param> 5601 <param name="hotPluggable" type="boolean" dir="in"> 5602 <desc>New value for the hot-pluggable device flag.</desc> 5603 </param> 5604 </method> 5605 5566 5606 <method name="setBandwidthGroupForDevice"> 5567 5607 <desc> … … 5629 5669 5630 5670 <method name="unmountMedium"> 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 </desc> 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5671 <desc> 5672 Unmounts any currently mounted medium (<link to="IMedium" />, 5673 identified by the given UUID @a id) to the given storage controller 5674 (<link to="IStorageController" />, identified by @a name), 5675 at the indicated port and device. The device must already exist; 5676 5677 This method is intended only for managing removable media, where the 5678 device is fixed but media is changeable at runtime (such as DVDs 5679 and floppies). It cannot be used for fixed media such as hard disks. 5680 5681 The @a controllerPort and @a device parameters specify the device slot 5682 and have have the same meaning as with 5683 <link to="IMachine::attachDevice" />. 5684 5685 The specified device slot must have a medium mounted, which will be 5686 unmounted. If there is no mounted medium it will do nothing. 5687 See <link to="IMedium"/> for more detailed information about 5688 attaching/unmounting media. 5689 5690 <result name="E_INVALIDARG"> 5691 SATA device, SATA port, IDE port or IDE slot out of range. 5692 </result> 5693 <result name="VBOX_E_INVALID_OBJECT_STATE"> 5694 Attempt to unmount medium that is not removable - not DVD or floppy. 5695 </result> 5696 <result name="VBOX_E_INVALID_VM_STATE"> 5697 Invalid machine state. 5698 </result> 5699 <result name="VBOX_E_OBJECT_IN_USE"> 5700 Medium already attached to this or another virtual machine. 5701 </result> 5702 <result name="VBOX_E_OBJECT_NOT_FOUND"> 5703 Medium not attached to specified port, device, controller. 5704 </result> 5705 </desc> 5706 5707 <param name="name" type="wstring" dir="in"> 5708 <desc>Name of the storage controller to unmount the medium from.</desc> 5709 </param> 5710 <param name="controllerPort" type="long" dir="in"> 5711 <desc>Port to unmount the medium from.</desc> 5712 </param> 5713 <param name="device" type="long" dir="in"> 5714 <desc>Device slot in the given port to unmount the medium from.</desc> 5715 </param> 5716 <param name="force" type="boolean" dir="in"> 5717 <desc>Allows to force unmount of a medium which is locked by 5718 the device slot in the given port medium is attached to.</desc> 5719 </param> 5720 </method> 5681 5721 5682 5722 <method name="mountMedium"> … … 12854 12894 <interface 12855 12895 name="IMediumAttachment" extends="$unknown" 12856 uuid=" 5ee464d6-0613-4331-b154-7ce12170ef9f"12896 uuid="4b252567-5d4e-4db8-b3c8-569ec1c9236c" 12857 12897 wsmap="struct" 12858 12898 > … … 13082 13122 <attribute name="discard" type="boolean" readonly="yes"> 13083 13123 <desc>Whether the associated medium supports discarding unused blocks.</desc> 13124 </attribute> 13125 13126 <attribute name="hotPluggable" type="boolean" readonly="yes"> 13127 <desc>Whether this attachment is hot pluggable or not.</desc> 13084 13128 </attribute> 13085 13129 -
trunk/src/VBox/Main/include/MachineImpl.h
r48538 r48879 543 543 STDMETHOD(NonRotationalDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aNonRotational); 544 544 STDMETHOD(SetAutoDiscardForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aDiscard); 545 STDMETHOD(SetHotPluggableForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aHotPluggable); 545 546 STDMETHOD(SetNoBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort, 546 547 LONG aDevice); -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r38873 r48879 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 52 52 bool fNonRotational, 53 53 bool fDiscard, 54 bool fHotPluggable, 54 55 const Utf8Str &strBandwidthGroup); 55 56 HRESULT initCopy(Machine *aParent, MediumAttachment *aThat); … … 71 72 STDMETHOD(COMGETTER(Discard))(BOOL *aDiscard); 72 73 STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup); 74 STDMETHOD(COMGETTER(HotPluggable))(BOOL *aHotPluggable); 73 75 74 76 // public internal methods … … 91 93 bool getDiscard() const; 92 94 const Utf8Str& getBandwidthGroup() const; 95 bool getHotPluggable() const; 93 96 94 97 bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice); … … 117 120 void updateParentMachine(Machine * const pMachine); 118 121 122 /** Must be called from under this object's write lock. */ 123 void updateHotPluggable(bool aHotPluggable); 124 119 125 /** Get a unique and somewhat descriptive name for logging. */ 120 126 const char* getLogName(void) const { return mLogName.c_str(); } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r48735 r48879 4501 4501 false /* fNonRotational */, 4502 4502 false /* fDiscard */, 4503 false /* fHotPluggable */, 4503 4504 Utf8Str::Empty); 4504 4505 if (FAILED(rc)) return rc; … … 4828 4829 aDevice, aControllerPort, aControllerName); 4829 4830 pAttach->updateDiscard(!!aDiscard); 4831 4832 return S_OK; 4833 } 4834 4835 STDMETHODIMP Machine::SetHotPluggableForDevice(IN_BSTR aControllerName, LONG aControllerPort, 4836 LONG aDevice, BOOL aHotPluggable) 4837 { 4838 CheckComArgStrNotEmptyOrNull(aControllerName); 4839 4840 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aHotPluggable=%d\n", 4841 aControllerName, aControllerPort, aDevice, aHotPluggable)); 4842 4843 AutoCaller autoCaller(this); 4844 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4845 4846 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4847 4848 HRESULT rc = checkStateDependency(MutableStateDep); 4849 if (FAILED(rc)) return rc; 4850 4851 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); 4852 4853 if (Global::IsOnlineOrTransient(mData->mMachineState)) 4854 return setError(VBOX_E_INVALID_VM_STATE, 4855 tr("Invalid machine state: %s"), 4856 Global::stringifyMachineState(mData->mMachineState)); 4857 4858 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments, 4859 aControllerName, 4860 aControllerPort, 4861 aDevice); 4862 if (!pAttach) 4863 return setError(VBOX_E_OBJECT_NOT_FOUND, 4864 tr("No storage device attached to device slot %d on port %d of controller '%ls'"), 4865 aDevice, aControllerPort, aControllerName); 4866 4867 /** @todo remove this blocker and add the missing code to support this 4868 * flag properly in all code areas, with proper support checks below. */ 4869 return setError(VBOX_E_NOT_SUPPORTED, 4870 tr("Controller '%ls' does not support changing the hot-pluggable device flag"), 4871 aControllerName); 4872 4873 setModified(IsModified_Storage); 4874 mMediaData.backup(); 4875 4876 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 4877 4878 if (pAttach->getType() == DeviceType_Floppy) 4879 return setError(E_INVALIDARG, 4880 tr("Setting the hot-pluggable device flag rejected as the device attached to device slot %d on port %d of controller '%ls' is a floppy drive"), 4881 aDevice, aControllerPort, aControllerName); 4882 pAttach->updateHotPluggable(!!aHotPluggable); 4830 4883 4831 4884 return S_OK; … … 9716 9769 dev.fNonRotational, 9717 9770 dev.fDiscard, 9771 /// @todo load setting once the hot-pluggable flag works 9772 false /*dev.fHotPluggable*/, 9718 9773 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->getName()); 9719 9774 if (FAILED(rc)) break; … … 10819 10874 dev.lDevice = pAttach->getDevice(); 10820 10875 dev.fPassThrough = pAttach->getPassthrough(); 10876 /// @todo save setting once the hot-pluggable flag works 10877 dev.fHotPluggable = false /* pAttach->getHotPluggable()*/; 10821 10878 if (pMedium) 10822 10879 { … … 11161 11218 pAtt->getNonRotational(), 11162 11219 pAtt->getDiscard(), 11220 pAtt->getHotPluggable(), 11163 11221 pAtt->getBandwidthGroup()); 11164 11222 if (FAILED(rc)) throw rc; … … 12777 12835 { 12778 12836 Bstr name; 12779 12837 12780 12838 hrc = mNetworkAdapters[slot]->COMGETTER(NATNetwork)(name.asOutParam()); 12781 12839 if (SUCCEEDED(hrc)) -
trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
r38873 r48879 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 fNonRotational(false), 44 44 fDiscard(false), 45 fImplicit(false) 45 fImplicit(false), 46 fHotPluggable(false) 46 47 { } 47 48 … … 63 64 bool fDiscard; 64 65 bool fImplicit; 66 bool fHotPluggable; 65 67 }; 66 68 … … 123 125 bool aNonRotational, 124 126 bool aDiscard, 127 bool aHotPluggable, 125 128 const Utf8Str &strBandwidthGroup) 126 129 { 127 130 LogFlowThisFuncEnter(); 128 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, strBandwidthGroup.c_str()));131 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d aDiscard=%d aHotPluggable=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, aDiscard, aHotPluggable, strBandwidthGroup.c_str())); 129 132 130 133 if (aType == DeviceType_HardDisk) … … 152 155 m->bd->fDiscard = aDiscard; 153 156 m->bd->fImplicit = aImplicit; 157 m->bd->fHotPluggable = aHotPluggable; 154 158 155 159 /* Confirm a successful initialization when it's the case */ … … 417 421 } 418 422 423 STDMETHODIMP MediumAttachment::COMGETTER(HotPluggable)(BOOL *aHotPluggable) 424 { 425 LogFlowThisFuncEnter(); 426 427 CheckComArgOutPointerValid(aHotPluggable); 428 429 AutoCaller autoCaller(this); 430 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 431 432 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 433 434 *aHotPluggable = m->bd->fHotPluggable; 435 436 LogFlowThisFuncLeave(); 437 return S_OK; 438 } 439 419 440 /** 420 441 * @note Locks this object for writing. … … 511 532 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 512 533 return m->bd->fDiscard; 534 } 535 536 bool MediumAttachment::getHotPluggable() const 537 { 538 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 539 return m->bd->fHotPluggable; 513 540 } 514 541 -
trunk/src/VBox/Main/xml/Settings.cpp
r48538 r48879 2022 2022 && (fNonRotational == a.fNonRotational) 2023 2023 && (fDiscard == a.fDiscard) 2024 && (fHotPluggable == a.fHotPluggable) 2024 2025 && (lPort == a.lPort) 2025 2026 && (lDevice == a.lDevice) … … 3489 3490 throw ConfigFileError(this, pelmImage, N_("Required AttachedDevice/@device attribute is missing")); 3490 3491 3492 pelmAttached->getAttributeValue("hotpluggable", att.fHotPluggable); 3491 3493 pelmAttached->getAttributeValue("bandwidthGroup", att.strBwGroup); 3492 3494 sctl.llAttachedDevices.push_back(att); … … 4918 4920 pelmDevice->setAttribute("type", pcszType); 4919 4921 4922 if (att.fHotPluggable) 4923 pelmDevice->setAttribute("hotpluggable", att.fHotPluggable); 4924 4920 4925 pelmDevice->setAttribute("port", att.lPort); 4921 4926 pelmDevice->setAttribute("device", att.lDevice); -
trunk/src/VBox/Main/xml/VirtualBox-settings.xsd
r44948 r48879 626 626 <xsd:attribute name="nonrotational" type="xsd:boolean" default="false"/> 627 627 <xsd:attribute name="discard" type="xsd:boolean" default="false"/> 628 <xsd:attribute name="hotpluggable" type="xsd:boolean" default="false"/> 628 629 </xsd:complexType> 629 630
Note:
See TracChangeset
for help on using the changeset viewer.