VirtualBox

Changeset 65530 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jan 31, 2017 10:13:27 AM (8 years ago)
Author:
vboxsync
Message:

bugref:8743. Workaround - fixed logic for putting the virtual disks in appropriate sequence during export. And another one small bug was fixed.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ApplianceImplPrivate.h

    r63184 r65530  
    236236{
    237237    std::map<Utf8Str, const VirtualSystemDescriptionEntry*> mapDisks;
     238    std::list<Utf8Str> mapDiskSequence;
    238239    std::map<Utf8Str, bool> mapNetworks;
    239240};
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r65120 r65530  
    350350
    351351                Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripSuffix();
    352                 strTargetImageName = Utf8StrFmt("%s-disk%d.vmdk", strName.c_str(), ++pAppliance->m->cDisks);
     352                strTargetImageName = Utf8StrFmt("%s-disk%.3d.vmdk", strName.c_str(), ++pAppliance->m->cDisks);
    353353                if (strTargetImageName.length() > RTTAR_NAME_MAX)
    354354                    throw setError(VBOX_E_NOT_SUPPORTED,
     
    442442
    443443                Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripSuffix();
    444                 strTargetImageName = Utf8StrFmt("%s-disk%d.iso", strName.c_str(), ++pAppliance->m->cDisks);
     444                strTargetImageName = Utf8StrFmt("%s-disk%.3d.iso", strName.c_str(), ++pAppliance->m->cDisks);
    445445                if (strTargetImageName.length() > RTTAR_NAME_MAX)
    446446                    throw setError(VBOX_E_NOT_SUPPORTED,
     
    936936    // Finally, write out the disk info
    937937    list<Utf8Str> diskList;
    938     map<Utf8Str, const VirtualSystemDescriptionEntry*>::const_iterator itS;
    939938    uint32_t ulFile = 1;
    940     for (itS = stack.mapDisks.begin();
    941          itS != stack.mapDisks.end();
     939    list<Utf8Str>::const_iterator itS;
     940
     941    for (itS = stack.mapDiskSequence.begin();
     942         itS != stack.mapDiskSequence.end();
    942943         ++itS)
    943944    {
    944         const Utf8Str &strDiskID = itS->first;
    945         const VirtualSystemDescriptionEntry *pDiskEntry = itS->second;
     945        const Utf8Str &strDiskID = *itS;
     946        const VirtualSystemDescriptionEntry *pDiskEntry = stack.mapDisks[strDiskID];
    946947
    947948        // source path: where the VBox image is
     
    10191020        // <File ovf:href="WindowsXpProfessional-disk1.vmdk" ovf:id="file1" ovf:size="1710381056"/>
    10201021        xml::ElementNode *pelmFile = pelmReferences->createChild("File");
     1022        pelmFile->setAttribute("ovf:id", strFileRef);
    10211023        pelmFile->setAttribute("ovf:href", strTargetFileNameOnly);
    1022         pelmFile->setAttribute("ovf:id", strFileRef);
    10231024        /// @todo the actual size is not available at this point of time,
    10241025        // cause the disk will be compressed. The 1.0 standard says this is
     
    15481549
    15491550                        stack.mapDisks[strDiskID] = &desc;
     1551
     1552                        //use the list stack.mapDiskSequence where the disks go as the "VirtualSystem" should be placed
     1553                        //in the OVF description file.
     1554                        stack.mapDiskSequence.push_back(strDiskID);
    15501555                    }
    15511556                    break;
     
    15731578                    if (uLoop == 2)
    15741579                    {
    1575                         //uint32_t cDisks = stack.mapDisks.size();
    1576                         Utf8Str strDiskID = Utf8StrFmt("iso%RI32", ++cDVDs);
    1577 
     1580                        uint32_t cDisks = (uint32_t)stack.mapDisks.size();
     1581                        Utf8Str strDiskID = Utf8StrFmt("iso%RI32", ++cDisks);
     1582                        ++cDVDs;
    15781583                        strDescription = "CD-ROM Drive";
    15791584                        strCaption = Utf8StrFmt("cdrom%RI32", cDVDs);     // OVFTool starts with 1
     
    16201625
    16211626                        stack.mapDisks[strDiskID] = &desc;
     1627
     1628                        //use the list stack.mapDiskSequence where the disks go as the "VirtualSystem" should be placed
     1629                        //in the OVF description file.
     1630                        stack.mapDiskSequence.push_back(strDiskID);
    16221631                        // there is no DVD drive map to update because it is
    16231632                        // handled completely with this entry.
     
    21492158
    21502159        // Finally, write out the disks!
    2151         map<Utf8Str, const VirtualSystemDescriptionEntry*>::const_iterator itS;
    2152         for (itS = stack.mapDisks.begin();
    2153              itS != stack.mapDisks.end();
    2154              ++itS)
    2155         {
    2156             const VirtualSystemDescriptionEntry *pDiskEntry = itS->second;
     2160        //use the list stack.mapDiskSequence where the disks were put as the "VirtualSystem"s had been placed
     2161        //in the OVF description file. I.e. we have one "VirtualSystem" in the OVF file, we extract all disks
     2162        //attached to it. And these disks are stored in the stack.mapDiskSequence. Next we shift to the next
     2163        //"VirtualSystem" and repeat the operation.
     2164        //And here we go through the list and extract all disks in the same sequence
     2165        list<Utf8Str>::const_iterator itS;
     2166        for (itS = stack.mapDiskSequence.begin();
     2167              itS != stack.mapDiskSequence.end();
     2168              ++itS)
     2169        {
     2170            const Utf8Str &strDiskID = *itS;
     2171            const VirtualSystemDescriptionEntry *pDiskEntry = stack.mapDisks[strDiskID];
    21572172
    21582173            // source path: where the VBox image is
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r65186 r65530  
    37583758                     * disks description using the found disk image
    37593759                     */
     3760                    vsdeTargetHD = NULL;
    37603761                    for (list<VirtualSystemDescriptionEntry*>::const_iterator itHD = avsdeHDs.begin();
    37613762                         itHD != avsdeHDs.end();
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