VirtualBox

Changeset 67885 in vbox


Ignore:
Timestamp:
Jul 10, 2017 4:45:06 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116851
Message:

Main/Snapshot: detect if snapshot merging would lose data due to capacity differences, and error out if necessary

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

Legend:

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

    r67249 r67885  
    109109    bool i_isMediumFormatFile() const;
    110110    uint64_t i_getSize() const;
     111    uint64_t i_getLogicalSize() const;
    111112    DeviceType_T i_getDeviceType() const;
    112113    MediumType_T i_getType() const;
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r67745 r67885  
    38113811{
    38123812    return m->size;
     3813}
     3814
     3815/**
     3816 * Internal method to return the medium's size. Must have caller + locking!
     3817 * @return
     3818 */
     3819uint64_t Medium::i_getLogicalSize() const
     3820{
     3821    return m->logicalSize;
    38133822}
    38143823
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r67884 r67885  
    28052805            // base image. Important e.g. for medium formats which do not have
    28062806            // a file representation such as iSCSI.
     2807
     2808            // not going to merge a big source into a small target
     2809            if (pSource->i_getLogicalSize() > pTarget->i_getLogicalSize())
     2810            {
     2811                rc = setError(E_FAIL,
     2812                              tr("Unable to merge storage '%s', because it is smaller than the source image. If you resize it to have a capacity of at least %lld bytes you can retry"),
     2813                              pTarget->i_getLocationFull().c_str(), pSource->i_getLogicalSize());
     2814                throw rc;
     2815            }
    28072816
    28082817            // a couple paranoia checks for backward merges
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