VirtualBox

Changeset 18306 in vbox


Ignore:
Timestamp:
Mar 26, 2009 11:57:52 AM (16 years ago)
Author:
vboxsync
Message:

OVF: fix progress values for disks on import

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

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

    r18304 r18306  
    5151    int64_t iCapacity;              // value from DiskSection/Disk/@capacity;
    5252                                    // (maximum size for dynamic images, I guess; we always translate this to bytes)
    53     int64_t iPopulatedSize;         // value from DiskSection/Disk/@populatedSize
     53    int64_t iPopulatedSize;         // optional value from DiskSection/Disk/@populatedSize
    5454                                    // (actual used size of disk, always in bytes; can be an estimate of used disk
    55                                     // space, but cannot be larger than iCapacity)
     55                                    // space, but cannot be larger than iCapacity; -1 if not set)
    5656    Utf8Str strFormat;              // value from DiskSection/Disk/@format
    5757                // typically http://www.vmware.com/specifications/vmdk.html#sparse
     
    15511551                                                  pController->ulIndex,
    15521552                                                  hd.ulAddressOnParent);
     1553                        ULONG ulSize = 0;
     1554                        if (di.iPopulatedSize != -1)
     1555                            ulSize = (ULONG)(di.iPopulatedSize / _1M);
     1556                        else if (di.iSize != -1)
     1557                            ulSize = (ULONG)(di.iSize / _1M);
     1558                        else if (di.iCapacity != -1)
     1559                            ulSize = (ULONG)(di.iCapacity / _1M);
     1560                        if (ulSize == 0)
     1561                            ulSize = 10000;         // assume 10 GB, this is for the progress bar only anyway
    15531562                        pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage,
    15541563                                           hd.strDiskId,
    15551564                                           di.strHref,
    15561565                                           strPath,
    1557                                            (uint32_t)(di.iPopulatedSize / _1M),
     1566                                           ulSize,
    15581567                                           strExtraConfig);
    15591568                    }
     
    17451754            }
    17461755
    1747             if (!task->progress.isNull())
    1748                 rc = task->progress->setCurrentOperationProgress(20);       // let's say 1/5 of the XML is done here
    1749 
    17501756            /* CPU count (ignored for now) */
    17511757            // EntriesList vsdeCPU = vsd->findByType (VirtualSystemDescriptionType_CPU);
     
    17681774            rc = pNewMachine->COMSETTER(VRAMSize)(vramVBox);
    17691775            if (FAILED(rc)) throw rc;
    1770 
    1771             if (!task->progress.isNull())
    1772                 rc = task->progress->setCurrentOperationProgress(40);       // let's say 2/5 of the XML is done here
    17731776
    17741777            /* Audio Adapter */
     
    18041807            if (FAILED(rc)) throw rc;
    18051808#endif /* VBOX_WITH_USB */
    1806 
    1807             if (!task->progress.isNull())
    1808                 rc = task->progress->setCurrentOperationProgress(60);       // let's say 3/5 of the XML is done here
    18091809
    18101810            /* Change the network adapters */
     
    19181918            if (FAILED(rc)) throw rc;
    19191919
    1920             if (!task->progress.isNull())
    1921                 rc = task->progress->setCurrentOperationProgress(80);       // let's say 4/5 of the XML is done here
    1922 
    19231920            /* CDROM drive */
    19241921            /* @todo: I can't disable the CDROM. So nothing to do for now */
     
    20042001            if (FAILED(rc)) throw rc;
    20052002
    2006             if (!task->progress.isNull())
    2007                 rc = task->progress->setCurrentOperationProgress(90);
    2008 
    20092003            // store new machine for roll-back in case of errors
    20102004            llMachinesRegistered.push_back(newMachineId);
     
    31603154        std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
    31613155        for (itH = avsdeHDs.begin();
    3162                 itH != avsdeHDs.end();
    3163                 ++itH)
     3156             itH != avsdeHDs.end();
     3157             ++itH)
    31643158        {
    3165             ulTotalMB += (**itH).ulSizeMB;
     3159            const VirtualSystemDescriptionEntry *pHD = *itH;
     3160            ulTotalMB += pHD->ulSizeMB;
    31663161            ++cDisks;
    31673162        }
  • trunk/src/VBox/Main/ProgressImpl.cpp

    r18277 r18306  
    859859    m_ulOperationPercent = 0;
    860860
    861     Log(("Progress::setNextOperation(%ls): ulNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeightis now %d\n",
     861    Log(("Progress::setNextOperation(%ls): ulNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",
    862862         m_bstrOperationDescription.raw(), ulNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight));
    863863
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