Changeset 34010 in vbox
- Timestamp:
- Nov 11, 2010 8:17:47 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r33827 r34010 797 797 ulInstance(0), 798 798 fUseHostIOCache(true), 799 fBootable(true), 799 800 lIDE0MasterEmulationPort(0), 800 801 lIDE0SlaveEmulationPort(0), … … 811 812 uint32_t ulInstance; 812 813 bool fUseHostIOCache; 814 bool fBootable; 813 815 814 816 // only for when controllerType == StorageControllerType_IntelAhci: -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r33825 r34010 478 478 " [--sataportcount <1-30>]\n" 479 479 " [--hostiocache on|off]\n" 480 " [--bootable on|off]\n" 480 481 " [--remove]\n" 481 482 "\n"); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r33904 r34010 666 666 const char *pszCtl = NULL; 667 667 ULONG ulValue = 0; 668 BOOL fBootable = FALSE; 668 669 Bstr storageCtlName; 669 670 … … 724 725 else 725 726 RTPrintf("Storage Controller Port Count (%u): %lu\n", i, ulValue); 727 728 storageCtl->COMGETTER(Bootable)(&fBootable); 729 if (details == VMINFO_MACHINEREADABLE) 730 RTPrintf("storagecontrollerbootable%u=\"%s\"\n", i, fBootable ? "on" : "off"); 731 else 732 RTPrintf("Storage Controller Bootable (%u): %s\n", i, fBootable ? "on" : "off"); 726 733 } 727 734 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r33540 r34010 647 647 { "--remove", 'r', RTGETOPT_REQ_NOTHING }, 648 648 { "--hostiocache", 'i', RTGETOPT_REQ_STRING }, 649 { "--bootable", 'b', RTGETOPT_REQ_STRING }, 649 650 }; 650 651 … … 657 658 const char *pszCtlType = NULL; 658 659 const char *pszHostIOCache = NULL; 660 const char *pszBootable = NULL; 659 661 ULONG satabootdev = ~0U; 660 662 ULONG sataidedev = ~0U; … … 728 730 } 729 731 732 case 'b': 733 { 734 pszBootable = ValueUnion.psz; 735 break; 736 } 737 730 738 default: 731 739 { … … 949 957 } 950 958 } 959 960 if ( pszBootable 961 && SUCCEEDED(rc)) 962 { 963 if (SUCCEEDED(rc)) 964 { 965 if (!RTStrICmp(pszBootable, "on")) 966 { 967 CHECK_ERROR(machine, SetStorageControllerBootable(Bstr(pszCtl).raw(), TRUE)); 968 } 969 else if (!RTStrICmp(pszBootable, "off")) 970 { 971 CHECK_ERROR(machine, SetStorageControllerBootable(Bstr(pszCtl).raw(), FALSE)); 972 } 973 else 974 { 975 errorArgument("Invalid --bootable argument '%s'", pszHostIOCache); 976 rc = E_FAIL; 977 } 978 } 979 else 980 { 981 errorArgument("Couldn't find the controller with the name: '%s'\n", pszCtl); 982 rc = E_FAIL; 983 } 984 } 951 985 } 952 986 -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r33918 r34010 1281 1281 rc = ctrls[i]->COMGETTER(UseHostIOCache)(&fUseHostIOCache); H(); 1282 1282 1283 BOOL fBootable; 1284 rc = ctrls[i]->COMGETTER(Bootable)(&fBootable); H(); 1285 1283 1286 /* /Devices/<ctrldev>/ */ 1284 1287 const char *pszCtrlDev = pConsole->convertControllerTypeToDev(enmCtrlType); … … 1304 1307 hrc = BusMgr->assignPciDevice("lsilogic", pCtlInst); H(); 1305 1308 1309 InsertConfigInteger(pCfg, "Bootable", fBootable); 1306 1310 1307 1311 /* Attach the status driver */ … … 1321 1325 hrc = BusMgr->assignPciDevice("buslogic", pCtlInst); H(); 1322 1326 1327 InsertConfigInteger(pCfg, "Bootable", fBootable); 1328 1323 1329 /* Attach the status driver */ 1324 1330 InsertConfigNode(pCtlInst, "LUN#999", &pLunL0); … … 1340 1346 hrc = ctrls[i]->COMGETTER(PortCount)(&cPorts); H(); 1341 1347 InsertConfigInteger(pCfg, "PortCount", cPorts); 1348 InsertConfigInteger(pCfg, "Bootable", fBootable); 1342 1349 1343 1350 /* Needed configuration values for the bios, only first controller. */ … … 1431 1438 1432 1439 InsertConfigString(pCfg, "ControllerType", "SAS1068"); 1440 InsertConfigInteger(pCfg, "Bootable", fBootable); 1433 1441 1434 1442 /* Attach the status driver */ -
trunk/src/VBox/Main/MachineImpl.cpp
r33952 r34010 5136 5136 /* get a new instance number for the storage controller */ 5137 5137 ULONG ulInstance = 0; 5138 bool fBootable = true; 5138 5139 for (StorageControllerList::const_iterator it = mStorageControllers->begin(); 5139 5140 it != mStorageControllers->end(); … … 5146 5147 if (ulCurInst >= ulInstance) 5147 5148 ulInstance = ulCurInst + 1; 5148 } 5149 } 5150 5151 rc = ctrl->init(this, aName, aConnectionType, ulInstance); 5149 5150 /* Only one controller of each type can be marked as bootable. */ 5151 if ((*it)->getBootable()) 5152 fBootable = false; 5153 } 5154 } 5155 5156 rc = ctrl->init(this, aName, aConnectionType, ulInstance, fBootable); 5152 5157 if (FAILED(rc)) return rc; 5153 5158 … … 5206 5211 tr("Could not find a storage controller with instance number '%lu'"), 5207 5212 aInstance); 5213 } 5214 5215 STDMETHODIMP Machine::SetStorageControllerBootable(IN_BSTR aName, BOOL fBootable) 5216 { 5217 AutoCaller autoCaller(this); 5218 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5219 5220 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5221 5222 HRESULT rc = checkStateDependency(MutableStateDep); 5223 if (FAILED(rc)) return rc; 5224 5225 ComObjPtr<StorageController> ctrl; 5226 5227 rc = getStorageControllerByName(aName, ctrl, true /* aSetError */); 5228 if (SUCCEEDED(rc)) 5229 { 5230 /* Check that only one controller of each type is marked as bootable. */ 5231 if (fBootable == TRUE) 5232 { 5233 for (StorageControllerList::const_iterator it = mStorageControllers->begin(); 5234 it != mStorageControllers->end(); 5235 ++it) 5236 { 5237 ComObjPtr<StorageController> aCtrl = (*it); 5238 5239 if ( (aCtrl->getName() != Utf8Str(aName)) 5240 && aCtrl->getBootable() == TRUE 5241 && aCtrl->getStorageBus() == ctrl->getStorageBus() 5242 && aCtrl->getControllerType() == ctrl->getControllerType()) 5243 { 5244 rc = setError(VBOX_E_OBJECT_IN_USE, 5245 tr("Another storage controller '%s' is already marked as bootable"), 5246 aCtrl->getName().c_str()); 5247 break; 5248 } 5249 } 5250 } 5251 5252 if (SUCCEEDED(rc)) 5253 { 5254 ctrl->setBootable(fBootable); 5255 setModified(IsModified_Storage); 5256 } 5257 } 5258 5259 if (SUCCEEDED(rc)) 5260 { 5261 /* inform the direct session if any */ 5262 alock.leave(); 5263 onStorageControllerChange(); 5264 } 5265 5266 return rc; 5208 5267 } 5209 5268 … … 7235 7294 ctlData.strName, 7236 7295 ctlData.storageBus, 7237 ctlData.ulInstance); 7296 ctlData.ulInstance, 7297 ctlData.fBootable); 7238 7298 if (FAILED(rc)) return rc; 7239 7299 … … 8267 8327 ctl.storageBus = pCtl->getStorageBus(); 8268 8328 ctl.ulInstance = pCtl->getInstance(); 8329 ctl.fBootable = pCtl->getBootable(); 8269 8330 8270 8331 /* Save the port count. */ -
trunk/src/VBox/Main/StorageControllerImpl.cpp
r33915 r34010 47 47 mPortCount(2), 48 48 fUseHostIOCache(true), 49 fBootable(false), 49 50 mPortIde0Master(0), 50 51 mPortIde0Slave(1), … … 65 66 /** Whether to use the host IO caches. */ 66 67 BOOL fUseHostIOCache; 68 /** Whether it is possible to boot from disks attached to this controller. */ 69 BOOL fBootable; 67 70 68 71 /** The following is only for the SATA controller atm. */ … … 124 127 const Utf8Str &aName, 125 128 StorageBus_T aStorageBus, 126 ULONG aInstance )129 ULONG aInstance, bool fBootable) 127 130 { 128 131 LogFlowThisFunc(("aParent=%p aName=\"%s\" aInstance=%u\n", … … 159 162 m->bd->strName = aName; 160 163 m->bd->mInstance = aInstance; 164 m->bd->fBootable = fBootable; 161 165 m->bd->mStorageBus = aStorageBus; 162 166 if ( aStorageBus != StorageBus_IDE … … 622 626 } 623 627 628 STDMETHODIMP StorageController::COMGETTER(Bootable) (BOOL *fBootable) 629 { 630 AutoCaller autoCaller(this); 631 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 632 633 /* The machine doesn't need to be mutable. */ 634 635 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 636 637 *fBootable = m->bd->fBootable; 638 639 return S_OK; 640 } 641 624 642 // IStorageController methods 625 643 ///////////////////////////////////////////////////////////////////////////// … … 721 739 { 722 740 return m->bd->mInstance; 741 } 742 743 bool StorageController::getBootable() const 744 { 745 return !!m->bd->fBootable; 723 746 } 724 747 … … 754 777 755 778 /** @note Locks objects for writing! */ 779 void StorageController::setBootable(BOOL fBootable) 780 { 781 AutoCaller autoCaller(this); 782 AssertComRCReturnVoid(autoCaller.rc()); 783 784 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 785 786 m->bd.backup(); 787 m->bd->fBootable = fBootable; 788 } 789 790 /** @note Locks objects for writing! */ 756 791 void StorageController::rollback() 757 792 { -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r33959 r34010 3419 3419 <interface 3420 3420 name="IMachine" extends="$unknown" 3421 uuid=" cc4fec9a-3150-45df-9ee9-f00ba54d6ac3"3421 uuid="7c05b1c3-c325-46cd-820d-47648d13b7f2" 3422 3422 wsmap="managed" 3423 3423 > … … 4645 4645 </desc> 4646 4646 <param name="name" type="wstring" dir="in"/> 4647 </method> 4648 4649 <method name="setStorageControllerBootable"> 4650 <desc> 4651 Sets the bootable flag of the storage controller with the given name. 4652 4653 <result name="VBOX_E_OBJECT_NOT_FOUND"> 4654 A storage controller with given name doesn't exist. 4655 </result> 4656 <result name="VBOX_E_OBJECT_IN_USE"> 4657 Another storage controller is marked as bootable already. 4658 </result> 4659 </desc> 4660 <param name="name" type="wstring" dir="in"/> 4661 <param name="bootable" type="boolean" dir="in"/> 4647 4662 </method> 4648 4663 … … 13272 13287 <interface 13273 13288 name="IStorageController" extends="$unknown" 13274 uuid=" fd93adc0-bbaa-4256-9e6e-00e29f9151c9"13289 uuid="1556333-09b6-46d9-bfb7-fc239b7fbe1e" 13275 13290 wsmap="managed" 13276 13291 > … … 13367 13382 virtual machines are running at the same time to prevent I/O cache related hangs. 13368 13383 This option new with the API of VirtualBox 3.2 and is now the default for non-IDE storage controllers. 13384 </desc> 13385 </attribute> 13386 13387 <attribute name="bootable" type="boolean" readonly="yes"> 13388 <desc> 13389 Returns whether it is possible to boot from disks attached to this controller. 13369 13390 </desc> 13370 13391 </attribute> -
trunk/src/VBox/Main/include/MachineImpl.h
r33952 r34010 507 507 STDMETHOD(GetStorageControllerByName(IN_BSTR aName, IStorageController **storageController)); 508 508 STDMETHOD(GetStorageControllerByInstance(ULONG aInstance, IStorageController **storageController)); 509 STDMETHOD(SetStorageControllerBootable)(IN_BSTR aName, BOOL fBootable); 509 510 STDMETHOD(QuerySavedGuestSize)(ULONG aScreenId, ULONG *puWidth, ULONG *puHeight); 510 511 STDMETHOD(QuerySavedThumbnailSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight); -
trunk/src/VBox/Main/include/StorageControllerImpl.h
r31308 r34010 51 51 const Utf8Str &aName, 52 52 StorageBus_T aBus, 53 ULONG aInstance); 53 ULONG aInstance, 54 bool fBootable); 54 55 HRESULT init(Machine *aParent, 55 56 StorageController *aThat, … … 73 74 STDMETHOD(COMGETTER(UseHostIOCache)) (BOOL *fUseHostIOCache); 74 75 STDMETHOD(COMSETTER(UseHostIOCache)) (BOOL fUseHostIOCache); 76 STDMETHOD(COMGETTER(Bootable)) (BOOL *fBootable); 75 77 76 78 // StorageController methods … … 84 86 StorageBus_T getStorageBus() const; 85 87 ULONG getInstance() const; 88 bool getBootable() const; 86 89 87 90 HRESULT checkPortAndDeviceValid(LONG aControllerPort, 88 91 LONG aDevice); 92 93 void setBootable(BOOL fBootable); 89 94 90 95 void rollback(); -
trunk/src/VBox/Main/xml/Settings.cpp
r33828 r34010 2814 2814 // default from constructor is 0 2815 2815 2816 pelmController->getAttributeValue("Bootable", sctl.fBootable); 2817 // default from constructor is true which is true 2818 // for settings below version 1.11 because they allowed only 2819 // one controller per type. 2820 2816 2821 Utf8Str strType; 2817 2822 if (!pelmController->getAttributeValue("type", strType)) … … 3993 3998 pelmController->setAttribute("useHostIOCache", sc.fUseHostIOCache); 3994 3999 4000 if (m->sv >= SettingsVersion_v1_11) 4001 pelmController->setAttribute("Bootable", sc.fBootable); 4002 3995 4003 if (sc.controllerType == StorageControllerType_IntelAhci) 3996 4004 { … … 4390 4398 } 4391 4399 4400 // Settings version 1.11 is required if more than one controller of each type 4401 // is present. 4402 if (m->sv < SettingsVersion_v1_11) 4403 { 4404 size_t cSata = 0; 4405 size_t cScsiLsi = 0; 4406 size_t cScsiBuslogic = 0; 4407 size_t cSas = 0; 4408 size_t cIde = 0; 4409 size_t cFloppy = 0; 4410 4411 for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin(); 4412 it != storageMachine.llStorageControllers.end(); 4413 ++it) 4414 { 4415 switch ((*it).storageBus) 4416 { 4417 case StorageBus_IDE: 4418 cIde++; 4419 break; 4420 case StorageBus_SATA: 4421 cSata++; 4422 break; 4423 case StorageBus_SAS: 4424 cSas++; 4425 break; 4426 case StorageBus_SCSI: 4427 if ((*it).controllerType == StorageControllerType_LsiLogic) 4428 cScsiLsi++; 4429 else 4430 cScsiBuslogic++; 4431 break; 4432 case StorageBus_Floppy: 4433 cFloppy++; 4434 break; 4435 default: 4436 // Do nothing 4437 break; 4438 } 4439 4440 if ( cSata > 1 4441 || cScsiLsi > 1 4442 || cScsiBuslogic > 1 4443 || cSas > 1 4444 || cIde > 1 4445 || cFloppy > 1) 4446 m->sv = SettingsVersion_v1_11; 4447 } 4448 } 4449 4392 4450 // settings version 1.9 is required if there is not exactly one DVD 4393 4451 // or more than one floppy drive present or the DVD is not at the secondary
Note:
See TracChangeset
for help on using the changeset viewer.