VirtualBox

Changeset 31063 in vbox


Ignore:
Timestamp:
Jul 23, 2010 2:36:53 PM (15 years ago)
Author:
vboxsync
Message:

Main/Medium: Implement medium type Shareable, and along the way added a method to query the medium variant. Lots of terminology cleanup to make sure the error messages talk about "medium" instead of "hard disk", as the latter sometimes also showed up in errors about floppy/DVD images.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r31046 r31063  
    1103611036        if (pMedium != NULL)
    1103711037        {
    11038             bool fIsReadOnlyImage = (devType == DeviceType_DVD);
     11038            MediumType_T mediumType = pMedium->getType();
     11039            bool fIsReadOnlyImage =    devType == DeviceType_DVD
     11040                                    || mediumType == MediumType_Shareable;
    1103911041            bool fIsVitalImage = (devType == DeviceType_HardDisk);
     11042
    1104011043            mrc = pMedium->createMediumLockList(fIsVitalImage /* fFailIfInaccessible */,
    1104111044                                                !fIsReadOnlyImage /* fMediumLockWrite */,
  • trunk/src/VBox/Main/MediumImpl.cpp

    r30929 r31063  
    4747////////////////////////////////////////////////////////////////////////////////
    4848
    49 /** Describes how a machine refers to this image. */
     49/** Describes how a machine refers to this medium. */
    5050struct BackRef
    5151{
     
    8686        : pVirtualBox(NULL),
    8787          state(MediumState_NotCreated),
     88          variant(MediumVariant_Standard),
    8889          size(0),
    8990          readers(0),
     
    110111    Utf8Str strDescription;
    111112    MediumState_T state;
     113    MediumVariant_T variant;
    112114    Utf8Str strLocation;
    113115    Utf8Str strLocationFull;
     
    792794/**
    793795 * Initializes the medium object by opening the storage unit at the specified
    794  * location. The enOpenMode parameter defines whether the image will be opened
     796 * location. The enOpenMode parameter defines whether the medium will be opened
    795797 * read/write or read-only.
    796798 *
     
    802804 * @param aVirtualBox   VirtualBox object.
    803805 * @param aLocation     Storage unit location.
    804  * @param enOpenMode    Whether to open the image read/write or read-only.
     806 * @param enOpenMode    Whether to open the medium read/write or read-only.
    805807 * @param aDeviceType   Device type of medium.
    806  * @param aSetImageId   Whether to set the image UUID or not.
    807  * @param aImageId      New image UUID if @aSetId is true. Empty string means
     808 * @param aSetImageId   Whether to set the medium UUID or not.
     809 * @param aImageId      New medium UUID if @aSetId is true. Empty string means
    808810 *                      create a new UUID, and a zero UUID is invalid.
    809811 * @param aSetParentId  Whether to set the parent UUID or not.
     
    886888/**
    887889 * Initializes the medium object by loading its data from the given settings
    888  * node. In this mode, the image will always be opened read/write.
     890 * node. In this mode, the medium will always be opened read/write.
    889891 *
    890892 * @param aVirtualBox   VirtualBox object.
     
    917919    if (aParent)
    918920    {
    919         // differencing image: add to parent
     921        // differencing medium: add to parent
    920922        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    921923        m->pParent = aParent;
     
    954956    }
    955957
    956     /* optional, only for diffs, default is false;
    957      * we can only auto-reset diff images, so they
    958      * must not have a parent */
     958    /* optional, only for diffs, default is false; we can only auto-reset
     959     * diff media so they must have a parent */
    959960    if (aParent != NULL)
    960961        m->autoReset = data.fAutoReset;
     
    10961097 * Called either from FinalRelease() or by the parent when it gets destroyed.
    10971098 *
    1098  * @note All children of this hard disk get uninitialized by calling their
     1099 * @note All children of this medium get uninitialized by calling their
    10991100 *       uninit() methods.
    11001101 *
     
    11531154 * parent. Used in uninit() and other places when reparenting is necessary.
    11541155 *
    1155  * The caller must hold the hard disk tree lock!
     1156 * The caller must hold the medium tree lock!
    11561157 */
    11571158void Medium::deparent()
     
    11761177 * parent. Used in uninit() and other places when reparenting is necessary.
    11771178 *
    1178  * The caller must hold the hard disk tree lock!
     1179 * The caller must hold the medium tree lock!
    11791180 */
    11801181void Medium::setParent(const ComObjPtr<Medium> &pParent)
     
    12491250}
    12501251
     1252STDMETHODIMP Medium::COMGETTER(Variant)(MediumVariant_T *aVariant)
     1253{
     1254    CheckComArgOutPointerValid(aVariant);
     1255
     1256    AutoCaller autoCaller(this);
     1257    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     1258
     1259    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1260    *aVariant = m->variant;
     1261
     1262    return S_OK;
     1263}
     1264
    12511265
    12521266STDMETHODIMP Medium::COMGETTER(Location)(BSTR *aLocation)
     
    13981412    }
    13991413
    1400     /** @todo implement this case later */
    1401     CheckComArgExpr(aType, aType != MediumType_Shareable);
    1402 
    14031414    if (m->type == aType)
    14041415    {
     
    14071418    }
    14081419
    1409     /* cannot change the type of a differencing hard disk */
     1420    /* cannot change the type of a differencing medium */
    14101421    if (m->pParent)
    14111422        return setError(E_FAIL,
    1412                         tr("Cannot change the type of hard disk '%s' because it is a differencing hard disk"),
     1423                        tr("Cannot change the type of medium '%s' because it is a differencing medium"),
    14131424                        m->strLocationFull.raw());
    14141425
    1415     /* cannot change the type of a hard disk being in use by more than one VM */
     1426    /* cannot change the type of a medium being in use by more than one VM */
    14161427    if (m->backRefs.size() > 1)
    14171428        return setError(E_FAIL,
    1418                         tr("Cannot change the type of hard disk '%s' because it is attached to %d virtual machines"),
     1429                        tr("Cannot change the type of medium '%s' because it is attached to %d virtual machines"),
    14191430                        m->strLocationFull.raw(), m->backRefs.size());
    14201431
     
    14351446            if (getChildren().size() != 0)
    14361447                return setError(E_FAIL,
    1437                                 tr("Cannot change type for hard disk '%s' since it has %d child hard disk(s)"),
     1448                                tr("Cannot change type for medium '%s' since it has %d child media"),
    14381449                                m->strLocationFull.raw(), getChildren().size());
     1450            if (aType == MediumType_Shareable)
     1451            {
     1452                MediumVariant_T variant = getVariant();
     1453                if (!(variant & MediumVariant_Fixed))
     1454                    return setError(E_FAIL,
     1455                                    tr("Cannot change type for medium '%s' to 'Shareable' since it is a dynamic medium storage unit"),
     1456                                    m->strLocationFull.raw());
     1457
     1458            }
    14391459            break;
    14401460        }
     
    15311551
    15321552    /* We assume that some backend may decide to return a meaningless value in
    1533      * response to VDGetSize() for differencing hard disks and therefore
    1534      * always ask the base hard disk ourselves. */
     1553     * response to VDGetSize() for differencing media and therefore always
     1554     * ask the base medium ourselves. */
    15351555
    15361556    /* base() will do callers/locking */
     
    15651585    if (m->pParent.isNull())
    15661586        return setError(VBOX_E_NOT_SUPPORTED,
    1567                         tr("Hard disk '%s' is not differencing"),
     1587                        tr("Medium '%s' is not differencing"),
    15681588                        m->strLocationFull.raw());
    15691589
     
    20782098            &&  !(m->formatObj->capabilities() & MediumFormatCapabilities_CreateDynamic))
    20792099            throw setError(VBOX_E_NOT_SUPPORTED,
    2080                            tr("Hard disk format '%s' does not support dynamic storage creation"),
     2100                           tr("Medium format '%s' does not support dynamic storage creation"),
    20812101                           m->strFormat.raw());
    20822102        if (    (aVariant & MediumVariant_Fixed)
    20832103            &&  !(m->formatObj->capabilities() & MediumFormatCapabilities_CreateDynamic))
    20842104            throw setError(VBOX_E_NOT_SUPPORTED,
    2085                            tr("Hard disk format '%s' does not support fixed storage creation"),
     2105                           tr("Medium format '%s' does not support fixed storage creation"),
    20862106                           m->strFormat.raw());
    20872107
     
    20932113                             static_cast<IMedium*>(this),
    20942114                             (aVariant & MediumVariant_Fixed)
    2095                                ? BstrFmt(tr("Creating fixed hard disk storage unit '%s'"), m->strLocationFull.raw())
    2096                                : BstrFmt(tr("Creating dynamic hard disk storage unit '%s'"), m->strLocationFull.raw()),
     2115                               ? BstrFmt(tr("Creating fixed medium storage unit '%s'"), m->strLocationFull.raw())
     2116                               : BstrFmt(tr("Creating dynamic medium storage unit '%s'"), m->strLocationFull.raw()),
    20972117                             TRUE /* aCancelable */);
    20982118        if (FAILED(rc))
     
    21652185    if (m->type == MediumType_Writethrough)
    21662186        return setError(E_FAIL,
    2167                         tr("Hard disk '%s' is Writethrough"),
     2187                        tr("Medium type of '%s' is Writethrough"),
     2188                        m->strLocationFull.raw());
     2189    else if (m->type == MediumType_Shareable)
     2190        return setError(E_FAIL,
     2191                        tr("Medium type of '%s' is Shareable"),
    21682192                        m->strLocationFull.raw());
    21692193
     
    22522276        // locking: we need the tree lock first because we access parent pointers
    22532277        AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    2254         // and we need to write-lock the images involved
     2278        // and we need to write-lock the media involved
    22552279        AutoMultiWriteLock3 alock(this, pTarget, pParent COMMA_LOCKVAL_SRC_POS);
    22562280
     
    23062330        rc = pProgress->init(m->pVirtualBox,
    23072331                             static_cast <IMedium *>(this),
    2308                              BstrFmt(tr("Creating clone hard disk '%s'"), pTarget->m->strLocationFull.raw()),
     2332                             BstrFmt(tr("Creating clone medium '%s'"), pTarget->m->strLocationFull.raw()),
    23092333                             TRUE /* aCancelable */);
    23102334        if (FAILED(rc))
     
    23852409        rc = pProgress->init(m->pVirtualBox,
    23862410                             static_cast <IMedium *>(this),
    2387                              BstrFmt(tr("Compacting hard disk '%s'"), m->strLocationFull.raw()),
     2411                             BstrFmt(tr("Compacting medium '%s'"), m->strLocationFull.raw()),
    23882412                             TRUE /* aCancelable */);
    23892413        if (FAILED(rc))
     
    24492473        if (m->pParent.isNull())
    24502474            throw setError(VBOX_E_NOT_SUPPORTED,
    2451                            tr("Hard disk '%s' is not differencing"),
     2475                           tr("Medium type of '%s' is not differencing"),
    24522476                           m->strLocationFull.raw());
    24532477
     
    24802504        rc = pProgress->init(m->pVirtualBox,
    24812505                             static_cast<IMedium*>(this),
    2482                              BstrFmt(tr("Resetting differencing hard disk '%s'"), m->strLocationFull.raw()),
     2506                             BstrFmt(tr("Resetting differencing medium '%s'"), m->strLocationFull.raw()),
    24832507                             FALSE /* aCancelable */);
    24842508        if (FAILED(rc))
     
    25522576
    25532577/**
    2554  * Internal method to return the medium's GUID. Must have caller + locking!
     2578 * Internal method to return the medium's state. Must have caller + locking!
    25552579 * @return
    25562580 */
     
    25582582{
    25592583    return m->state;
     2584}
     2585
     2586/**
     2587 * Internal method to return the medium's variant. Must have caller + locking!
     2588 * @return
     2589 */
     2590MediumState_T Medium::getVariant() const
     2591{
     2592    return m->variant;
    25602593}
    25612594
     
    26072640/**
    26082641 * Adds the given machine and optionally the snapshot to the list of the objects
    2609  * this image is attached to.
     2642 * this medium is attached to.
    26102643 *
    26112644 * @param aMachineId    Machine ID.
     
    26382671    if (m->numCreateDiffTasks > 0)
    26392672        return setError(E_FAIL,
    2640                         tr("Cannot attach hard disk '%s' {%RTuuid}: %u differencing child hard disk(s) are being created"),
     2673                        tr("Cannot attach medium '%s' {%RTuuid}: %u differencing child media are being created"),
    26412674                        m->strLocationFull.raw(),
    26422675                        m->id.raw(),
     
    26992732/**
    27002733 * Removes the given machine and optionally the snapshot from the list of the
    2701  * objects this image is attached to.
     2734 * objects this medium is attached to.
    27022735 *
    27032736 * @param aMachineId    Machine ID.
     
    28382871/**
    28392872 * Checks if the given change of \a aOldPath to \a aNewPath affects the location
    2840  * of this hard disk or any its child and updates the paths if necessary to
     2873 * of this medium or any its child and updates the paths if necessary to
    28412874 * reflect the new location.
    28422875 *
     
    28712904
    28722905/**
    2873  * Returns the base hard disk of the hard disk chain this hard disk is part of.
    2874  *
    2875  * The base hard disk is found by walking up the parent-child relationship axis.
    2876  * If the hard disk doesn't have a parent (i.e. it's a base hard disk), it
     2906 * Returns the base medium of the media chain this medium is part of.
     2907 *
     2908 * The base medium is found by walking up the parent-child relationship axis.
     2909 * If the medium doesn't have a parent (i.e. it's a base medium), it
    28772910 * returns itself in response to this method.
    28782911 *
    2879  * @param aLevel    Where to store the number of ancestors of this hard disk
     2912 * @param aLevel    Where to store the number of ancestors of this medium
    28802913 *                  (zero for the base), may be @c NULL.
    28812914 *
     
    29182951
    29192952/**
    2920  * Returns @c true if this hard disk cannot be modified because it has
    2921  * dependants (children) or is part of the snapshot. Related to the hard disk
     2953 * Returns @c true if this medium cannot be modified because it has
     2954 * dependants (children) or is part of the snapshot. Related to the medium
    29222955 * type and posterity, not to the current media state.
    29232956 *
     
    29612994
    29622995/**
    2963  * Saves hard disk data by appending a new <HardDisk> child node to the given
    2964  * parent node which can be either <HardDisks> or <HardDisk>.
     2996 * Saves medium data by appending a new child node to the given
     2997 * parent XML settings node.
    29652998 *
    29662999 * @param data      Settings struct to be updated.
     
    30063039    }
    30073040
    3008     /* only for base hard disks */
     3041    /* only for base media */
    30093042    if (m->pParent.isNull())
    30103043        data.hdType = m->type;
     
    30253058
    30263059/**
    3027  * Compares the location of this hard disk to the given location.
     3060 * Compares the location of this medium to the given location.
    30283061 *
    30293062 * The comparison takes the location details into account. For example, if the
     
    30643097        if (RT_FAILURE(vrc))
    30653098            return setError(E_FAIL,
    3066                             tr("Invalid hard disk storage file location '%s' (%Rrc)"),
     3099                            tr("Invalid medium storage file location '%s' (%Rrc)"),
    30673100                            location.raw(),
    30683101                            vrc);
     
    30833116 * @param fFailIfInaccessible If true, this fails with an error if a medium is inaccessible. If false,
    30843117 *          inaccessible media are silently skipped and not locked (i.e. their state remains "Inaccessible");
    3085  *          this is necessary for a VM's removable images on VM startup for which we do not want to fail.
     3118 *          this is necessary for a VM's removable media VM startup for which we do not want to fail.
    30863119 * @param fMediumLockWrite  Whether to associate a write lock with this medium.
    30873120 * @param pToBeParent       Medium which will become the parent of this medium.
     
    31203153        /* Accessibility check must be first, otherwise locking interferes
    31213154         * with getting the medium state. Lock lists are not created for
    3122          * fun, and thus getting the image status is no luxury. */
     3155         * fun, and thus getting the medium status is no luxury. */
    31233156        MediumState_T mediumState = pMedium->getState();
    31243157        if (mediumState == MediumState_Inaccessible)
     
    31293162            if (mediumState == MediumState_Inaccessible)
    31303163            {
    3131                 // ignore inaccessible ISO images and silently return S_OK,
     3164                // ignore inaccessible ISO media and silently return S_OK,
    31323165                // otherwise VM startup (esp. restore) may fail without good reason
    31333166                if (!fFailIfInaccessible)
     
    31683201
    31693202/**
    3170  * Returns a preferred format for differencing hard disks.
     3203 * Returns a preferred format for differencing media.
    31713204 */
    31723205Bstr Medium::preferredDiffFormat()
     
    32173250 * Sets the value of m->strLocation and calculates the value of m->strLocationFull.
    32183251 *
    3219  * Treats non-FS-path locations specially, and prepends the default hard disk
     3252 * Treats non-FS-path locations specially, and prepends the default medium
    32203253 * folder if the given location string does not contain any path information
    32213254 * at all.
     
    33913424
    33923425/**
    3393  * Queries information from the image file.
     3426 * Queries information from the medium.
    33943427 *
    33953428 * As a result of this call, the accessibility state and data members such as
     
    34923525        try
    34933526        {
    3494             /** @todo This kind of opening of images is assuming that diff
    3495              * images can be opened as base images. Should be documented if
     3527            /** @todo This kind of opening of media is assuming that diff
     3528             * media can be opened as base media. Should be documented if
    34963529             * it must work for all medium format backends. */
    34973530            vrc = VDOpen(hdd,
     
    35753608            vrc = VDGetImageFlags(hdd, 0, &uImageFlags);
    35763609            ComAssertRCThrow(vrc, E_FAIL);
     3610            m->variant = (MediumVariant_T)uImageFlags;
    35773611
    35783612            if (uImageFlags & VD_IMAGE_FLAGS_DIFF)
     
    35853619                {
    35863620                    /* the parent must be known to us. Note that we freely
    3587                      * call locking methods of mVirtualBox and parent from the
    3588                      * write lock (breaking the {parent,child} lock order)
    3589                      * because there may be no concurrent access to the just
    3590                      * opened hard disk on ther threads yet (and init() will
    3591                      * fail if this method reporst MediumState_Inaccessible) */
     3621                     * call locking methods of mVirtualBox and parent, as all
     3622                     * relevant locks must be already held. There may be no
     3623                     * concurrent access to the just opened medium on other
     3624                     * threads yet (and init() will fail if this method reports
     3625                     * MediumState_Inaccessible) */
    35923626
    35933627                    Guid id = parentId;
     
    35993633                    {
    36003634                        lastAccessError = Utf8StrFmt(
    3601                             tr("Parent hard disk with UUID {%RTuuid} of the hard disk '%s' is not found in the media registry ('%s')"),
     3635                            tr("Parent medium with UUID {%RTuuid} of the medium '%s' is not found in the media registry ('%s')"),
    36023636                            &parentId, location.c_str(),
    36033637                            m->pVirtualBox->settingsFilePath().c_str());
     
    36243658                    {
    36253659                        lastAccessError = Utf8StrFmt(
    3626                             tr("Hard disk '%s' is differencing but it is not associated with any parent hard disk in the media registry ('%s')"),
     3660                            tr("Medium type of '%s' is differencing but it is not associated with any parent medium in the media registry ('%s')"),
    36273661                            location.c_str(),
    36283662                            m->pVirtualBox->settingsFilePath().c_str());
     
    36353669                    {
    36363670                        lastAccessError = Utf8StrFmt(
    3637                             tr("Parent UUID {%RTuuid} of the hard disk '%s' does not match UUID {%RTuuid} of its parent hard disk stored in the media registry ('%s')"),
     3671                            tr("Parent UUID {%RTuuid} of the medium '%s' does not match UUID {%RTuuid} of its parent medium stored in the media registry ('%s')"),
    36383672                            &parentId, location.c_str(),
    36393673                            m->pParent->getId().raw(),
     
    38463880
    38473881/**
    3848  * Deletes the hard disk storage unit.
     3882 * Deletes the medium storage unit.
    38493883 *
    38503884 * If @a aProgress is not NULL but the object it points to is @c null then a new
     
    38953929                                                   | MediumFormatCapabilities_CreateFixed)))
    38963930            throw setError(VBOX_E_NOT_SUPPORTED,
    3897                            tr("Hard disk format '%s' does not support storage deletion"),
     3931                           tr("Medium format '%s' does not support storage deletion"),
    38983932                           m->strFormat.raw());
    38993933
     
    39023936         * it is really inaccessible, the delete operation will fail anyway.
    39033937         * Accepting Inaccessible state is especially important because all
    3904          * registered hard disks are initially Inaccessible upon VBoxSVC
    3905          * startup until COMGETTER(RefreshState) is called. Accept Deleting
    3906          * state because some callers need to put the image in this state early
     3938         * registered media are initially Inaccessible upon VBoxSVC startup
     3939         * until COMGETTER(RefreshState) is called. Accept Deleting state
     3940         * because some callers need to put the medium in this state early
    39073941         * to prevent races. */
    39083942        switch (m->state)
     
    39323966#endif
    39333967            throw setError(VBOX_E_OBJECT_IN_USE,
    3934                            tr("Cannot delete storage: hard disk '%s' is still attached to the following %d virtual machine(s): %s"),
     3968                           tr("Cannot delete storage: medium '%s' is still attached to the following %d virtual machine(s): %s"),
    39353969                           m->strLocationFull.c_str(),
    39363970                           m->backRefs.size(),
     
    39714005        }
    39724006
    3973         /* try to remove from the list of known hard disks before performing
     4007        /* try to remove from the list of known media before performing
    39744008         * actual deletion (we favor the consistency of the media registry
    39754009         * which would have been broken if unregisterWithVirtualBox() failed
     
    39924026                rc = pProgress->init(m->pVirtualBox,
    39934027                                     static_cast<IMedium*>(this),
    3994                                      BstrFmt(tr("Deleting hard disk storage unit '%s'"), m->strLocationFull.raw()),
     4028                                     BstrFmt(tr("Deleting medium storage unit '%s'"), m->strLocationFull.raw()),
    39954029                                     FALSE /* aCancelable */);
    39964030                if (FAILED(rc))
     
    41094143
    41104144/**
    4111  * Creates a new differencing storage unit using the given target hard disk's
    4112  * format and the location. Note that @c aTarget must be NotCreated.
     4145 * Creates a new differencing storage unit using the format of the given target
     4146 * medium and the location. Note that @c aTarget must be NotCreated.
    41134147 *
    41144148 * The @a aMediumLockList parameter contains the associated medium lock list,
     
    41274161 * NULL when @a aWait is @c false (this method will assert in this case).
    41284162 *
    4129  * @param aTarget           Target hard disk.
    4130  * @param aVariant          Precise image variant to create.
     4163 * @param aTarget           Target medium.
     4164 * @param aVariant          Precise medium variant to create.
    41314165 * @param aMediumLockList   List of media which should be locked.
    41324166 * @param aProgress         Where to find/store a Progress object to track
     
    41704204        AutoMultiWriteLock2 alock(this, aTarget COMMA_LOCKVAL_SRC_POS);
    41714205
    4172         ComAssertThrow(m->type != MediumType_Writethrough, E_FAIL);
     4206        ComAssertThrow(   m->type != MediumType_Writethrough
     4207                       && m->type != MediumType_Shareable, E_FAIL);
    41734208        ComAssertThrow(m->state == MediumState_LockedRead, E_FAIL);
    41744209
     
    41764211            throw aTarget->setStateError();
    41774212
    4178         /* Check that the hard disk is not attached to the current state of
     4213        /* Check that the medium is not attached to the current state of
    41794214         * any VM referring to it. */
    41804215        for (BackRefList::const_iterator it = m->backRefs.begin();
     
    41844219            if (it->fInCurState)
    41854220            {
    4186                 /* Note: when a VM snapshot is being taken, all normal hard
    4187                  * disks attached to the VM in the current state will be, as an
     4221                /* Note: when a VM snapshot is being taken, all normal media
     4222                 * attached to the VM in the current state will be, as an
    41884223                 * exception, also associated with the snapshot which is about
    41894224                 * to create (see SnapshotMachine::init()) before deassociating
     
    41944229                if (it->llSnapshotIds.size() == 0)
    41954230                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
    4196                                    tr("Hard disk '%s' is attached to a virtual machine with UUID {%RTuuid}. No differencing hard disks based on it may be created until it is detached"),
     4231                                   tr("Medium '%s' is attached to a virtual machine with UUID {%RTuuid}. No differencing media based on it may be created until it is detached"),
    41974232                                   m->strLocationFull.raw(), it->machineId.raw());
    41984233
     
    42124247                rc = pProgress->init(m->pVirtualBox,
    42134248                                     static_cast<IMedium*>(this),
    4214                                      BstrFmt(tr("Creating differencing hard disk storage unit '%s'"), aTarget->m->strLocationFull.raw()),
     4249                                     BstrFmt(tr("Creating differencing medium storage unit '%s'"), aTarget->m->strLocationFull.raw()),
    42154250                                     TRUE /* aCancelable */);
    42164251                if (FAILED(rc))
     
    42534288
    42544289/**
    4255  * Prepares this (source) hard disk, target hard disk and all intermediate hard
    4256  * disks for the merge operation.
     4290 * Prepares this (source) medium, target medium and all intermediate media
     4291 * for the merge operation.
    42574292 *
    42584293 * This method is to be called prior to calling the #mergeTo() to perform
    4259  * necessary consistency checks and place involved hard disks to appropriate
     4294 * necessary consistency checks and place involved media to appropriate
    42604295 * states. If #mergeTo() is not called or fails, the state modifications
    42614296 * performed by this method must be undone by #cancelMergeTo().
     
    42634298 * See #mergeTo() for more information about merging.
    42644299 *
    4265  * @param pTarget       Target hard disk.
     4300 * @param pTarget       Target medium.
    42664301 * @param aMachineId    Allowed machine attachment. NULL means do not check.
    42674302 * @param aSnapshotId   Allowed snapshot attachment. NULL or empty UUID means
     
    42774312 *
    42784313 * @note Locks medium tree for reading. Locks this object, aTarget and all
    4279  *       intermediate hard disks for writing.
     4314 *       intermediate media for writing.
    42804315 */
    42814316HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
     
    43324367                AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    43334368                throw setError(E_FAIL,
    4334                                tr("Hard disks '%s' and '%s' are unrelated"),
     4369                               tr("Media '%s' and '%s' are unrelated"),
    43354370                               m->strLocationFull.raw(), tgtLoc.raw());
    43364371            }
     
    43824417            }
    43834418            /* One backreference is only allowed if the machine ID is not empty
    4384              * and it matches the machine the image is attached to (including
     4419             * and it matches the machine the medium is attached to (including
    43854420             * the snapshot ID if not empty). */
    43864421            if (   m->backRefs.size() != 0
     
    45464581
    45474582/**
    4548  * Merges this hard disk to the specified hard disk which must be either its
     4583 * Merges this medium to the specified medium which must be either its
    45494584 * direct ancestor or descendant.
    45504585 *
    4551  * Given this hard disk is SOURCE and the specified hard disk is TARGET, we will
     4586 * Given this medium is SOURCE and the specified medium is TARGET, we will
    45524587 * get two varians of the merge operation:
    45534588 *
     
    45634598 *             LockWr    Del             Del       LockWr
    45644599 *
    4565  * Each diagram shows the involved hard disks on the hard disk chain where
    4566  * SOURCE and TARGET belong. Under each hard disk there is a state value which
    4567  * the hard disk must have at a time of the mergeTo() call.
    4568  *
    4569  * The hard disks in the square braces may be absent (e.g. when the forward
    4570  * operation takes place and SOURCE is the base hard disk, or when the backward
     4600 * Each diagram shows the involved media on the media chain where
     4601 * SOURCE and TARGET belong. Under each medium there is a state value which
     4602 * the medium must have at a time of the mergeTo() call.
     4603 *
     4604 * The media in the square braces may be absent (e.g. when the forward
     4605 * operation takes place and SOURCE is the base medium, or when the backward
    45714606 * merge operation takes place and TARGET is the last child in the chain) but if
    45724607 * they present they are involved too as shown.
    45734608 *
    4574  * Nor the source hard disk neither intermediate hard disks may be attached to
     4609 * Neither the source medium nor intermediate media may be attached to
    45754610 * any VM directly or in the snapshot, otherwise this method will assert.
    45764611 *
     
    45804615 * If @a aWait is @c true then this method will perform the operation on the
    45814616 * calling thread and will not return to the caller until the operation is
    4582  * completed. When this method succeeds, all intermediate hard disk objects in
    4583  * the chain will be uninitialized, the state of the target hard disk (and all
    4584  * involved extra hard disks) will be restored. @a aMediumLockList will not be
     4617 * completed. When this method succeeds, all intermediate medium objects in
     4618 * the chain will be uninitialized, the state of the target medium (and all
     4619 * involved extra media) will be restored. @a aMediumLockList will not be
    45854620 * deleted, whether the operation is successful or not. The caller has to do
    4586  * this if appropriate. Note that this (source) hard disk is not uninitialized
     4621 * this if appropriate. Note that this (source) medium is not uninitialized
    45874622 * because of possible AutoCaller instances held by the caller of this method
    45884623 * on the current thread. It's therefore the responsibility of the caller to
     
    45914626 * If @a aWait is @c false then this method will create a thread to perform the
    45924627 * operation asynchronously and will return immediately. If the operation
    4593  * succeeds, the thread will uninitialize the source hard disk object and all
    4594  * intermediate hard disk objects in the chain, reset the state of the target
    4595  * hard disk (and all involved extra hard disks) and delete @a aMediumLockList.
     4628 * succeeds, the thread will uninitialize the source medium object and all
     4629 * intermediate medium objects in the chain, reset the state of the target
     4630 * medium (and all involved extra media) and delete @a aMediumLockList.
    45964631 * If the operation fails, the thread will only reset the states of all
    4597  * involved hard disks and delete @a aMediumLockList.
     4632 * involved media and delete @a aMediumLockList.
    45984633 *
    45994634 * When this method fails (regardless of the @a aWait mode), it is a caller's
     
    46074642 * NULL when @a aWait is @c false (this method will assert in this case).
    46084643 *
    4609  * @param pTarget       Target hard disk.
     4644 * @param pTarget       Target medium.
    46104645 * @param fMergeForward Merge direction.
    46114646 * @param pParentForTarget New parent for target medium after merge.
     
    46224657 *                and this parameter is ignored.
    46234658 *
    4624  * @note Locks the tree lock for writing. Locks the hard disks from the chain
     4659 * @note Locks the tree lock for writing. Locks the media from the chain
    46254660 *       for writing.
    46264661 */
     
    46704705                rc = pProgress->init(m->pVirtualBox,
    46714706                                     static_cast<IMedium*>(this),
    4672                                      BstrFmt(tr("Merging hard disk '%s' to '%s'"),
     4707                                     BstrFmt(tr("Merging medium '%s' to '%s'"),
    46734708                                             getName().raw(),
    46744709                                             tgtName.raw()),
     
    47164751 * @param aMediumLockList Medium locking information.
    47174752 *
    4718  * @note Locks the hard disks from the chain for writing.
     4753 * @note Locks the media from the chain for writing.
    47194754 */
    47204755void Medium::cancelMergeTo(const MediaList &aChildrenToReparent,
     
    47814816        if (m->formatObj.isNull())
    47824817            return setError(E_INVALIDARG,
    4783                             tr("Invalid hard disk storage format '%ls'"),
     4818                            tr("Invalid medium storage format '%ls'"),
    47844819                            aFormat);
    47854820
     
    48244859    if (getChildren().size() != 0)
    48254860        return setError(E_FAIL,
    4826                         tr("Cannot close medium '%s' because it has %d child hard disk(s)"),
     4861                        tr("Cannot close medium '%s' because it has %d child media"),
    48274862                        m->strLocationFull.raw(), getChildren().size());
    48284863
     
    50805115                AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS);
    50815116
    5082                 // open the image
     5117                // open the medium
    50835118                vrc = VDOpen(hdd,
    50845119                             pMedium->m->strFormat.c_str(),
     
    51785213    /* these parameters we need after creation */
    51795214    uint64_t size = 0, logicalSize = 0;
     5215    MediumVariant_T variant = MediumVariant_Standard;
    51805216    bool fGenerateUuid = false;
    51815217
     
    52325268            if (RT_FAILURE(vrc))
    52335269                throw setError(E_FAIL,
    5234                             tr("Could not create the hard disk storage unit '%s'%s"),
     5270                            tr("Could not create the medium storage unit '%s'%s"),
    52355271                            location.raw(), vdError(vrc).raw());
    52365272
    52375273            size = VDGetFileSize(hdd, 0);
    52385274            logicalSize = VDGetSize(hdd, 0) / _1M;
     5275            unsigned uImageFlags;
     5276            vrc = VDGetImageFlags(hdd, 0, &uImageFlags);
     5277            if (RT_SUCCESS(vrc))
     5278                variant = (MediumVariant_T)uImageFlags;
    52395279        }
    52405280        catch (HRESULT aRC) { rc = aRC; }
     
    52705310        m->size = size;
    52715311        m->logicalSize = logicalSize;
     5312        m->variant = variant;
    52725313    }
    52735314    else
     
    53055346
    53065347    uint64_t size = 0, logicalSize = 0;
     5348    MediumVariant_T variant = MediumVariant_Standard;
    53075349    bool fGenerateUuid = false;
    53085350
     
    53435385        try
    53445386        {
    5345             /* Open all hard disk images in the target chain but the last. */
     5387            /* Open all media in the target chain but the last. */
    53465388            MediumLockList::Base::const_iterator targetListBegin =
    53475389                task.mpMediumLockList->GetBegin();
     
    53575399                AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS);
    53585400
    5359                 /* Skip over the target diff image */
     5401                /* Skip over the target diff medium */
    53605402                if (pMedium->m->state == MediumState_Creating)
    53615403                    continue;
     
    53645406                Assert(pMedium->m->state == MediumState_LockedRead);
    53655407
    5366                 /* Open all images in appropriate mode. */
     5408                /* Open all media in appropriate mode. */
    53675409                vrc = VDOpen(hdd,
    53685410                             pMedium->m->strFormat.c_str(),
     
    53725414                if (RT_FAILURE(vrc))
    53735415                    throw setError(E_FAIL,
    5374                                    tr("Could not open the hard disk storage unit '%s'%s"),
     5416                                   tr("Could not open the medium storage unit '%s'%s"),
    53755417                                   pMedium->m->strLocationFull.raw(),
    53765418                                   vdError(vrc).raw());
     
    53945436            if (RT_FAILURE(vrc))
    53955437                throw setError(E_FAIL,
    5396                                 tr("Could not create the differencing hard disk storage unit '%s'%s"),
     5438                                tr("Could not create the differencing medium storage unit '%s'%s"),
    53975439                                targetLocation.raw(), vdError(vrc).raw());
    53985440
    53995441            size = VDGetFileSize(hdd, VD_LAST_IMAGE);
    54005442            logicalSize = VDGetSize(hdd, VD_LAST_IMAGE) / _1M;
     5443            unsigned uImageFlags;
     5444            vrc = VDGetImageFlags(hdd, 0, &uImageFlags);
     5445            if (RT_SUCCESS(vrc))
     5446                variant = (MediumVariant_T)uImageFlags;
    54015447        }
    54025448        catch (HRESULT aRC) { rc = aRC; }
     
    54185464        /** @todo r=klaus neither target nor base() are locked,
    54195465            * potential race! */
    5420         /* diffs for immutable hard disks are auto-reset by default */
     5466        /* diffs for immutable media are auto-reset by default */
    54215467        pTarget->m->autoReset = (getBase()->m->type == MediumType_Immutable);
    54225468
     
    54395485        pTarget->m->size = size;
    54405486        pTarget->m->logicalSize = logicalSize;
     5487        pTarget->m->variant = variant;
    54415488    }
    54425489    else
     
    54725519
    54735520    /* Note that in sync mode, it's the caller's responsibility to
    5474      * unlock the hard disk */
     5521     * unlock the medium. */
    54755522
    54765523    return rc;
     
    55095556            unsigned uTargetIdx = VD_LAST_IMAGE;
    55105557            unsigned uSourceIdx = VD_LAST_IMAGE;
    5511             /* Open all hard disks in the chain. */
     5558            /* Open all media in the chain. */
    55125559            MediumLockList::Base::iterator lockListBegin =
    55135560                task.mpMediumLockList->GetBegin();
     
    55325579                 * complex sanity (sane complexity)
    55335580                 *
    5534                  * The current image must be in the Deleting (image is merged)
    5535                  * or LockedRead (parent image) state if it is not the target.
     5581                 * The current medium must be in the Deleting (medium is merged)
     5582                 * or LockedRead (parent medium) state if it is not the target.
    55365583                 * If it is the target it must be in the LockedWrite state.
    55375584                 */
     
    55435590
    55445591                /*
    5545                  * Image must be the target, in the LockedRead state
     5592                 * Medium must be the target, in the LockedRead state
    55465593                 * or Deleting state where it is not allowed to be attached
    55475594                 * to a virtual machine.
     
    55615608                    uOpenFlags = VD_OPEN_FLAGS_READONLY;
    55625609
    5563                 /* Open the image */
     5610                /* Open the medium */
    55645611                vrc = VDOpen(hdd,
    55655612                             pMedium->m->strFormat.c_str(),
     
    56205667        {
    56215668            throw setError(E_FAIL,
    5622                             tr("Could not merge the hard disk '%s' to '%s'%s"),
     5669                            tr("Could not merge the medium '%s' to '%s'%s"),
    56235670                            m->strLocationFull.raw(),
    56245671                            pTarget->m->strLocationFull.raw(),
     
    56345681    if (SUCCEEDED(rc))
    56355682    {
    5636         /* all hard disks but the target were successfully deleted by
     5683        /* all media but the target were successfully deleted by
    56375684         * VDMerge; reparent the last one and uninitialize deleted media. */
    56385685
     
    56425689        {
    56435690            /* first, unregister the target since it may become a base
    5644              * hard disk which needs re-registration */
     5691             * medium which needs re-registration */
    56455692            rc2 = m->pVirtualBox->unregisterHardDisk(pTarget, NULL /*&fNeedsSaveSettings*/);
    56465693            AssertComRC(rc2);
     
    56885735        }
    56895736
    5690         /* unregister and uninitialize all hard disks removed by the merge */
     5737        /* unregister and uninitialize all media removed by the merge */
    56915738        MediumLockList::Base::iterator lockListBegin =
    56925739            task.mpMediumLockList->GetBegin();
     
    57025749            const ComObjPtr<Medium> pMedium = mediumLock.GetMedium();
    57035750
    5704             /* The target and all images not merged (readonly) are skipped */
     5751            /* The target and all media not merged (readonly) are skipped */
    57055752            if (   pMedium == pTarget
    57065753                || pMedium->m->state == MediumState_LockedRead)
     
    57145761            AssertComRC(rc2);
    57155762
    5716             /* now, uninitialize the deleted hard disk (note that
     5763            /* now, uninitialize the deleted medium (note that
    57175764             * due to the Deleting state, uninit() will not touch
    57185765             * the parent-child relationship so we need to
    57195766             * uninitialize each disk individually) */
    57205767
    5721             /* note that the operation initiator hard disk (which is
    5722              * normally also the source hard disk) is a special case
     5768            /* note that the operation initiator medium (which is
     5769             * normally also the source medium) is a special case
    57235770             * -- there is one more caller added by Task to it which
    57245771             * we must release. Also, if we are in sync mode, the
     
    57605807        /* Here we come if either VDMerge() failed (in which case we
    57615808         * assume that it tried to do everything to make a further
    5762          * retry possible -- e.g. not deleted intermediate hard disks
     5809         * retry possible -- e.g. not deleted intermediate media
    57635810         * and so on) or VirtualBox::saveSettings() failed (where we
    57645811         * should have the original tree but with intermediate storage
     
    57975844
    57985845    uint64_t size = 0, logicalSize = 0;
     5846    MediumVariant_T variant = MediumVariant_Standard;
    57995847    bool fGenerateUuid = false;
    58005848
     
    58255873        try
    58265874        {
    5827             /* Open all hard disk images in the source chain. */
     5875            /* Open all media in the source chain. */
    58285876            MediumLockList::Base::const_iterator sourceListBegin =
    58295877                task.mpSourceMediumLockList->GetBegin();
     
    58415889                Assert(pMedium->m->state == MediumState_LockedRead);
    58425890
    5843                 /** Open all images in read-only mode. */
     5891                /** Open all media in read-only mode. */
    58445892                vrc = VDOpen(hdd,
    58455893                             pMedium->m->strFormat.c_str(),
     
    58495897                if (RT_FAILURE(vrc))
    58505898                    throw setError(E_FAIL,
    5851                                     tr("Could not open the hard disk storage unit '%s'%s"),
     5899                                    tr("Could not open the medium storage unit '%s'%s"),
    58525900                                    pMedium->m->strLocationFull.raw(),
    58535901                                    vdError(vrc).raw());
     
    58765924            try
    58775925            {
    5878                 /* Open all hard disk images in the target chain. */
     5926                /* Open all media in the target chain. */
    58795927                MediumLockList::Base::const_iterator targetListBegin =
    58805928                    task.mpTargetMediumLockList->GetBegin();
     
    58995947                            || pMedium->m->state == MediumState_LockedWrite);
    59005948
    5901                     /* Open all images in appropriate mode. */
     5949                    /* Open all media in appropriate mode. */
    59025950                    vrc = VDOpen(targetHdd,
    59035951                                 pMedium->m->strFormat.c_str(),
     
    59075955                    if (RT_FAILURE(vrc))
    59085956                        throw setError(E_FAIL,
    5909                                        tr("Could not open the hard disk storage unit '%s'%s"),
     5957                                       tr("Could not open the medium storage unit '%s'%s"),
    59105958                                       pMedium->m->strLocationFull.raw(),
    59115959                                       vdError(vrc).raw());
     
    59275975                if (RT_FAILURE(vrc))
    59285976                    throw setError(E_FAIL,
    5929                                     tr("Could not create the clone hard disk '%s'%s"),
     5977                                    tr("Could not create the clone medium '%s'%s"),
    59305978                                    targetLocation.raw(), vdError(vrc).raw());
    59315979
    59325980                size = VDGetFileSize(targetHdd, VD_LAST_IMAGE);
    59335981                logicalSize = VDGetSize(targetHdd, VD_LAST_IMAGE) / _1M;
     5982                unsigned uImageFlags;
     5983                vrc = VDGetImageFlags(targetHdd, 0, &uImageFlags);
     5984                if (RT_SUCCESS(vrc))
     5985                    variant = (MediumVariant_T)uImageFlags;
    59345986            }
    59355987            catch (HRESULT aRC) { rc = aRC; }
     
    59435995    catch (HRESULT aRC) { rc = aRC; }
    59445996
    5945     /* Only do the parent changes for newly created images. */
     5997    /* Only do the parent changes for newly created media. */
    59465998    if (SUCCEEDED(rc) && fCreatingTarget)
    59475999    {
     
    59846036            pTarget->m->size = size;
    59856037            pTarget->m->logicalSize = logicalSize;
     6038            pTarget->m->variant = variant;
    59866039        }
    59876040        else
     
    60576110            if (RT_FAILURE(vrc))
    60586111                throw setError(E_FAIL,
    6059                                 tr("Could not delete the hard disk storage unit '%s'%s"),
     6112                                tr("Could not delete the medium storage unit '%s'%s"),
    60606113                                location.raw(), vdError(vrc).raw());
    60616114
     
    60946147
    60956148    uint64_t size = 0, logicalSize = 0;
     6149    MediumVariant_T variant = MediumVariant_Standard;
    60966150
    60976151    try
     
    61256179        try
    61266180        {
    6127             /* Open all hard disk images in the target chain but the last. */
     6181            /* Open all media in the target chain but the last. */
    61286182            MediumLockList::Base::const_iterator targetListBegin =
    61296183                task.mpMediumLockList->GetBegin();
     
    61436197                       || pMedium->m->state == MediumState_LockedRead);
    61446198
    6145                 /* Open all images in appropriate mode. */
     6199                /* Open all media in appropriate mode. */
    61466200                vrc = VDOpen(hdd,
    61476201                             pMedium->m->strFormat.c_str(),
     
    61516205                if (RT_FAILURE(vrc))
    61526206                    throw setError(E_FAIL,
    6153                                    tr("Could not open the hard disk storage unit '%s'%s"),
     6207                                   tr("Could not open the medium storage unit '%s'%s"),
    61546208                                   pMedium->m->strLocationFull.raw(),
    61556209                                   vdError(vrc).raw());
    61566210
    6157                 /* Done when we hit the image which should be reset */
     6211                /* Done when we hit the media which should be reset */
    61586212                if (pMedium == this)
    61596213                    break;
     
    61646218            if (RT_FAILURE(vrc))
    61656219                throw setError(E_FAIL,
    6166                                tr("Could not delete the hard disk storage unit '%s'%s"),
     6220                               tr("Could not delete the medium storage unit '%s'%s"),
    61676221                               location.raw(), vdError(vrc).raw());
    61686222
     
    61756229            if (RT_FAILURE(vrc))
    61766230                throw setError(E_FAIL,
    6177                                 tr("Could not open the hard disk storage unit '%s'%s"),
     6231                                tr("Could not open the medium storage unit '%s'%s"),
    61786232                                parentLocation.raw(), vdError(vrc).raw());
    61796233
     
    61816235                               format.c_str(),
    61826236                               location.c_str(),
    6183                                /// @todo use the same image variant as before
     6237                               /// @todo use the same medium variant as before
    61846238                               VD_IMAGE_FLAGS_NONE,
    61856239                               NULL,
     
    61916245            if (RT_FAILURE(vrc))
    61926246                throw setError(E_FAIL,
    6193                                 tr("Could not create the differencing hard disk storage unit '%s'%s"),
     6247                                tr("Could not create the differencing medium storage unit '%s'%s"),
    61946248                                location.raw(), vdError(vrc).raw());
    61956249
    61966250            size = VDGetFileSize(hdd, VD_LAST_IMAGE);
    61976251            logicalSize = VDGetSize(hdd, VD_LAST_IMAGE) / _1M;
     6252            unsigned uImageFlags;
     6253            vrc = VDGetImageFlags(hdd, 0, &uImageFlags);
     6254            if (RT_SUCCESS(vrc))
     6255                variant = (MediumVariant_T)uImageFlags;
    61986256        }
    61996257        catch (HRESULT aRC) { rc = aRC; }
     
    62076265    m->size = size;
    62086266    m->logicalSize = logicalSize;
     6267    m->variant = variant;
    62096268
    62106269    if (task.isAsync())
     
    62166275
    62176276    /* Note that in sync mode, it's the caller's responsibility to
    6218      * unlock the hard disk */
     6277     * unlock the medium. */
    62196278
    62206279    return rc;
     
    62446303        try
    62456304        {
    6246             /* Open all hard disk images in the chain. */
     6305            /* Open all media in the chain. */
    62476306            MediumLockList::Base::const_iterator mediumListBegin =
    62486307                task.mpMediumLockList->GetBegin();
     
    62666325                    Assert(pMedium->m->state == MediumState_LockedRead);
    62676326
    6268                 /** Open all images but last in read-only mode. */
     6327                /** Open all media but last in read-only mode. */
    62696328                vrc = VDOpen(hdd,
    62706329                             pMedium->m->strFormat.c_str(),
     
    62746333                if (RT_FAILURE(vrc))
    62756334                    throw setError(E_FAIL,
    6276                                    tr("Could not open the hard disk storage unit '%s'%s"),
     6335                                   tr("Could not open the medium storage unit '%s'%s"),
    62776336                                   pMedium->m->strLocationFull.raw(),
    62786337                                   vdError(vrc).raw());
     
    62916350                if (vrc == VERR_NOT_SUPPORTED)
    62926351                    throw setError(VBOX_E_NOT_SUPPORTED,
    6293                                    tr("Compacting is not yet supported for hard disk '%s'"),
     6352                                   tr("Compacting is not yet supported for medium '%s'"),
    62946353                                   location.raw());
    62956354                else if (vrc == VERR_NOT_IMPLEMENTED)
    62966355                    throw setError(E_NOTIMPL,
    6297                                    tr("Compacting is not implemented, hard disk '%s'"),
     6356                                   tr("Compacting is not implemented, medium '%s'"),
    62986357                                   location.raw());
    62996358                else
    63006359                    throw setError(E_FAIL,
    6301                                    tr("Could not compact hard disk '%s'%s"),
     6360                                   tr("Could not compact medium '%s'%s"),
    63026361                                   location.raw(),
    63036362                                   vdError(vrc).raw());
     
    63116370
    63126371    /* Everything is explicitly unlocked when the task exits,
    6313      * as the task destruction also destroys the image chain. */
     6372     * as the task destruction also destroys the media chain. */
    63146373
    63156374    return rc;
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r31008 r31063  
    20672067
    20682068            MediumType_T type = pHD->getType();
    2069             if (type != MediumType_Writethrough) // writethrough images are unaffected by snapshots, so do nothing for them
     2069            // writethrough and shareable images are unaffected by snapshots,
     2070            // so do nothing for them
     2071            if (   type != MediumType_Writethrough
     2072                && type != MediumType_Shareable)
    20702073            {
    20712074                // normal or immutable media need attention
     
    22832286
    22842287            {
    2285                 // writethrough images are unaffected by snapshots, skip them
     2288                // writethrough and shareable images are unaffected by
     2289                // snapshots, skip them
    22862290                AutoReadLock medlock(pHD COMMA_LOCKVAL_SRC_POS);
    22872291                MediumType_T type = pHD->getType();
    2288                 if (type == MediumType_Writethrough)
     2292                if (   type == MediumType_Writethrough
     2293                    || type == MediumType_Shareable)
    22892294                    continue;
    22902295            }
     
    27572762    AutoWriteLock alock(aHD COMMA_LOCKVAL_SRC_POS);
    27582763
    2759     // Medium must not be writethrough at this point
    2760     AssertReturn(aHD->getType() != MediumType_Writethrough, E_FAIL);
     2764    // Medium must not be writethrough/shareable at this point
     2765    MediumType_T type = aHD->getType();
     2766    AssertReturn(   type != MediumType_Writethrough
     2767                 && type != MediumType_Shareable, E_FAIL);
    27612768
    27622769    aMediumLockList = NULL;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r31019 r31063  
    85678567  <interface
    85688568    name="IMedium" extends="$unknown"
    8569     uuid="1d578f43-5ef1-4415-b556-7592d3ccdc8f"
     8569    uuid="858ea9d3-9ade-4aa7-91b7-d8a40f8f9b16"
    85708570    wsmap="managed"
    85718571  >
     
    89508950          automatically; call <link to="#refreshState"/> for that.
    89518951        </note>
     8952      </desc>
     8953    </attribute>
     8954
     8955    <attribute name="variant" type="MediumVariant" readonly="yes">
     8956      <desc>
     8957        Returns the storage format variant information for this medium.
     8958        Before <link to="#refreshState"/> is called this method returns
     8959        an undefined value.
    89528960      </desc>
    89538961    </attribute>
  • trunk/src/VBox/Main/include/MediumImpl.h

    r30929 r31063  
    9797    STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
    9898    STDMETHOD(COMGETTER(State))(MediumState_T *aState);
     99    STDMETHOD(COMGETTER(Variant))(MediumVariant_T *aVariant);
    99100    STDMETHOD(COMGETTER(Location))(BSTR *aLocation);
    100101    STDMETHOD(COMSETTER(Location))(IN_BSTR aLocation);
     
    155156    const Guid& getId() const;
    156157    MediumState_T getState() const;
     158    MediumVariant_T getVariant() const;
    157159    const Utf8Str& getLocation() const;
    158160    const Utf8Str& getLocationFull() const;
  • trunk/src/VBox/Main/xml/Settings.cpp

    r31002 r31063  
    923923                med.hdType = MediumType_Writethrough;
    924924            else if (strType == "SHAREABLE")
    925             {
    926                 /// @todo remove check once the medium type is implemented
    927                 throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute of Shareable is not implemented yet"));
    928925                med.hdType = MediumType_Shareable;
    929             }
    930926            else
    931927                throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute must be one of Normal, Immutable or Writethrough"));
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