VirtualBox

Changeset 46615 in vbox for trunk


Ignore:
Timestamp:
Jun 18, 2013 10:36:12 AM (12 years ago)
Author:
vboxsync
Message:

pr5429. Improvement the logic related to the OVA import.

File:
1 edited

Legend:

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

    r46581 r46615  
    26862686                ovf::DiskImage diCurrent = oit->second;
    26872687                ovf::VirtualDisksMap::const_iterator itVDisk = vsysThis.mapVirtualDisks.begin();
    2688                 bool fFoundInCurrentPosition = false;
    26892688
    26902689                VirtualSystemDescriptionEntry *vsdeTargetHD = 0;
     
    27352734                if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
    27362735                {
     2736                    /* It means that we possibly have imported the storage earlier on the previous loop steps*/
     2737                    std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
     2738                    if (h != disksResolvedNames.end())
     2739                    {
     2740                        /* Yes, disk name was found, we can skip it*/
     2741                        ++oit;
     2742                        continue;
     2743                    }
     2744
    27372745                    RTCString availableImage(diCurrent.strHref);
    27382746
     
    27462754                        if(availableImage.compare(diCurrent.strHref, Utf8Str::CaseInsensitive) != 0)
    27472755                        {
    2748 
    2749                             if (RTPathHaveExt(availableImage.c_str()))
    2750                             {
    2751                                 /* Figure out which format the user have. */
    2752                                 char *pszExt = RTPathExt(availableImage.c_str());
    2753                                 /* Get the system properties. */
    2754                                 SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
    2755                                 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszExt[1]);
    2756                                 if (trgFormat.isNull())
    2757                                 {
    2758                                     ++oit;
    2759                                     continue;
    2760                                 }
    2761                             }
    2762 
    27632756                            /*
    27642757                             *
     
    28192812                        else
    28202813                        {
    2821                             fFoundInCurrentPosition = true;
    28222814                            ++oit;
    28232815                        }
     
    28322824                {
    28332825                    /* just continue with normal files*/
    2834                     fFoundInCurrentPosition = true;
    28352826                    ++oit;
    2836                 }
    2837 
    2838                 /* It means that we possibly have imported the storage earlier on the previous loop steps*/
    2839                 if (!fFoundInCurrentPosition)
    2840                 {
    2841                     std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
    2842                     if (h != disksResolvedNames.end())
    2843                     {
    2844                         /* Yes, disk name was found, we can skip it*/
    2845                         continue;
    2846                     }
    28472827                }
    28482828
     
    31403120    while(oit != stack.mapDisks.end())
    31413121    {
    3142         if (RTPathHaveExt(oit->first.c_str()))
     3122        if (RTPathHaveExt(oit->second.strHref.c_str()))
    31433123        {
    31443124            /* Figure out which format the user have. */
     
    31553135
    31563136        ovf::DiskImage diCurrent = oit->second;
    3157         bool fFoundInCurrentPosition = false;
    31583137
    31593138        VirtualSystemDescriptionEntry *vsdeTargetHD = 0;
     
    31923171        if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
    31933172        {
     3173            /* It means that we possibly have imported the storage earlier on the previous loop steps*/
     3174            std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
     3175            if (h != disksResolvedNames.end())
     3176            {
     3177                /* Yes, disk name was found, we can skip it*/
     3178                ++oit;
     3179                continue;
     3180            }
     3181
    31943182            RTCString availableImage(diCurrent.strHref);
    31953183
     
    32033191                if(availableImage.compare(diCurrent.strHref, Utf8Str::CaseInsensitive) != 0)
    32043192                {
    3205                     if (RTPathHaveExt(availableImage.c_str()))
    3206                     {
    3207                         /* Figure out which format the user have. */
    3208                         char *pszExt = RTPathExt(availableImage.c_str());
    3209                         /* Get the system properties. */
    3210                         SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
    3211                         ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszExt[1]);
    3212                         if (trgFormat.isNull())
    3213                         {
    3214                             ++oit;
    3215                             continue;
    3216                         }
    3217                     }
    3218 
    32193193                    // availableImage contains the disk identifier (e.g. "vmdisk1"), which should exist
    32203194                    // in the virtual system's disks map under that ID and also in the global images map
     
    32583232                else
    32593233                {
    3260                     fFoundInCurrentPosition = true;
    32613234                    ++oit;
    32623235                }
     
    32713244        {
    32723245            /* just continue with normal files*/
    3273             fFoundInCurrentPosition = true;
    32743246            ++oit;
    3275         }
    3276 
    3277         /* It means that we possibly have imported the storage earlier on the previous loop steps*/
    3278         if (!fFoundInCurrentPosition)
    3279         {
    3280             std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
    3281             if (h != disksResolvedNames.end())
    3282             {
    3283                 /* Yes, disk name was found, we can skip it*/
    3284                 continue;
    3285             }
    32863247        }
    32873248
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