VirtualBox

Ignore:
Timestamp:
Mar 13, 2009 2:14:08 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
44367
Message:

OVF: move warnings from IVirtualSystem to IAppliance; fix error messages when OVF wants more than one SCSI controller; API docs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ApplianceImpl.cpp

    r17825 r17827  
    198198
    199199    list< ComObjPtr<VirtualSystemDescription> > virtualSystemDescriptions; //
     200
     201    list<Utf8Str> llWarnings;
    200202};
    201203
     
    203205{
    204206    list<VirtualSystemDescriptionEntry> llDescriptions;
    205     list<Utf8Str> llWarnings;
    206207};
    207208
     
    12761277            if (cpuCountVBox > 1) //SchemaDefs::MaxCPUCount)
    12771278            {
    1278                 pNewDesc->addWarning(tr("The virtual system claims support for %u CPU's, but VirtualBox has support for max %u CPU's only."),
    1279                                        cpuCountVBox, 1); //SchemaDefs::MaxCPUCount);
     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);
    12801281                cpuCountVBox = 1; //SchemaDefs::MaxCPUCount;
    12811282            }
     
    12941295                 ullMemSizeVBox > static_cast<uint64_t>(SchemaDefs::MaxGuestRAM)))
    12951296            {
    1296                 pNewDesc->addWarning(tr("The virtual system claims support for %llu MB RAM size, but VirtualBox has support for min %u & max %u MB RAM size only."),
    1297                                         ullMemSizeVBox, SchemaDefs::MinGuestRAM, SchemaDefs::MaxGuestRAM);
     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);
    12981299                ullMemSizeVBox = RT_MIN(RT_MAX(ullMemSizeVBox, static_cast<uint64_t>(SchemaDefs::MinGuestRAM)), static_cast<uint64_t>(SchemaDefs::MaxGuestRAM));
    12991300            }
     
    13341335                /* Check for the constrains */
    13351336                if (vsysThis.llNetworkNames.size() > SchemaDefs::NetworkAdapterCount)
    1336                     pNewDesc->addWarning(tr("The virtual system claims support for %u network adapters, but VirtualBox has support for max %u network adapter only."),
    1337                                         vsysThis.llNetworkNames.size(), SchemaDefs::NetworkAdapterCount);
     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);
    13381339
    13391340                /* Get the default network adapter type for the selected guest OS */
     
    14141415                                /* Warn only once */
    14151416                                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());
    14171419
    14181420                            }
     
    14381440                                /* Warn only once */
    14391441                                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());
    14411444
    14421445                            }
     
    14601463                            }
    14611464                            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());
    14681469                            ++cSCSIused;
    14691470                            break;
     
    15081509                        if (!(pController = pNewDesc->findControllerFromID(hd.idController)))
    15091510                            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());
    15111514
    15121515                        /* controller to attach to, and the bus within that controller */
     
    16421645
    16431646    return rc;
     1647}
     1648
     1649/**
     1650* Public method implementation.
     1651 * @return
     1652 */
     1653STDMETHODIMP 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;
    16441678}
    16451679
     
    17131747
    17141748    return opCount;
     1749}
     1750
     1751void 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);
    17151758}
    17161759
     
    26072650                                lBusNumber = 0;
    26082651
    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))
    26102657                                    strResourceSubType = "buslogic";
    2611                                 else if (!desc.strVbox.compare("lsilogic", Utf8Str::CaseInsensitive))
    2612                                     strResourceSubType = "lsilogic";
    26132658                                else
    26142659                                    throw setError(VBOX_E_NOT_SUPPORTED,
     
    31233168
    31243169/**
    3125 * Public method implementation.
    3126  * @return
    3127  */
    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 /**
    31563170 * Internal method; adds a new description item to the member list.
    31573171 * @param aType Type of description for the new item.
     
    31783192}
    31793193
    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 
    31893194/**
    31903195 * Private method; returns a list of description items containing all the items from the member
     
    32243229         ++it)
    32253230    {
    3226         switch (it->type)
     3231        const VirtualSystemDescriptionEntry &d = *it;
     3232        switch (d.type)
    32273233        {
    32283234            case VirtualSystemDescriptionType_HardDiskControllerIDE:
    32293235            case VirtualSystemDescriptionType_HardDiskControllerSATA:
    32303236            case VirtualSystemDescriptionType_HardDiskControllerSCSI:
    3231                 if (it->strRef == strRef)
    3232                     return &(*it);
     3237                if (d.strRef == strRef)
     3238                    return &d;
    32333239            break;
    32343240        }
     
    33883394//     <const name="HardDiskControllerSATA" value="7" />
    33893395        rc = GetStorageControllerByName(Bstr("IDE"), pController.asOutParam());
     3396        strVbox = "";
    33903397        if (SUCCEEDED(rc))
    33913398        {
     
    34003407//     <const name="HardDiskControllerSCSI" value="8" />
    34013408        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        }
    34023417        if (SUCCEEDED(rc))
    34033418        {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette