Changeset 31063 in vbox
- Timestamp:
- Jul 23, 2010 2:36:53 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r31046 r31063 11036 11036 if (pMedium != NULL) 11037 11037 { 11038 bool fIsReadOnlyImage = (devType == DeviceType_DVD); 11038 MediumType_T mediumType = pMedium->getType(); 11039 bool fIsReadOnlyImage = devType == DeviceType_DVD 11040 || mediumType == MediumType_Shareable; 11039 11041 bool fIsVitalImage = (devType == DeviceType_HardDisk); 11042 11040 11043 mrc = pMedium->createMediumLockList(fIsVitalImage /* fFailIfInaccessible */, 11041 11044 !fIsReadOnlyImage /* fMediumLockWrite */, -
trunk/src/VBox/Main/MediumImpl.cpp
r30929 r31063 47 47 //////////////////////////////////////////////////////////////////////////////// 48 48 49 /** Describes how a machine refers to this image. */49 /** Describes how a machine refers to this medium. */ 50 50 struct BackRef 51 51 { … … 86 86 : pVirtualBox(NULL), 87 87 state(MediumState_NotCreated), 88 variant(MediumVariant_Standard), 88 89 size(0), 89 90 readers(0), … … 110 111 Utf8Str strDescription; 111 112 MediumState_T state; 113 MediumVariant_T variant; 112 114 Utf8Str strLocation; 113 115 Utf8Str strLocationFull; … … 792 794 /** 793 795 * Initializes the medium object by opening the storage unit at the specified 794 * location. The enOpenMode parameter defines whether the imagewill be opened796 * location. The enOpenMode parameter defines whether the medium will be opened 795 797 * read/write or read-only. 796 798 * … … 802 804 * @param aVirtualBox VirtualBox object. 803 805 * @param aLocation Storage unit location. 804 * @param enOpenMode Whether to open the imageread/write or read-only.806 * @param enOpenMode Whether to open the medium read/write or read-only. 805 807 * @param aDeviceType Device type of medium. 806 * @param aSetImageId Whether to set the imageUUID or not.807 * @param aImageId New imageUUID if @aSetId is true. Empty string means808 * @param aSetImageId Whether to set the medium UUID or not. 809 * @param aImageId New medium UUID if @aSetId is true. Empty string means 808 810 * create a new UUID, and a zero UUID is invalid. 809 811 * @param aSetParentId Whether to set the parent UUID or not. … … 886 888 /** 887 889 * Initializes the medium object by loading its data from the given settings 888 * node. In this mode, the imagewill always be opened read/write.890 * node. In this mode, the medium will always be opened read/write. 889 891 * 890 892 * @param aVirtualBox VirtualBox object. … … 917 919 if (aParent) 918 920 { 919 // differencing image: add to parent921 // differencing medium: add to parent 920 922 AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 921 923 m->pParent = aParent; … … 954 956 } 955 957 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 */ 959 960 if (aParent != NULL) 960 961 m->autoReset = data.fAutoReset; … … 1096 1097 * Called either from FinalRelease() or by the parent when it gets destroyed. 1097 1098 * 1098 * @note All children of this hard diskget uninitialized by calling their1099 * @note All children of this medium get uninitialized by calling their 1099 1100 * uninit() methods. 1100 1101 * … … 1153 1154 * parent. Used in uninit() and other places when reparenting is necessary. 1154 1155 * 1155 * The caller must hold the hard disktree lock!1156 * The caller must hold the medium tree lock! 1156 1157 */ 1157 1158 void Medium::deparent() … … 1176 1177 * parent. Used in uninit() and other places when reparenting is necessary. 1177 1178 * 1178 * The caller must hold the hard disktree lock!1179 * The caller must hold the medium tree lock! 1179 1180 */ 1180 1181 void Medium::setParent(const ComObjPtr<Medium> &pParent) … … 1249 1250 } 1250 1251 1252 STDMETHODIMP 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 1251 1265 1252 1266 STDMETHODIMP Medium::COMGETTER(Location)(BSTR *aLocation) … … 1398 1412 } 1399 1413 1400 /** @todo implement this case later */1401 CheckComArgExpr(aType, aType != MediumType_Shareable);1402 1403 1414 if (m->type == aType) 1404 1415 { … … 1407 1418 } 1408 1419 1409 /* cannot change the type of a differencing hard disk*/1420 /* cannot change the type of a differencing medium */ 1410 1421 if (m->pParent) 1411 1422 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"), 1413 1424 m->strLocationFull.raw()); 1414 1425 1415 /* cannot change the type of a hard diskbeing in use by more than one VM */1426 /* cannot change the type of a medium being in use by more than one VM */ 1416 1427 if (m->backRefs.size() > 1) 1417 1428 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"), 1419 1430 m->strLocationFull.raw(), m->backRefs.size()); 1420 1431 … … 1435 1446 if (getChildren().size() != 0) 1436 1447 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"), 1438 1449 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 } 1439 1459 break; 1440 1460 } … … 1531 1551 1532 1552 /* We assume that some backend may decide to return a meaningless value in 1533 * response to VDGetSize() for differencing hard disks and therefore1534 * a lways ask the base hard diskourselves. */1553 * response to VDGetSize() for differencing media and therefore always 1554 * ask the base medium ourselves. */ 1535 1555 1536 1556 /* base() will do callers/locking */ … … 1565 1585 if (m->pParent.isNull()) 1566 1586 return setError(VBOX_E_NOT_SUPPORTED, 1567 tr(" Hard disk'%s' is not differencing"),1587 tr("Medium '%s' is not differencing"), 1568 1588 m->strLocationFull.raw()); 1569 1589 … … 2078 2098 && !(m->formatObj->capabilities() & MediumFormatCapabilities_CreateDynamic)) 2079 2099 throw setError(VBOX_E_NOT_SUPPORTED, 2080 tr(" Hard diskformat '%s' does not support dynamic storage creation"),2100 tr("Medium format '%s' does not support dynamic storage creation"), 2081 2101 m->strFormat.raw()); 2082 2102 if ( (aVariant & MediumVariant_Fixed) 2083 2103 && !(m->formatObj->capabilities() & MediumFormatCapabilities_CreateDynamic)) 2084 2104 throw setError(VBOX_E_NOT_SUPPORTED, 2085 tr(" Hard diskformat '%s' does not support fixed storage creation"),2105 tr("Medium format '%s' does not support fixed storage creation"), 2086 2106 m->strFormat.raw()); 2087 2107 … … 2093 2113 static_cast<IMedium*>(this), 2094 2114 (aVariant & MediumVariant_Fixed) 2095 ? BstrFmt(tr("Creating fixed hard diskstorage unit '%s'"), m->strLocationFull.raw())2096 : BstrFmt(tr("Creating dynamic hard diskstorage 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()), 2097 2117 TRUE /* aCancelable */); 2098 2118 if (FAILED(rc)) … … 2165 2185 if (m->type == MediumType_Writethrough) 2166 2186 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"), 2168 2192 m->strLocationFull.raw()); 2169 2193 … … 2252 2276 // locking: we need the tree lock first because we access parent pointers 2253 2277 AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 2254 // and we need to write-lock the imagesinvolved2278 // and we need to write-lock the media involved 2255 2279 AutoMultiWriteLock3 alock(this, pTarget, pParent COMMA_LOCKVAL_SRC_POS); 2256 2280 … … 2306 2330 rc = pProgress->init(m->pVirtualBox, 2307 2331 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()), 2309 2333 TRUE /* aCancelable */); 2310 2334 if (FAILED(rc)) … … 2385 2409 rc = pProgress->init(m->pVirtualBox, 2386 2410 static_cast <IMedium *>(this), 2387 BstrFmt(tr("Compacting hard disk'%s'"), m->strLocationFull.raw()),2411 BstrFmt(tr("Compacting medium '%s'"), m->strLocationFull.raw()), 2388 2412 TRUE /* aCancelable */); 2389 2413 if (FAILED(rc)) … … 2449 2473 if (m->pParent.isNull()) 2450 2474 throw setError(VBOX_E_NOT_SUPPORTED, 2451 tr(" Hard disk'%s' is not differencing"),2475 tr("Medium type of '%s' is not differencing"), 2452 2476 m->strLocationFull.raw()); 2453 2477 … … 2480 2504 rc = pProgress->init(m->pVirtualBox, 2481 2505 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()), 2483 2507 FALSE /* aCancelable */); 2484 2508 if (FAILED(rc)) … … 2552 2576 2553 2577 /** 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! 2555 2579 * @return 2556 2580 */ … … 2558 2582 { 2559 2583 return m->state; 2584 } 2585 2586 /** 2587 * Internal method to return the medium's variant. Must have caller + locking! 2588 * @return 2589 */ 2590 MediumState_T Medium::getVariant() const 2591 { 2592 return m->variant; 2560 2593 } 2561 2594 … … 2607 2640 /** 2608 2641 * Adds the given machine and optionally the snapshot to the list of the objects 2609 * this imageis attached to.2642 * this medium is attached to. 2610 2643 * 2611 2644 * @param aMachineId Machine ID. … … 2638 2671 if (m->numCreateDiffTasks > 0) 2639 2672 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"), 2641 2674 m->strLocationFull.raw(), 2642 2675 m->id.raw(), … … 2699 2732 /** 2700 2733 * Removes the given machine and optionally the snapshot from the list of the 2701 * objects this imageis attached to.2734 * objects this medium is attached to. 2702 2735 * 2703 2736 * @param aMachineId Machine ID. … … 2838 2871 /** 2839 2872 * Checks if the given change of \a aOldPath to \a aNewPath affects the location 2840 * of this hard diskor any its child and updates the paths if necessary to2873 * of this medium or any its child and updates the paths if necessary to 2841 2874 * reflect the new location. 2842 2875 * … … 2871 2904 2872 2905 /** 2873 * Returns the base hard disk of the hard disk chain this hard diskis part of.2874 * 2875 * The base hard diskis 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), it2906 * 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 2877 2910 * returns itself in response to this method. 2878 2911 * 2879 * @param aLevel Where to store the number of ancestors of this hard disk2912 * @param aLevel Where to store the number of ancestors of this medium 2880 2913 * (zero for the base), may be @c NULL. 2881 2914 * … … 2918 2951 2919 2952 /** 2920 * Returns @c true if this hard diskcannot be modified because it has2921 * dependants (children) or is part of the snapshot. Related to the hard disk2953 * 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 2922 2955 * type and posterity, not to the current media state. 2923 2956 * … … 2961 2994 2962 2995 /** 2963 * Saves hard disk data by appending a new <HardDisk>child node to the given2964 * 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. 2965 2998 * 2966 2999 * @param data Settings struct to be updated. … … 3006 3039 } 3007 3040 3008 /* only for base hard disks*/3041 /* only for base media */ 3009 3042 if (m->pParent.isNull()) 3010 3043 data.hdType = m->type; … … 3025 3058 3026 3059 /** 3027 * Compares the location of this hard diskto the given location.3060 * Compares the location of this medium to the given location. 3028 3061 * 3029 3062 * The comparison takes the location details into account. For example, if the … … 3064 3097 if (RT_FAILURE(vrc)) 3065 3098 return setError(E_FAIL, 3066 tr("Invalid hard diskstorage file location '%s' (%Rrc)"),3099 tr("Invalid medium storage file location '%s' (%Rrc)"), 3067 3100 location.raw(), 3068 3101 vrc); … … 3083 3116 * @param fFailIfInaccessible If true, this fails with an error if a medium is inaccessible. If false, 3084 3117 * inaccessible media are silently skipped and not locked (i.e. their state remains "Inaccessible"); 3085 * this is necessary for a VM's removable images onVM 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. 3086 3119 * @param fMediumLockWrite Whether to associate a write lock with this medium. 3087 3120 * @param pToBeParent Medium which will become the parent of this medium. … … 3120 3153 /* Accessibility check must be first, otherwise locking interferes 3121 3154 * with getting the medium state. Lock lists are not created for 3122 * fun, and thus getting the imagestatus is no luxury. */3155 * fun, and thus getting the medium status is no luxury. */ 3123 3156 MediumState_T mediumState = pMedium->getState(); 3124 3157 if (mediumState == MediumState_Inaccessible) … … 3129 3162 if (mediumState == MediumState_Inaccessible) 3130 3163 { 3131 // ignore inaccessible ISO imagesand silently return S_OK,3164 // ignore inaccessible ISO media and silently return S_OK, 3132 3165 // otherwise VM startup (esp. restore) may fail without good reason 3133 3166 if (!fFailIfInaccessible) … … 3168 3201 3169 3202 /** 3170 * Returns a preferred format for differencing hard disks.3203 * Returns a preferred format for differencing media. 3171 3204 */ 3172 3205 Bstr Medium::preferredDiffFormat() … … 3217 3250 * Sets the value of m->strLocation and calculates the value of m->strLocationFull. 3218 3251 * 3219 * Treats non-FS-path locations specially, and prepends the default hard disk3252 * Treats non-FS-path locations specially, and prepends the default medium 3220 3253 * folder if the given location string does not contain any path information 3221 3254 * at all. … … 3391 3424 3392 3425 /** 3393 * Queries information from the image file.3426 * Queries information from the medium. 3394 3427 * 3395 3428 * As a result of this call, the accessibility state and data members such as … … 3492 3525 try 3493 3526 { 3494 /** @todo This kind of opening of imagesis assuming that diff3495 * images can be opened as base images. Should be documented if3527 /** @todo This kind of opening of media is assuming that diff 3528 * media can be opened as base media. Should be documented if 3496 3529 * it must work for all medium format backends. */ 3497 3530 vrc = VDOpen(hdd, … … 3575 3608 vrc = VDGetImageFlags(hdd, 0, &uImageFlags); 3576 3609 ComAssertRCThrow(vrc, E_FAIL); 3610 m->variant = (MediumVariant_T)uImageFlags; 3577 3611 3578 3612 if (uImageFlags & VD_IMAGE_FLAGS_DIFF) … … 3585 3619 { 3586 3620 /* the parent must be known to us. Note that we freely 3587 * call locking methods of mVirtualBox and parent from the3588 * write lock (breaking the {parent,child} lock order)3589 * because there may be no concurrent access to the just3590 * opened hard disk on ther threads yet (and init() will3591 * fail if this method reporstMediumState_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) */ 3592 3626 3593 3627 Guid id = parentId; … … 3599 3633 { 3600 3634 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')"), 3602 3636 &parentId, location.c_str(), 3603 3637 m->pVirtualBox->settingsFilePath().c_str()); … … 3624 3658 { 3625 3659 lastAccessError = Utf8StrFmt( 3626 tr(" Hard disk '%s' is differencing but it is not associated with any parent hard diskin 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')"), 3627 3661 location.c_str(), 3628 3662 m->pVirtualBox->settingsFilePath().c_str()); … … 3635 3669 { 3636 3670 lastAccessError = Utf8StrFmt( 3637 tr("Parent UUID {%RTuuid} of the hard disk '%s' does not match UUID {%RTuuid} of its parent hard diskstored 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')"), 3638 3672 &parentId, location.c_str(), 3639 3673 m->pParent->getId().raw(), … … 3846 3880 3847 3881 /** 3848 * Deletes the hard diskstorage unit.3882 * Deletes the medium storage unit. 3849 3883 * 3850 3884 * If @a aProgress is not NULL but the object it points to is @c null then a new … … 3895 3929 | MediumFormatCapabilities_CreateFixed))) 3896 3930 throw setError(VBOX_E_NOT_SUPPORTED, 3897 tr(" Hard diskformat '%s' does not support storage deletion"),3931 tr("Medium format '%s' does not support storage deletion"), 3898 3932 m->strFormat.raw()); 3899 3933 … … 3902 3936 * it is really inaccessible, the delete operation will fail anyway. 3903 3937 * Accepting Inaccessible state is especially important because all 3904 * registered hard disks are initially Inaccessible upon VBoxSVC3905 * startup until COMGETTER(RefreshState) is called. Accept Deleting3906 * state because some callers need to put the imagein this state early3938 * 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 3907 3941 * to prevent races. */ 3908 3942 switch (m->state) … … 3932 3966 #endif 3933 3967 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"), 3935 3969 m->strLocationFull.c_str(), 3936 3970 m->backRefs.size(), … … 3971 4005 } 3972 4006 3973 /* try to remove from the list of known hard disksbefore performing4007 /* try to remove from the list of known media before performing 3974 4008 * actual deletion (we favor the consistency of the media registry 3975 4009 * which would have been broken if unregisterWithVirtualBox() failed … … 3992 4026 rc = pProgress->init(m->pVirtualBox, 3993 4027 static_cast<IMedium*>(this), 3994 BstrFmt(tr("Deleting hard diskstorage unit '%s'"), m->strLocationFull.raw()),4028 BstrFmt(tr("Deleting medium storage unit '%s'"), m->strLocationFull.raw()), 3995 4029 FALSE /* aCancelable */); 3996 4030 if (FAILED(rc)) … … 4109 4143 4110 4144 /** 4111 * Creates a new differencing storage unit using the given target hard disk's4112 * formatand 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. 4113 4147 * 4114 4148 * The @a aMediumLockList parameter contains the associated medium lock list, … … 4127 4161 * NULL when @a aWait is @c false (this method will assert in this case). 4128 4162 * 4129 * @param aTarget Target hard disk.4130 * @param aVariant Precise imagevariant to create.4163 * @param aTarget Target medium. 4164 * @param aVariant Precise medium variant to create. 4131 4165 * @param aMediumLockList List of media which should be locked. 4132 4166 * @param aProgress Where to find/store a Progress object to track … … 4170 4204 AutoMultiWriteLock2 alock(this, aTarget COMMA_LOCKVAL_SRC_POS); 4171 4205 4172 ComAssertThrow(m->type != MediumType_Writethrough, E_FAIL); 4206 ComAssertThrow( m->type != MediumType_Writethrough 4207 && m->type != MediumType_Shareable, E_FAIL); 4173 4208 ComAssertThrow(m->state == MediumState_LockedRead, E_FAIL); 4174 4209 … … 4176 4211 throw aTarget->setStateError(); 4177 4212 4178 /* Check that the hard diskis not attached to the current state of4213 /* Check that the medium is not attached to the current state of 4179 4214 * any VM referring to it. */ 4180 4215 for (BackRefList::const_iterator it = m->backRefs.begin(); … … 4184 4219 if (it->fInCurState) 4185 4220 { 4186 /* Note: when a VM snapshot is being taken, all normal hard4187 * disksattached to the VM in the current state will be, as an4221 /* Note: when a VM snapshot is being taken, all normal media 4222 * attached to the VM in the current state will be, as an 4188 4223 * exception, also associated with the snapshot which is about 4189 4224 * to create (see SnapshotMachine::init()) before deassociating … … 4194 4229 if (it->llSnapshotIds.size() == 0) 4195 4230 throw setError(VBOX_E_INVALID_OBJECT_STATE, 4196 tr(" Hard disk '%s' is attached to a virtual machine with UUID {%RTuuid}. No differencing hard disksbased 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"), 4197 4232 m->strLocationFull.raw(), it->machineId.raw()); 4198 4233 … … 4212 4247 rc = pProgress->init(m->pVirtualBox, 4213 4248 static_cast<IMedium*>(this), 4214 BstrFmt(tr("Creating differencing hard diskstorage unit '%s'"), aTarget->m->strLocationFull.raw()),4249 BstrFmt(tr("Creating differencing medium storage unit '%s'"), aTarget->m->strLocationFull.raw()), 4215 4250 TRUE /* aCancelable */); 4216 4251 if (FAILED(rc)) … … 4253 4288 4254 4289 /** 4255 * Prepares this (source) hard disk, target hard disk and all intermediate hard4256 * disksfor the merge operation.4290 * Prepares this (source) medium, target medium and all intermediate media 4291 * for the merge operation. 4257 4292 * 4258 4293 * This method is to be called prior to calling the #mergeTo() to perform 4259 * necessary consistency checks and place involved hard disksto appropriate4294 * necessary consistency checks and place involved media to appropriate 4260 4295 * states. If #mergeTo() is not called or fails, the state modifications 4261 4296 * performed by this method must be undone by #cancelMergeTo(). … … 4263 4298 * See #mergeTo() for more information about merging. 4264 4299 * 4265 * @param pTarget Target hard disk.4300 * @param pTarget Target medium. 4266 4301 * @param aMachineId Allowed machine attachment. NULL means do not check. 4267 4302 * @param aSnapshotId Allowed snapshot attachment. NULL or empty UUID means … … 4277 4312 * 4278 4313 * @note Locks medium tree for reading. Locks this object, aTarget and all 4279 * intermediate hard disksfor writing.4314 * intermediate media for writing. 4280 4315 */ 4281 4316 HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget, … … 4332 4367 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4333 4368 throw setError(E_FAIL, 4334 tr(" Hard disks'%s' and '%s' are unrelated"),4369 tr("Media '%s' and '%s' are unrelated"), 4335 4370 m->strLocationFull.raw(), tgtLoc.raw()); 4336 4371 } … … 4382 4417 } 4383 4418 /* One backreference is only allowed if the machine ID is not empty 4384 * and it matches the machine the imageis attached to (including4419 * and it matches the machine the medium is attached to (including 4385 4420 * the snapshot ID if not empty). */ 4386 4421 if ( m->backRefs.size() != 0 … … 4546 4581 4547 4582 /** 4548 * Merges this hard disk to the specified hard diskwhich must be either its4583 * Merges this medium to the specified medium which must be either its 4549 4584 * direct ancestor or descendant. 4550 4585 * 4551 * Given this hard disk is SOURCE and the specified hard diskis TARGET, we will4586 * Given this medium is SOURCE and the specified medium is TARGET, we will 4552 4587 * get two varians of the merge operation: 4553 4588 * … … 4563 4598 * LockWr Del Del LockWr 4564 4599 * 4565 * Each diagram shows the involved hard disks on the hard diskchain where4566 * SOURCE and TARGET belong. Under each hard diskthere is a state value which4567 * the hard diskmust have at a time of the mergeTo() call.4568 * 4569 * The hard disksin the square braces may be absent (e.g. when the forward4570 * operation takes place and SOURCE is the base hard disk, or when the backward4600 * 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 4571 4606 * merge operation takes place and TARGET is the last child in the chain) but if 4572 4607 * they present they are involved too as shown. 4573 4608 * 4574 * N or the source hard disk neither intermediate hard disksmay be attached to4609 * Neither the source medium nor intermediate media may be attached to 4575 4610 * any VM directly or in the snapshot, otherwise this method will assert. 4576 4611 * … … 4580 4615 * If @a aWait is @c true then this method will perform the operation on the 4581 4616 * calling thread and will not return to the caller until the operation is 4582 * completed. When this method succeeds, all intermediate hard diskobjects in4583 * the chain will be uninitialized, the state of the target hard disk(and all4584 * involved extra hard disks) will be restored. @a aMediumLockList will not be4617 * 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 4585 4620 * deleted, whether the operation is successful or not. The caller has to do 4586 * this if appropriate. Note that this (source) hard diskis not uninitialized4621 * this if appropriate. Note that this (source) medium is not uninitialized 4587 4622 * because of possible AutoCaller instances held by the caller of this method 4588 4623 * on the current thread. It's therefore the responsibility of the caller to … … 4591 4626 * If @a aWait is @c false then this method will create a thread to perform the 4592 4627 * operation asynchronously and will return immediately. If the operation 4593 * succeeds, the thread will uninitialize the source hard diskobject and all4594 * intermediate hard diskobjects in the chain, reset the state of the target4595 * 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. 4596 4631 * If the operation fails, the thread will only reset the states of all 4597 * involved hard disksand delete @a aMediumLockList.4632 * involved media and delete @a aMediumLockList. 4598 4633 * 4599 4634 * When this method fails (regardless of the @a aWait mode), it is a caller's … … 4607 4642 * NULL when @a aWait is @c false (this method will assert in this case). 4608 4643 * 4609 * @param pTarget Target hard disk.4644 * @param pTarget Target medium. 4610 4645 * @param fMergeForward Merge direction. 4611 4646 * @param pParentForTarget New parent for target medium after merge. … … 4622 4657 * and this parameter is ignored. 4623 4658 * 4624 * @note Locks the tree lock for writing. Locks the hard disksfrom the chain4659 * @note Locks the tree lock for writing. Locks the media from the chain 4625 4660 * for writing. 4626 4661 */ … … 4670 4705 rc = pProgress->init(m->pVirtualBox, 4671 4706 static_cast<IMedium*>(this), 4672 BstrFmt(tr("Merging hard disk'%s' to '%s'"),4707 BstrFmt(tr("Merging medium '%s' to '%s'"), 4673 4708 getName().raw(), 4674 4709 tgtName.raw()), … … 4716 4751 * @param aMediumLockList Medium locking information. 4717 4752 * 4718 * @note Locks the hard disksfrom the chain for writing.4753 * @note Locks the media from the chain for writing. 4719 4754 */ 4720 4755 void Medium::cancelMergeTo(const MediaList &aChildrenToReparent, … … 4781 4816 if (m->formatObj.isNull()) 4782 4817 return setError(E_INVALIDARG, 4783 tr("Invalid hard diskstorage format '%ls'"),4818 tr("Invalid medium storage format '%ls'"), 4784 4819 aFormat); 4785 4820 … … 4824 4859 if (getChildren().size() != 0) 4825 4860 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"), 4827 4862 m->strLocationFull.raw(), getChildren().size()); 4828 4863 … … 5080 5115 AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS); 5081 5116 5082 // open the image5117 // open the medium 5083 5118 vrc = VDOpen(hdd, 5084 5119 pMedium->m->strFormat.c_str(), … … 5178 5213 /* these parameters we need after creation */ 5179 5214 uint64_t size = 0, logicalSize = 0; 5215 MediumVariant_T variant = MediumVariant_Standard; 5180 5216 bool fGenerateUuid = false; 5181 5217 … … 5232 5268 if (RT_FAILURE(vrc)) 5233 5269 throw setError(E_FAIL, 5234 tr("Could not create the hard diskstorage unit '%s'%s"),5270 tr("Could not create the medium storage unit '%s'%s"), 5235 5271 location.raw(), vdError(vrc).raw()); 5236 5272 5237 5273 size = VDGetFileSize(hdd, 0); 5238 5274 logicalSize = VDGetSize(hdd, 0) / _1M; 5275 unsigned uImageFlags; 5276 vrc = VDGetImageFlags(hdd, 0, &uImageFlags); 5277 if (RT_SUCCESS(vrc)) 5278 variant = (MediumVariant_T)uImageFlags; 5239 5279 } 5240 5280 catch (HRESULT aRC) { rc = aRC; } … … 5270 5310 m->size = size; 5271 5311 m->logicalSize = logicalSize; 5312 m->variant = variant; 5272 5313 } 5273 5314 else … … 5305 5346 5306 5347 uint64_t size = 0, logicalSize = 0; 5348 MediumVariant_T variant = MediumVariant_Standard; 5307 5349 bool fGenerateUuid = false; 5308 5350 … … 5343 5385 try 5344 5386 { 5345 /* Open all hard disk imagesin the target chain but the last. */5387 /* Open all media in the target chain but the last. */ 5346 5388 MediumLockList::Base::const_iterator targetListBegin = 5347 5389 task.mpMediumLockList->GetBegin(); … … 5357 5399 AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS); 5358 5400 5359 /* Skip over the target diff image*/5401 /* Skip over the target diff medium */ 5360 5402 if (pMedium->m->state == MediumState_Creating) 5361 5403 continue; … … 5364 5406 Assert(pMedium->m->state == MediumState_LockedRead); 5365 5407 5366 /* Open all imagesin appropriate mode. */5408 /* Open all media in appropriate mode. */ 5367 5409 vrc = VDOpen(hdd, 5368 5410 pMedium->m->strFormat.c_str(), … … 5372 5414 if (RT_FAILURE(vrc)) 5373 5415 throw setError(E_FAIL, 5374 tr("Could not open the hard diskstorage unit '%s'%s"),5416 tr("Could not open the medium storage unit '%s'%s"), 5375 5417 pMedium->m->strLocationFull.raw(), 5376 5418 vdError(vrc).raw()); … … 5394 5436 if (RT_FAILURE(vrc)) 5395 5437 throw setError(E_FAIL, 5396 tr("Could not create the differencing hard diskstorage unit '%s'%s"),5438 tr("Could not create the differencing medium storage unit '%s'%s"), 5397 5439 targetLocation.raw(), vdError(vrc).raw()); 5398 5440 5399 5441 size = VDGetFileSize(hdd, VD_LAST_IMAGE); 5400 5442 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; 5401 5447 } 5402 5448 catch (HRESULT aRC) { rc = aRC; } … … 5418 5464 /** @todo r=klaus neither target nor base() are locked, 5419 5465 * potential race! */ 5420 /* diffs for immutable hard disksare auto-reset by default */5466 /* diffs for immutable media are auto-reset by default */ 5421 5467 pTarget->m->autoReset = (getBase()->m->type == MediumType_Immutable); 5422 5468 … … 5439 5485 pTarget->m->size = size; 5440 5486 pTarget->m->logicalSize = logicalSize; 5487 pTarget->m->variant = variant; 5441 5488 } 5442 5489 else … … 5472 5519 5473 5520 /* Note that in sync mode, it's the caller's responsibility to 5474 * unlock the hard disk*/5521 * unlock the medium. */ 5475 5522 5476 5523 return rc; … … 5509 5556 unsigned uTargetIdx = VD_LAST_IMAGE; 5510 5557 unsigned uSourceIdx = VD_LAST_IMAGE; 5511 /* Open all hard disksin the chain. */5558 /* Open all media in the chain. */ 5512 5559 MediumLockList::Base::iterator lockListBegin = 5513 5560 task.mpMediumLockList->GetBegin(); … … 5532 5579 * complex sanity (sane complexity) 5533 5580 * 5534 * The current image must be in the Deleting (imageis 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. 5536 5583 * If it is the target it must be in the LockedWrite state. 5537 5584 */ … … 5543 5590 5544 5591 /* 5545 * Imagemust be the target, in the LockedRead state5592 * Medium must be the target, in the LockedRead state 5546 5593 * or Deleting state where it is not allowed to be attached 5547 5594 * to a virtual machine. … … 5561 5608 uOpenFlags = VD_OPEN_FLAGS_READONLY; 5562 5609 5563 /* Open the image*/5610 /* Open the medium */ 5564 5611 vrc = VDOpen(hdd, 5565 5612 pMedium->m->strFormat.c_str(), … … 5620 5667 { 5621 5668 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"), 5623 5670 m->strLocationFull.raw(), 5624 5671 pTarget->m->strLocationFull.raw(), … … 5634 5681 if (SUCCEEDED(rc)) 5635 5682 { 5636 /* all hard disksbut the target were successfully deleted by5683 /* all media but the target were successfully deleted by 5637 5684 * VDMerge; reparent the last one and uninitialize deleted media. */ 5638 5685 … … 5642 5689 { 5643 5690 /* first, unregister the target since it may become a base 5644 * hard diskwhich needs re-registration */5691 * medium which needs re-registration */ 5645 5692 rc2 = m->pVirtualBox->unregisterHardDisk(pTarget, NULL /*&fNeedsSaveSettings*/); 5646 5693 AssertComRC(rc2); … … 5688 5735 } 5689 5736 5690 /* unregister and uninitialize all hard disksremoved by the merge */5737 /* unregister and uninitialize all media removed by the merge */ 5691 5738 MediumLockList::Base::iterator lockListBegin = 5692 5739 task.mpMediumLockList->GetBegin(); … … 5702 5749 const ComObjPtr<Medium> pMedium = mediumLock.GetMedium(); 5703 5750 5704 /* The target and all imagesnot merged (readonly) are skipped */5751 /* The target and all media not merged (readonly) are skipped */ 5705 5752 if ( pMedium == pTarget 5706 5753 || pMedium->m->state == MediumState_LockedRead) … … 5714 5761 AssertComRC(rc2); 5715 5762 5716 /* now, uninitialize the deleted hard disk(note that5763 /* now, uninitialize the deleted medium (note that 5717 5764 * due to the Deleting state, uninit() will not touch 5718 5765 * the parent-child relationship so we need to 5719 5766 * uninitialize each disk individually) */ 5720 5767 5721 /* note that the operation initiator hard disk(which is5722 * normally also the source hard disk) is a special case5768 /* note that the operation initiator medium (which is 5769 * normally also the source medium) is a special case 5723 5770 * -- there is one more caller added by Task to it which 5724 5771 * we must release. Also, if we are in sync mode, the … … 5760 5807 /* Here we come if either VDMerge() failed (in which case we 5761 5808 * assume that it tried to do everything to make a further 5762 * retry possible -- e.g. not deleted intermediate hard disks5809 * retry possible -- e.g. not deleted intermediate media 5763 5810 * and so on) or VirtualBox::saveSettings() failed (where we 5764 5811 * should have the original tree but with intermediate storage … … 5797 5844 5798 5845 uint64_t size = 0, logicalSize = 0; 5846 MediumVariant_T variant = MediumVariant_Standard; 5799 5847 bool fGenerateUuid = false; 5800 5848 … … 5825 5873 try 5826 5874 { 5827 /* Open all hard disk imagesin the source chain. */5875 /* Open all media in the source chain. */ 5828 5876 MediumLockList::Base::const_iterator sourceListBegin = 5829 5877 task.mpSourceMediumLockList->GetBegin(); … … 5841 5889 Assert(pMedium->m->state == MediumState_LockedRead); 5842 5890 5843 /** Open all imagesin read-only mode. */5891 /** Open all media in read-only mode. */ 5844 5892 vrc = VDOpen(hdd, 5845 5893 pMedium->m->strFormat.c_str(), … … 5849 5897 if (RT_FAILURE(vrc)) 5850 5898 throw setError(E_FAIL, 5851 tr("Could not open the hard diskstorage unit '%s'%s"),5899 tr("Could not open the medium storage unit '%s'%s"), 5852 5900 pMedium->m->strLocationFull.raw(), 5853 5901 vdError(vrc).raw()); … … 5876 5924 try 5877 5925 { 5878 /* Open all hard disk imagesin the target chain. */5926 /* Open all media in the target chain. */ 5879 5927 MediumLockList::Base::const_iterator targetListBegin = 5880 5928 task.mpTargetMediumLockList->GetBegin(); … … 5899 5947 || pMedium->m->state == MediumState_LockedWrite); 5900 5948 5901 /* Open all imagesin appropriate mode. */5949 /* Open all media in appropriate mode. */ 5902 5950 vrc = VDOpen(targetHdd, 5903 5951 pMedium->m->strFormat.c_str(), … … 5907 5955 if (RT_FAILURE(vrc)) 5908 5956 throw setError(E_FAIL, 5909 tr("Could not open the hard diskstorage unit '%s'%s"),5957 tr("Could not open the medium storage unit '%s'%s"), 5910 5958 pMedium->m->strLocationFull.raw(), 5911 5959 vdError(vrc).raw()); … … 5927 5975 if (RT_FAILURE(vrc)) 5928 5976 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"), 5930 5978 targetLocation.raw(), vdError(vrc).raw()); 5931 5979 5932 5980 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE); 5933 5981 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; 5934 5986 } 5935 5987 catch (HRESULT aRC) { rc = aRC; } … … 5943 5995 catch (HRESULT aRC) { rc = aRC; } 5944 5996 5945 /* Only do the parent changes for newly created images. */5997 /* Only do the parent changes for newly created media. */ 5946 5998 if (SUCCEEDED(rc) && fCreatingTarget) 5947 5999 { … … 5984 6036 pTarget->m->size = size; 5985 6037 pTarget->m->logicalSize = logicalSize; 6038 pTarget->m->variant = variant; 5986 6039 } 5987 6040 else … … 6057 6110 if (RT_FAILURE(vrc)) 6058 6111 throw setError(E_FAIL, 6059 tr("Could not delete the hard diskstorage unit '%s'%s"),6112 tr("Could not delete the medium storage unit '%s'%s"), 6060 6113 location.raw(), vdError(vrc).raw()); 6061 6114 … … 6094 6147 6095 6148 uint64_t size = 0, logicalSize = 0; 6149 MediumVariant_T variant = MediumVariant_Standard; 6096 6150 6097 6151 try … … 6125 6179 try 6126 6180 { 6127 /* Open all hard disk imagesin the target chain but the last. */6181 /* Open all media in the target chain but the last. */ 6128 6182 MediumLockList::Base::const_iterator targetListBegin = 6129 6183 task.mpMediumLockList->GetBegin(); … … 6143 6197 || pMedium->m->state == MediumState_LockedRead); 6144 6198 6145 /* Open all imagesin appropriate mode. */6199 /* Open all media in appropriate mode. */ 6146 6200 vrc = VDOpen(hdd, 6147 6201 pMedium->m->strFormat.c_str(), … … 6151 6205 if (RT_FAILURE(vrc)) 6152 6206 throw setError(E_FAIL, 6153 tr("Could not open the hard diskstorage unit '%s'%s"),6207 tr("Could not open the medium storage unit '%s'%s"), 6154 6208 pMedium->m->strLocationFull.raw(), 6155 6209 vdError(vrc).raw()); 6156 6210 6157 /* Done when we hit the imagewhich should be reset */6211 /* Done when we hit the media which should be reset */ 6158 6212 if (pMedium == this) 6159 6213 break; … … 6164 6218 if (RT_FAILURE(vrc)) 6165 6219 throw setError(E_FAIL, 6166 tr("Could not delete the hard diskstorage unit '%s'%s"),6220 tr("Could not delete the medium storage unit '%s'%s"), 6167 6221 location.raw(), vdError(vrc).raw()); 6168 6222 … … 6175 6229 if (RT_FAILURE(vrc)) 6176 6230 throw setError(E_FAIL, 6177 tr("Could not open the hard diskstorage unit '%s'%s"),6231 tr("Could not open the medium storage unit '%s'%s"), 6178 6232 parentLocation.raw(), vdError(vrc).raw()); 6179 6233 … … 6181 6235 format.c_str(), 6182 6236 location.c_str(), 6183 /// @todo use the same imagevariant as before6237 /// @todo use the same medium variant as before 6184 6238 VD_IMAGE_FLAGS_NONE, 6185 6239 NULL, … … 6191 6245 if (RT_FAILURE(vrc)) 6192 6246 throw setError(E_FAIL, 6193 tr("Could not create the differencing hard diskstorage unit '%s'%s"),6247 tr("Could not create the differencing medium storage unit '%s'%s"), 6194 6248 location.raw(), vdError(vrc).raw()); 6195 6249 6196 6250 size = VDGetFileSize(hdd, VD_LAST_IMAGE); 6197 6251 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; 6198 6256 } 6199 6257 catch (HRESULT aRC) { rc = aRC; } … … 6207 6265 m->size = size; 6208 6266 m->logicalSize = logicalSize; 6267 m->variant = variant; 6209 6268 6210 6269 if (task.isAsync()) … … 6216 6275 6217 6276 /* Note that in sync mode, it's the caller's responsibility to 6218 * unlock the hard disk*/6277 * unlock the medium. */ 6219 6278 6220 6279 return rc; … … 6244 6303 try 6245 6304 { 6246 /* Open all hard disk imagesin the chain. */6305 /* Open all media in the chain. */ 6247 6306 MediumLockList::Base::const_iterator mediumListBegin = 6248 6307 task.mpMediumLockList->GetBegin(); … … 6266 6325 Assert(pMedium->m->state == MediumState_LockedRead); 6267 6326 6268 /** Open all imagesbut last in read-only mode. */6327 /** Open all media but last in read-only mode. */ 6269 6328 vrc = VDOpen(hdd, 6270 6329 pMedium->m->strFormat.c_str(), … … 6274 6333 if (RT_FAILURE(vrc)) 6275 6334 throw setError(E_FAIL, 6276 tr("Could not open the hard diskstorage unit '%s'%s"),6335 tr("Could not open the medium storage unit '%s'%s"), 6277 6336 pMedium->m->strLocationFull.raw(), 6278 6337 vdError(vrc).raw()); … … 6291 6350 if (vrc == VERR_NOT_SUPPORTED) 6292 6351 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'"), 6294 6353 location.raw()); 6295 6354 else if (vrc == VERR_NOT_IMPLEMENTED) 6296 6355 throw setError(E_NOTIMPL, 6297 tr("Compacting is not implemented, hard disk'%s'"),6356 tr("Compacting is not implemented, medium '%s'"), 6298 6357 location.raw()); 6299 6358 else 6300 6359 throw setError(E_FAIL, 6301 tr("Could not compact hard disk'%s'%s"),6360 tr("Could not compact medium '%s'%s"), 6302 6361 location.raw(), 6303 6362 vdError(vrc).raw()); … … 6311 6370 6312 6371 /* Everything is explicitly unlocked when the task exits, 6313 * as the task destruction also destroys the imagechain. */6372 * as the task destruction also destroys the media chain. */ 6314 6373 6315 6374 return rc; -
trunk/src/VBox/Main/SnapshotImpl.cpp
r31008 r31063 2067 2067 2068 2068 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) 2070 2073 { 2071 2074 // normal or immutable media need attention … … 2283 2286 2284 2287 { 2285 // writethrough images are unaffected by snapshots, skip them 2288 // writethrough and shareable images are unaffected by 2289 // snapshots, skip them 2286 2290 AutoReadLock medlock(pHD COMMA_LOCKVAL_SRC_POS); 2287 2291 MediumType_T type = pHD->getType(); 2288 if (type == MediumType_Writethrough) 2292 if ( type == MediumType_Writethrough 2293 || type == MediumType_Shareable) 2289 2294 continue; 2290 2295 } … … 2757 2762 AutoWriteLock alock(aHD COMMA_LOCKVAL_SRC_POS); 2758 2763 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); 2761 2768 2762 2769 aMediumLockList = NULL; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r31019 r31063 8567 8567 <interface 8568 8568 name="IMedium" extends="$unknown" 8569 uuid=" 1d578f43-5ef1-4415-b556-7592d3ccdc8f"8569 uuid="858ea9d3-9ade-4aa7-91b7-d8a40f8f9b16" 8570 8570 wsmap="managed" 8571 8571 > … … 8950 8950 automatically; call <link to="#refreshState"/> for that. 8951 8951 </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. 8952 8960 </desc> 8953 8961 </attribute> -
trunk/src/VBox/Main/include/MediumImpl.h
r30929 r31063 97 97 STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription); 98 98 STDMETHOD(COMGETTER(State))(MediumState_T *aState); 99 STDMETHOD(COMGETTER(Variant))(MediumVariant_T *aVariant); 99 100 STDMETHOD(COMGETTER(Location))(BSTR *aLocation); 100 101 STDMETHOD(COMSETTER(Location))(IN_BSTR aLocation); … … 155 156 const Guid& getId() const; 156 157 MediumState_T getState() const; 158 MediumVariant_T getVariant() const; 157 159 const Utf8Str& getLocation() const; 158 160 const Utf8Str& getLocationFull() const; -
trunk/src/VBox/Main/xml/Settings.cpp
r31002 r31063 923 923 med.hdType = MediumType_Writethrough; 924 924 else if (strType == "SHAREABLE") 925 {926 /// @todo remove check once the medium type is implemented927 throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute of Shareable is not implemented yet"));928 925 med.hdType = MediumType_Shareable; 929 }930 926 else 931 927 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.