VirtualBox

Changeset 79584 in vbox


Ignore:
Timestamp:
Jul 8, 2019 7:40:46 AM (6 years ago)
Author:
vboxsync
Message:

bugref:9416. little bit reshuffled the parts of cleanup code.

File:
1 edited

Legend:

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

    r79306 r79584  
    14771477    }
    14781478
     1479
     1480    HRESULT original_hrc = hrc;//save the original result
     1481
     1482    /* In any case we delete the cloud leavings which may exist after the first phase (cloud phase).
     1483     * Should they be deleted in the OCICloudClient::importInstance()?
     1484     * Because deleting them here is not easy as it in the importInstance(). */
     1485    {
     1486        GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId)//aVBoxValues is set in this #define
     1487        if (aVBoxValues.size() == 0)
     1488            hrc = setErrorVrc(VERR_NOT_FOUND, tr("%s: Cloud cleanup action - the instance wasn't found", __FUNCTION__));
     1489        else
     1490        {
     1491            vsdData = aVBoxValues[0];
     1492
     1493            /** @todo
     1494             *  future function which will eliminate the temporary objects created during the first phase.
     1495             *  hrc = cloud.EliminateImportLeavings(aVBoxValues[0], pProgress); */
     1496            if (FAILED(hrc))
     1497            {
     1498                hrc = setErrorVrc(VERR_INVALID_STATE, tr("Some leavings may exist in the Cloud."));
     1499                LogRel(("%s: Cleanup action - the leavings in the %s after import the "
     1500                        "instance %s may not have been deleted\n",
     1501                        __FUNCTION__, strProviderName.c_str(), vsdData.c_str()));
     1502            }
     1503            else
     1504                LogRel(("%s: Cleanup action - the leavings in the %s after import the "
     1505                        "instance %s have been deleted\n",
     1506                        __FUNCTION__, strProviderName.c_str(), vsdData.c_str()));
     1507        }
     1508
     1509        /* Because during the cleanup phase the hrc may have the good result
     1510         * Thus we restore the original error in the case when the cleanup phase was successful
     1511         * Otherwise we return not the original error but the last error in the cleanup phase */
     1512         hrc = original_hrc;
     1513    }
     1514
    14791515    if (FAILED(hrc))
    14801516    {
    1481         HRESULT temp_hrc = hrc;//save the original result
    14821517        Utf8Str generalRollBackErrorMessage("Rollback action for Import Cloud operation failed."
    14831518                                            "Some leavings may exist on the local disk or in the Cloud.");
     
    14901525         * Maximum what we have there are:
    14911526         * 1. The downloaded object, so just check the presence and delete it if one exists
    1492          * 2. Some leftovers in the Cloud. Also delete them too if it's possible.
    1493          *    Should they be deleted in the OCICloudClient::importInstance()?
    1494          *    Because deleting them here is not easy as it in the importInstance().
    14951527         */
    14961528
     
    15231555        }
    15241556
    1525         {
    1526             GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId)//aVBoxValues is set in this #define
    1527             if (aVBoxValues.size() == 0)
    1528                 hrc = setErrorVrc(VERR_NOT_FOUND, generalRollBackErrorMessage.c_str());
    1529             else
    1530             {
    1531                 vsdData = aVBoxValues[0];
    1532 
    1533                 /** @todo
    1534                  *  future function which will eliminate the temporary objects created during the first phase.
    1535                  *  hrc = cloud.EliminateImportLeavings(aVBoxValues[0], pProgress); */
    1536                 if (FAILED(hrc))
    1537                 {
    1538                     hrc = setErrorVrc(VERR_INVALID_STATE, generalRollBackErrorMessage.c_str());
    1539                     LogRel(("%s: Rollback action - the leavings in the %s after import the "
    1540                             "instance %s may not have been deleted\n",
    1541                             __FUNCTION__, strProviderName.c_str(), vsdData.c_str()));
    1542                 }
    1543                 else
    1544                     LogRel(("%s: Rollback action - the leavings in the %s after import the "
    1545                             "instance %s have been deleted\n",
    1546                             __FUNCTION__, strProviderName.c_str(), vsdData.c_str()));
    1547             }
    1548         }
    1549 
    15501557        /* Because during the rollback phase the hrc may have the good result
    15511558         * Thus we restore the original error in the case when the rollback phase was successful
    15521559         * Otherwise we return not the original error but the last error in the rollback phase */
    1553         if (SUCCEEDED(hrc))
    1554             hrc = setError(temp_hrc, strLastActualErrorDesc.c_str());//restore the original result
     1560         hrc = original_hrc;
    15551561    }
    15561562    else
     
    20362042        }
    20372043
     2044        hrc = E_FAIL;
    20382045        if (FAILED(hrc))
    20392046        {
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