VirtualBox

Changeset 97260 in vbox for trunk/src/VBox/Storage


Ignore:
Timestamp:
Oct 20, 2022 11:02:43 PM (2 years ago)
Author:
vboxsync
Message:

Frontends/VBoxManage+Storage/VMDK+doc/manual: 'VBoxManage createmedium
disk --Variant Rawdisk ...' neglects to use the calculated raw disk size
but instead uses the passed in value which is zero (unless --size or
--sizebyte has been specified) when creating the VMDK image and also
forgets to update the physical disk geometry (PCHS) for the VMDK image.
bugref:9224 ticketref:21125

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/VMDK.cpp

    r97255 r97260  
    50465046        if (RT_SUCCESS(rc))
    50475047        {
     5048            pImage->cbSize = cbSize;
    50485049            /*
    50495050             * Create the raw-drive descriptor
     
    57465747            rc = vmdkMakeRawDescriptor(pImage, &pRaw);
    57475748            if (RT_FAILURE(rc))
    5748                 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: could get raw descriptor for '%s'"), pImage->pszFilename);
     5749                return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: could not create raw descriptor for '%s'"),
     5750                    pImage->pszFilename);
     5751            if (!cbSize)
     5752                cbSize = pImage->cbSize;
    57495753
    57505754            rc = vmdkCreateRawImage(pImage, pRaw, cbSize);
     
    57875791                vmdkDescExtRemoveDummy(pImage, &pImage->Descriptor);
    57885792
    5789             if (   RT_SUCCESS(rc)
    5790                 && pPCHSGeometry->cCylinders != 0
    5791                 && pPCHSGeometry->cHeads != 0
    5792                 && pPCHSGeometry->cSectors != 0)
    5793                 rc = vmdkDescSetPCHSGeometry(pImage, pPCHSGeometry);
     5793            pImage->LCHSGeometry = *pLCHSGeometry;
     5794            pImage->PCHSGeometry = *pPCHSGeometry;
     5795
     5796            if (RT_SUCCESS(rc))
     5797            {
     5798                if (   pPCHSGeometry->cCylinders != 0
     5799                    && pPCHSGeometry->cHeads != 0
     5800                    && pPCHSGeometry->cSectors != 0)
     5801                    rc = vmdkDescSetPCHSGeometry(pImage, pPCHSGeometry);
     5802                else if (uImageFlags & VD_VMDK_IMAGE_FLAGS_RAWDISK)
     5803                {
     5804                    VDGEOMETRY RawDiskPCHSGeometry;
     5805                    RawDiskPCHSGeometry.cCylinders = (uint32_t)RT_MIN(pImage->cbSize / 512 / 16 / 63, 16383);
     5806                    RawDiskPCHSGeometry.cHeads = 16;
     5807                    RawDiskPCHSGeometry.cSectors = 63;
     5808                    rc = vmdkDescSetPCHSGeometry(pImage, &RawDiskPCHSGeometry);
     5809                }
     5810            }
    57945811
    57955812            if (   RT_SUCCESS(rc)
     
    57985815                && pLCHSGeometry->cSectors != 0)
    57995816                rc = vmdkDescSetLCHSGeometry(pImage, pLCHSGeometry);
    5800 
    5801             pImage->LCHSGeometry = *pLCHSGeometry;
    5802             pImage->PCHSGeometry = *pPCHSGeometry;
    58035817
    58045818            pImage->ImageUuid = *pUuid;
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