VirtualBox

Changeset 29497 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
May 14, 2010 7:45:44 PM (15 years ago)
Author:
vboxsync
Message:

Storage/VBoxHDD: fix long-standing bugs in VDCopy, which show in VBoxManage clonehd. Check whether CreateDiff or CreateBase needs to be used was wrong, and copying of parent UUID information is completely useless (the latter is #6408)

File:
1 edited

Legend:

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

    r29413 r29497  
    14591459                                                         pTmp, 1,
    14601460                                                         pIoCtx, cbThisWrite,
    1461                                                          pTmp, 
     1461                                                         pTmp,
    14621462                                                           (pImage->uOpenFlags & VD_OPEN_FLAGS_HONOR_SAME)
    14631463                                                         ? vdWriteHelperStandardAsync
     
    18401840                if (RT_FAILURE(pIoCtx->rcReq))
    18411841                    ASMAtomicCmpXchgS32(&pIoCtxParent->rcReq, pIoCtx->rcReq, VINF_SUCCESS);
    1842  
     1842
    18431843                /*
    18441844                 * A completed child write means that we finsihed growing the image.
     
    39373937
    39383938        RTUUID ImageUuid, ImageModificationUuid;
    3939         RTUUID ParentUuid, ParentModificationUuid;
    39403939        if (pDiskFrom != pDiskTo)
    39413940        {
     
    39543953        if (RT_FAILURE(rc))
    39553954            RTUuidClear(&ImageModificationUuid);
    3956         rc = pImageFrom->Backend->pfnGetParentUuid(pImageFrom->pvBackendData, &ParentUuid);
    3957         if (RT_FAILURE(rc))
    3958             RTUuidClear(&ParentUuid);
    3959         rc = pImageFrom->Backend->pfnGetParentModificationUuid(pImageFrom->pvBackendData, &ParentModificationUuid);
    3960         if (RT_FAILURE(rc))
    3961             RTUuidClear(&ParentModificationUuid);
    39623955
    39633956        char szComment[1024];
     
    39753968        fLockReadFrom = false;
    39763969
     3970        rc2 = vdThreadStartRead(pDiskTo);
     3971        AssertRC(rc2);
     3972        unsigned cImagesTo = pDiskTo->cImages;
     3973        rc2 = vdThreadFinishRead(pDiskTo);
     3974        AssertRC(rc2);
     3975
    39773976        if (pszFilename)
    39783977        {
     
    39803979                cbSize = cbSizeFrom;
    39813980
    3982             /* Create destination image with the properties of the source image. */
     3981            /* Create destination image with the properties of source image. */
    39833982            /** @todo replace the VDCreateDiff/VDCreateBase calls by direct
    39843983             * calls to the backend. Unifies the code and reduces the API
    39853984             * dependencies. Would also make the synchronization explicit. */
    3986             if (uImageFlags & VD_IMAGE_FLAGS_DIFF)
     3985            if (cImagesTo > 0)
    39873986            {
    3988                 rc = VDCreateDiff(pDiskTo, pszBackend, pszFilename, uImageFlags,
    3989                                   szComment, &ImageUuid, &ParentUuid, uOpenFlagsFrom & ~VD_OPEN_FLAGS_READONLY, NULL, NULL);
     3987                rc = VDCreateDiff(pDiskTo, pszBackend, pszFilename,
     3988                                  uImageFlags, szComment, &ImageUuid,
     3989                                  NULL /* pParentUuid */,
     3990                                  uOpenFlagsFrom & ~VD_OPEN_FLAGS_READONLY,
     3991                                  NULL, NULL);
    39903992
    39913993                rc2 = vdThreadStartWrite(pDiskTo);
     
    40244026                if (RT_SUCCESS(rc) && !RTUuidIsNull(&ImageUuid))
    40254027                     pDiskTo->pLast->Backend->pfnSetUuid(pDiskTo->pLast->pvBackendData, &ImageUuid);
    4026                 if (RT_SUCCESS(rc) && !RTUuidIsNull(&ParentUuid))
    4027                      pDiskTo->pLast->Backend->pfnSetParentUuid(pDiskTo->pLast->pvBackendData, &ParentUuid);
    40284028            }
    40294029            if (RT_FAILURE(rc))
     
    41384138            if (!RTUuidIsNull(&ImageModificationUuid))
    41394139                pImageTo->Backend->pfnSetModificationUuid(pImageTo->pvBackendData, &ImageModificationUuid);
    4140             /** @todo double-check this - it makes little sense to copy over the parent modification uuid,
    4141              * as the destination image can have a totally different parent. */
    4142 #if 0
    4143             pImageTo->Backend->pfnSetParentModificationUuid(pImageTo->pvBackendData, &ParentModificationUuid);
    4144 #endif
    41454140        }
    41464141    } while (0);
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