Changeset 17827 in vbox for trunk/src/VBox/Main/ApplianceImpl.cpp
- Timestamp:
- Mar 13, 2009 2:14:08 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 44367
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r17825 r17827 198 198 199 199 list< ComObjPtr<VirtualSystemDescription> > virtualSystemDescriptions; // 200 201 list<Utf8Str> llWarnings; 200 202 }; 201 203 … … 203 205 { 204 206 list<VirtualSystemDescriptionEntry> llDescriptions; 205 list<Utf8Str> llWarnings;206 207 }; 207 208 … … 1276 1277 if (cpuCountVBox > 1) //SchemaDefs::MaxCPUCount) 1277 1278 { 1278 pNewDesc->addWarning(tr("The virtual systemclaims support for %u CPU's, but VirtualBox has support for max %u CPU's only."),1279 1279 addWarning(tr("The virtual system \"%s\" claims support for %u CPU's, but VirtualBox has support for max %u CPU's only."), 1280 vsysThis.strName.c_str(), cpuCountVBox, 1); //SchemaDefs::MaxCPUCount); 1280 1281 cpuCountVBox = 1; //SchemaDefs::MaxCPUCount; 1281 1282 } … … 1294 1295 ullMemSizeVBox > static_cast<uint64_t>(SchemaDefs::MaxGuestRAM))) 1295 1296 { 1296 pNewDesc->addWarning(tr("The virtual systemclaims support for %llu MB RAM size, but VirtualBox has support for min %u & max %u MB RAM size only."),1297 1297 addWarning(tr("The virtual system \"%s\" claims support for %llu MB RAM size, but VirtualBox has support for min %u & max %u MB RAM size only."), 1298 vsysThis.strName.c_str(), ullMemSizeVBox, SchemaDefs::MinGuestRAM, SchemaDefs::MaxGuestRAM); 1298 1299 ullMemSizeVBox = RT_MIN(RT_MAX(ullMemSizeVBox, static_cast<uint64_t>(SchemaDefs::MinGuestRAM)), static_cast<uint64_t>(SchemaDefs::MaxGuestRAM)); 1299 1300 } … … 1334 1335 /* Check for the constrains */ 1335 1336 if (vsysThis.llNetworkNames.size() > SchemaDefs::NetworkAdapterCount) 1336 pNewDesc->addWarning(tr("The virtual systemclaims support for %u network adapters, but VirtualBox has support for max %u network adapter only."),1337 1337 addWarning(tr("The virtual system \"%s\" claims support for %u network adapters, but VirtualBox has support for max %u network adapter only."), 1338 vsysThis.strName.c_str(), vsysThis.llNetworkNames.size(), SchemaDefs::NetworkAdapterCount); 1338 1339 1339 1340 /* Get the default network adapter type for the selected guest OS */ … … 1414 1415 /* Warn only once */ 1415 1416 if (cIDEused == 1) 1416 pNewDesc->addWarning(tr("The virtual system claims support for more than one IDE controller, but VirtualBox has support for only one.")); 1417 addWarning(tr("The virtual \"%s\" system requests support for more than one IDE controller, but VirtualBox has support for only one."), 1418 vsysThis.strName.c_str()); 1417 1419 1418 1420 } … … 1438 1440 /* Warn only once */ 1439 1441 if (cSATAused == 1) 1440 pNewDesc->addWarning(tr("The virtual system claims support for more than one SATA controller, but VirtualBox has support for only one.")); 1442 addWarning(tr("The virtual system \"%s\" requests support for more than one SATA controller, but VirtualBox has support for only one"), 1443 vsysThis.strName.c_str()); 1441 1444 1442 1445 } … … 1460 1463 } 1461 1464 else 1462 { 1463 /* Warn only once */ 1464 if (cSCSIused == 1) 1465 pNewDesc->addWarning(tr("The virtual system claims support for more than one SCSI controller, but VirtualBox has support for only one.")); 1466 1467 } 1465 addWarning(tr("The virtual system \"%s\" requests support for an additional SCSI controller of type \"%s\" with ID %s, but VirtualBox presently supports only one SCSI controller."), 1466 vsysThis.strName.c_str(), 1467 hdc.strControllerType.c_str(), 1468 strControllerID.c_str()); 1468 1469 ++cSCSIused; 1469 1470 break; … … 1508 1509 if (!(pController = pNewDesc->findControllerFromID(hd.idController))) 1509 1510 throw setError(E_FAIL, 1510 tr("Internal inconsistency looking up hard disk controller.")); 1511 tr("Cannot find hard disk controller with OVF instance ID %RI32 to which disk \"%s\" should be attached"), 1512 hd.idController, 1513 di.strHref.c_str()); 1511 1514 1512 1515 /* controller to attach to, and the bus within that controller */ … … 1642 1645 1643 1646 return rc; 1647 } 1648 1649 /** 1650 * Public method implementation. 1651 * @return 1652 */ 1653 STDMETHODIMP Appliance::GetWarnings(ComSafeArrayOut(BSTR, aWarnings)) 1654 { 1655 if (ComSafeArrayOutIsNull(aWarnings)) 1656 return E_POINTER; 1657 1658 AutoCaller autoCaller(this); 1659 CheckComRCReturnRC(autoCaller.rc()); 1660 1661 AutoReadLock alock(this); 1662 1663 com::SafeArray<BSTR> sfaWarnings(m->llWarnings.size()); 1664 1665 list<Utf8Str>::const_iterator it; 1666 size_t i = 0; 1667 for (it = m->llWarnings.begin(); 1668 it != m->llWarnings.end(); 1669 ++it, ++i) 1670 { 1671 Bstr bstr = *it; 1672 bstr.cloneTo(&sfaWarnings[i]); 1673 } 1674 1675 sfaWarnings.detachTo(ComSafeArrayOutArg(aWarnings)); 1676 1677 return S_OK; 1644 1678 } 1645 1679 … … 1713 1747 1714 1748 return opCount; 1749 } 1750 1751 void Appliance::addWarning(const char* aWarning, ...) 1752 { 1753 va_list args; 1754 va_start(args, aWarning); 1755 Utf8StrFmtVA str(aWarning, args); 1756 va_end(args); 1757 m->llWarnings.push_back(str); 1715 1758 } 1716 1759 … … 2607 2650 lBusNumber = 0; 2608 2651 2609 if (!desc.strVbox.compare("buslogic", Utf8Str::CaseInsensitive)) 2652 if ( desc.strVbox.isEmpty() // LsiLogic is the default in VirtualBox 2653 || (!desc.strVbox.compare("lsilogic", Utf8Str::CaseInsensitive)) 2654 ) 2655 strResourceSubType = "lsilogic"; 2656 else if (!desc.strVbox.compare("buslogic", Utf8Str::CaseInsensitive)) 2610 2657 strResourceSubType = "buslogic"; 2611 else if (!desc.strVbox.compare("lsilogic", Utf8Str::CaseInsensitive))2612 strResourceSubType = "lsilogic";2613 2658 else 2614 2659 throw setError(VBOX_E_NOT_SUPPORTED, … … 3123 3168 3124 3169 /** 3125 * Public method implementation.3126 * @return3127 */3128 STDMETHODIMP VirtualSystemDescription::GetWarnings(ComSafeArrayOut(BSTR, aWarnings))3129 {3130 if (ComSafeArrayOutIsNull(aWarnings))3131 return E_POINTER;3132 3133 AutoCaller autoCaller(this);3134 CheckComRCReturnRC(autoCaller.rc());3135 3136 AutoReadLock alock(this);3137 3138 com::SafeArray<BSTR> sfaWarnings(m->llWarnings.size());3139 3140 list<Utf8Str>::const_iterator it;3141 size_t i = 0;3142 for (it = m->llWarnings.begin();3143 it != m->llWarnings.end();3144 ++it, ++i)3145 {3146 Bstr bstr = *it;3147 bstr.cloneTo(&sfaWarnings[i]);3148 }3149 3150 sfaWarnings.detachTo(ComSafeArrayOutArg(aWarnings));3151 3152 return S_OK;3153 }3154 3155 /**3156 3170 * Internal method; adds a new description item to the member list. 3157 3171 * @param aType Type of description for the new item. … … 3178 3192 } 3179 3193 3180 void VirtualSystemDescription::addWarning(const char* aWarning, ...)3181 {3182 va_list args;3183 va_start(args, aWarning);3184 Utf8StrFmtVA str(aWarning, args);3185 va_end(args);3186 m->llWarnings.push_back(str);3187 }3188 3189 3194 /** 3190 3195 * Private method; returns a list of description items containing all the items from the member … … 3224 3229 ++it) 3225 3230 { 3226 switch (it->type) 3231 const VirtualSystemDescriptionEntry &d = *it; 3232 switch (d.type) 3227 3233 { 3228 3234 case VirtualSystemDescriptionType_HardDiskControllerIDE: 3229 3235 case VirtualSystemDescriptionType_HardDiskControllerSATA: 3230 3236 case VirtualSystemDescriptionType_HardDiskControllerSCSI: 3231 if ( it->strRef == strRef)3232 return & (*it);3237 if (d.strRef == strRef) 3238 return &d; 3233 3239 break; 3234 3240 } … … 3388 3394 // <const name="HardDiskControllerSATA" value="7" /> 3389 3395 rc = GetStorageControllerByName(Bstr("IDE"), pController.asOutParam()); 3396 strVbox = ""; 3390 3397 if (SUCCEEDED(rc)) 3391 3398 { … … 3400 3407 // <const name="HardDiskControllerSCSI" value="8" /> 3401 3408 rc = GetStorageControllerByName(Bstr("SCSI"), pController.asOutParam()); 3409 rc = pController->COMGETTER(ControllerType)(&ctlr); 3410 if (FAILED(rc)) throw rc; 3411 strVbox = "LsiLogic"; // the default in VBox 3412 switch(ctlr) 3413 { 3414 case StorageControllerType_LsiLogic: strVbox = "LsiLogic"; break; 3415 case StorageControllerType_BusLogic: strVbox = "BusLogic"; break; 3416 } 3402 3417 if (SUCCEEDED(rc)) 3403 3418 {
Note:
See TracChangeset
for help on using the changeset viewer.