VirtualBox

Changeset 84535 in vbox for trunk/src


Ignore:
Timestamp:
May 26, 2020 11:05:07 AM (5 years ago)
Author:
vboxsync
Message:

Main/Appliance::i_importCloudImpl: %ul is wrong. Just use %RU64 and combine the two appends into a single call. Check status code. If you want to restore a previous hrc value, you must also restore the associated error info or we'll have some really confusing error messages. The first hrc restoring after cleanups looks wrong, as it's ignoring cleanup errors. bugref:9416

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r84532 r84535  
    14541454            {
    14551455                /* what to do? create a new name from the old one with some suffix? */
    1456                 uint64_t suff = RTRandU64();
    1457                 strVMName.append("__").appendPrintfNoThrow("%ul", suff);
     1456                uint64_t uRndSuff = RTRandU64();
     1457                vrc = strVMName.appendPrintfNoThrow("__%RU64", uRndSuff);
     1458                AssertRCBreakStmt(vrc, hrc = E_OUTOFMEMORY);
    14581459
    14591460                vsd->RemoveDescriptionByType(VirtualSystemDescriptionType_Name);
     
    15461547
    15471548
    1548     HRESULT original_hrc = hrc;//save the original result
    1549 
    15501549    /* In any case we delete the cloud leavings which may exist after the first phase (cloud phase).
    15511550     * Should they be deleted in the OCICloudClient::importInstance()?
    15521551     * Because deleting them here is not easy as it in the importInstance(). */
    15531552    {
     1553        ErrorInfoKeeper eik;    /* save the error info */
     1554        HRESULT const hrcSaved = hrc;
     1555
    15541556        GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId)//aVBoxValues is set in this #define
    15551557        if (aVBoxValues.size() == 0)
     
    15801582         * Thus we restore the original error in the case when the cleanup phase was successful
    15811583         * Otherwise we return not the original error but the last error in the cleanup phase */
    1582          hrc = original_hrc;
     1584        /** @todo r=bird: do this conditionally perhaps?
     1585         * if (FAILED(hrcSaved))
     1586         *     hrc = hrcSaved;
     1587         * else
     1588         *     eik.forget();
     1589         */
     1590        hrc = hrcSaved;
    15831591    }
    15841592
    15851593    if (FAILED(hrc))
    15861594    {
     1595        /** @todo r=bird: Using heap to keep a readonly C-string is a real wonderful
     1596         *        way to doing things. */
    15871597        Utf8Str generalRollBackErrorMessage("Rollback action for Import Cloud operation failed. "
    15881598                                            "Some leavings may exist on the local disk or in the Cloud.");
     
    15971607         */
    15981608
    1599         {
     1609        { /** @todo r=bird: Pointless {}. */
    16001610            if (!fKeepDownloadedObject)
    16011611            {
     1612                ErrorInfoKeeper eik;    /* save the error info */
     1613                HRESULT const hrcSaved = hrc;
     1614
    16021615                /* small explanation here, the image here points out to the whole downloaded object (not to the image only)
    16031616                 * filled during the first cloud import stage (in the ICloudClient::importInstance()) */
     
    16221635                    }
    16231636                }
    1624             }
    1625         }
    1626 
    1627         /* Because during the rollback phase the hrc may have the good result
    1628          * Thus we restore the original error in the case when the rollback phase was successful
    1629          * Otherwise we return not the original error but the last error in the rollback phase */
    1630          hrc = original_hrc;
     1637
     1638                /* Because during the rollback phase the hrc may have the good result
     1639                 * Thus we restore the original error in the case when the rollback phase was successful
     1640                 * Otherwise we return not the original error but the last error in the rollback phase */
     1641                hrc = hrcSaved;
     1642            }
     1643        }
    16311644    }
    16321645    else
Note: See TracChangeset for help on using the changeset viewer.

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