VirtualBox

Changeset 49416 in vbox for trunk/src


Ignore:
Timestamp:
Nov 8, 2013 8:05:09 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90475
Message:

pr7074. import logic for work with multiple VMs in OVF appliance was fixed.

File:
1 edited

Legend:

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

    r49039 r49416  
    21072107}
    21082108
    2109 
    21102109/**
    21112110 * Helper that converts VirtualSystem attachment values into VirtualBox attachment values.
     
    33963395    settings::StorageControllersList &llControllers = config.storageMachine.llStorageControllers;
    33973396    Guid hdUuid;
    3398     uint32_t cHardDisks = 0;
     3397    uint32_t cDisks = 0;
    33993398    bool fInconsistent = false;
    34003399    bool fRepairDuplicate = false;
     
    34203419            {
    34213420                const Guid &thisUuid = it4->uuid;
    3422                 cHardDisks++;
    3423                 if (cHardDisks == 1)
     3421                cDisks++;
     3422                if (cDisks == 1)
    34243423                {
    34253424                    if (hdUuid.isZero())
     
    34403439    }
    34413440    /* paranoia... */
    3442     if (fInconsistent || cHardDisks == 1)
     3441    if (fInconsistent || cDisks == 1)
    34433442        fRepairDuplicate = false;
    34443443
     
    34463445     * step 2: scan the machine config for media attachments
    34473446     */
     3447
     3448    /* get VM name from virtual system description. Only one record is possible (size of list is equal 1). */
     3449    std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
     3450    std::list<VirtualSystemDescriptionEntry*>::iterator vmNameIt = vmName.begin();
     3451    VirtualSystemDescriptionEntry* vmNameEntry = *vmNameIt;
    34483452
    34493453    /* Get all hard disk descriptions. */
     
    34513455    std::list<VirtualSystemDescriptionEntry*>::iterator avsdeHDsIt = avsdeHDs.begin();
    34523456    /* paranoia - if there is no 1:1 match do not try to repair. */
    3453     if (cHardDisks != avsdeHDs.size())
     3457    if (cDisks != avsdeHDs.size())
    34543458        fRepairDuplicate = false;
    34553459
     
    34593463    std::set<RTCString>  disksResolvedNames;
    34603464
    3461     while(oit != stack.mapDisks.end())
     3465    uint32_t cImportedDisks = 0;
     3466
     3467    while(oit != stack.mapDisks.end() && cImportedDisks != avsdeHDs.size())
    34623468    {
    34633469        ovf::DiskImage diCurrent = oit->second;
     
    34813487                }
    34823488            }
     3489
    34833490            if (!vsdeTargetHD)
    3484                 throw setError(E_FAIL,
    3485                                tr("Internal inconsistency looking up disk image '%s'"),
    3486                                oit->first.c_str());
     3491            {
     3492                /* possible case if a disk image belongs to other virtual system (OVF package with multiple VMs inside) */
     3493                LogWarning(("OVA/OVF import: Disk image %s was missed during import of VM %s\n",
     3494                            oit->first.c_str(), vmNameEntry->strOvf.c_str()));
     3495                ++oit;
     3496                continue;
     3497
     3498            }
    34873499        }
    34883500
     
    35543566                    }
    35553567                    if (!vsdeTargetHD)
     3568                        /*
     3569                         * in this case it's an error because something wrong with OVF description file.
     3570                         * May be VB imports OVA package with wrong file sequence inside the archive.
     3571                         */
    35563572                        throw setError(E_FAIL,
    35573573                                       tr("Internal inconsistency looking up disk image '%s'"),
     
    36933709                           strUuid.c_str());
    36943710
     3711        ++cImportedDisks;
     3712
    36953713    }// while(oit != stack.mapDisks.end())
     3714
     3715    /*
     3716     * quantity of the imported disks isn't equal to the size of the avsdeHDs list.
     3717     */
     3718    if(cImportedDisks < avsdeHDs.size())
     3719    {
     3720        LogWarning(("Not all disk images were imported for VM %s. Check OVF description file.",
     3721                    vmNameEntry->strOvf.c_str()));
     3722    }
    36963723
    36973724    /*
Note: See TracChangeset for help on using the changeset viewer.

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