VirtualBox

Changeset 31258 in vbox for trunk


Ignore:
Timestamp:
Jul 30, 2010 6:26:09 PM (14 years ago)
Author:
vboxsync
Message:

Main/Medium+Storage/VBoxHDD: fix incorrect handling of diff media in VirtualBox::OpenHardDisk

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r31185 r31258  
    33833383            }
    33843384        }
     3385
     3386        /* Ensure we always get correct diff information, even if the backend
     3387         * doesn't actually have a stored flag for this. It must not return
     3388         * bogus information for the parent UUID if it is not a diff image. */
     3389        RTUUID parentUuid;
     3390        RTUuidClear(&parentUuid);
     3391        rc2 = pImage->Backend->pfnGetParentUuid(pImage->pvBackendData, &parentUuid);
     3392        if (RT_SUCCESS(rc2) && !RTUuidIsNull(&parentUuid))
     3393            uImageFlags |= VD_IMAGE_FLAGS_DIFF;
     3394
    33853395        pImage->uImageFlags = uImageFlags;
    33863396
     
    57665776        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    57675777
    5768         *puImageFlags = pImage->Backend->pfnGetImageFlags(pImage->pvBackendData);
     5778        *puImageFlags = pImage->uImageFlags;
    57695779    } while (0);
    57705780
  • trunk/src/VBox/Main/MediumImpl.cpp

    r31239 r31258  
    35403540        {
    35413541            /** @todo This kind of opening of media is assuming that diff
    3542              * media can be opened as base media. Should be documented if
     3542             * media can be opened as base media. Should be documented that
    35433543             * it must work for all medium format backends. */
    35443544            vrc = VDOpen(hdd,
     
    36183618            }
    36193619
    3620             /* check the type */
     3620            /* get the medium variant */
    36213621            unsigned uImageFlags;
    36223622            vrc = VDGetImageFlags(hdd, 0, &uImageFlags);
     
    36243624            m->variant = (MediumVariant_T)uImageFlags;
    36253625
     3626            /* check/get the parent uuid and update corresponding state */
    36263627            if (uImageFlags & VD_IMAGE_FLAGS_DIFF)
    36273628            {
     
    36423643                    ComObjPtr<Medium> pParent;
    36433644                    rc = m->pVirtualBox->findHardDisk(&id, NULL,
    3644                                                    false /* aSetError */,
    3645                                                    &pParent);
     3645                                                      false /* aSetError */,
     3646                                                      &pParent);
    36463647                    if (FAILED(rc))
    36473648                    {
     
    45994600 *
    46004601 * Given this medium is SOURCE and the specified medium is TARGET, we will
    4601  * get two varians of the merge operation:
     4602 * get two variants of the merge operation:
    46024603 *
    46034604 *                forward merge
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