- Timestamp:
- Jul 15, 2011 3:04:39 PM (13 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r37928 r37985 279 279 HRESULT saveSettings(); 280 280 281 void addGuidToListUniquely(GuidList &llRegistriesThatNeedSaving, const Guid &uuid);281 static void addGuidToListUniquely(GuidList &llRegistriesThatNeedSaving, const Guid &uuid); 282 282 HRESULT saveRegistries(const GuidList &llRegistriesThatNeedSaving); 283 283 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r37971 r37985 6260 6260 optList = com::SafeArray<CloneOptions_T>(ComSafeArrayInArg(options)).toList(); 6261 6261 6262 AssertReturn(!optList.contains(CloneOptions_Link) || (isSnapshotMachine() && mode == CloneMode_MachineState), E_INVALIDARG); 6262 if (optList.contains(CloneOptions_Link)) 6263 { 6264 if (!isSnapshotMachine()) 6265 return setError(E_INVALIDARG, 6266 tr("Linked clone can only be created from a snapshot\n")); 6267 if (mode != CloneMode_MachineState) 6268 return setError(E_INVALIDARG, 6269 tr("Linked clone can only be created for a single machine state\n")); 6270 } 6263 6271 AssertReturn(!(optList.contains(CloneOptions_KeepAllMACs) && optList.contains(CloneOptions_KeepNATMACs)), E_INVALIDARG); 6264 6272 … … 9202 9210 if (pMedium->addRegistry(uuid, false /* fRecurse */)) 9203 9211 // registry actually changed: 9204 mParent->addGuidToListUniquely(llRegistriesThatNeedSaving, uuid);9212 VirtualBox::addGuidToListUniquely(llRegistriesThatNeedSaving, uuid); 9205 9213 9206 9214 if (puuid) -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r37971 r37985 596 596 typedef std::pair<Utf8Str, ComObjPtr<Medium> > TStrMediumPair; 597 597 TStrMediumMap map; 598 GuidList llRegistriesThatNeedSaving; 598 599 size_t cDisks = 0; 599 600 for (size_t i = 0; i < d->llMedias.size(); ++i) … … 812 813 if (FAILED(mac.rc())) throw mac.rc(); 813 814 AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS); 814 pMedium->addRegistry(d->options.contains(CloneOptions_Link) ? d->pSrcMachine->mData->mUuid : d->pTrgMachine->mData->mUuid, false /* fRecurse */); 815 Guid uuid = d->pTrgMachine->mData->mUuid; 816 if (d->options.contains(CloneOptions_Link)) 817 { 818 ComObjPtr<Medium> pParent = pMedium->getParent(); 819 mlock.release(); 820 if (!pParent.isNull()) 821 { 822 AutoCaller mac2(pParent); 823 if (FAILED(mac2.rc())) throw mac2.rc(); 824 AutoReadLock mlock2(pParent COMMA_LOCKVAL_SRC_POS); 825 if (pParent->getFirstRegistryMachineId(uuid)) 826 VirtualBox::addGuidToListUniquely(llRegistriesThatNeedSaving, uuid); 827 } 828 mlock.acquire(); 829 } 830 pMedium->addRegistry(uuid, false /* fRecurse */); 815 831 } 816 832 /* Check if a snapshot folder is necessary and if so doesn't already … … 867 883 if (FAILED(rc)) throw rc; 868 884 trgLock.release(); 869 if ( d->options.contains(CloneOptions_Link))885 if (!llRegistriesThatNeedSaving.empty()) 870 886 { 871 887 srcLock.release(); 872 GuidList llRegistrySrc; 873 llRegistrySrc.push_back(d->pSrcMachine->mData->mUuid); 874 rc = p->mParent->saveRegistries(llRegistrySrc); 888 rc = p->mParent->saveRegistries(llRegistriesThatNeedSaving); 875 889 if (FAILED(rc)) throw rc; 876 890 } -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r37941 r37985 3278 3278 ++it) 3279 3279 { 3280 m->pVirtualBox->addGuidToListUniquely(llRegistryIDs, *it);3280 VirtualBox::addGuidToListUniquely(llRegistryIDs, *it); 3281 3281 } 3282 3282 -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r37851 r37985 1936 1936 // unconditionally add the parent registry. We do similar in SessionMachine::EndTakingSnapshot 1937 1937 // (mParent->saveSettings()) 1938 mParent->addGuidToListUniquely(llRegistriesThatNeedSaving, mParent->getGlobalRegistryId());1938 VirtualBox::addGuidToListUniquely(llRegistriesThatNeedSaving, mParent->getGlobalRegistryId()); 1939 1939 1940 1940 // let go of the locks while we're deleting image files below … … 2480 2480 2481 2481 // machine will need saving now 2482 mParent->addGuidToListUniquely(llRegistriesThatNeedSaving, getId());2482 VirtualBox::addGuidToListUniquely(llRegistriesThatNeedSaving, getId()); 2483 2483 } 2484 2484 } … … 2655 2655 2656 2656 // One attachment is merged, must save the settings 2657 mParent->addGuidToListUniquely(llRegistriesThatNeedSaving, getId());2657 VirtualBox::addGuidToListUniquely(llRegistriesThatNeedSaving, getId()); 2658 2658 2659 2659 // prevent calling cancelDeleteSnapshotMedium() for this attachment … … 2674 2674 aTask.pSnapshot->uninit(); 2675 2675 2676 mParent->addGuidToListUniquely(llRegistriesThatNeedSaving, getId());2676 VirtualBox::addGuidToListUniquely(llRegistriesThatNeedSaving, getId()); 2677 2677 } 2678 2678 } -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r37928 r37985 3838 3838 pMedium->addRegistry(*puuidBetter, true /* fRecurse */); 3839 3839 // 3) and make sure the registry is saved below 3840 addGuidToListUniquely(llRegistriesThatNeedSaving, *puuidBetter);3840 VirtualBox::addGuidToListUniquely(llRegistriesThatNeedSaving, *puuidBetter); 3841 3841 } 3842 3842 } … … 3860 3860 * @param uuid 3861 3861 */ 3862 /* static */ 3862 3863 void VirtualBox::addGuidToListUniquely(GuidList &llRegistriesThatNeedSaving, 3863 3864 const Guid &uuid)
Note:
See TracChangeset
for help on using the changeset viewer.