- Timestamp:
- Jul 4, 2007 11:11:28 AM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
-
HardDiskImpl.cpp (modified) (24 diffs)
-
include/HardDiskImpl.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HardDiskImpl.cpp
r3320 r3411 139 139 HRESULT HardDisk::protectedInit (VirtualBox *aVirtualBox, HardDisk *aParent) 140 140 { 141 LogFlow Member (("HardDisk::protectedInit (aParent=%p)\n", aParent));141 LogFlowThisFunc (("aParent=%p\n", aParent)); 142 142 143 143 ComAssertRet (aVirtualBox, E_INVALIDARG); … … 168 168 void HardDisk::protectedUninit (AutoLock &alock) 169 169 { 170 LogFlow Member (("HardDisk::protectedUninit()\n"));170 LogFlowThisFunc (("\n")); 171 171 172 172 Assert (alock.belongsTo (this)); … … 1355 1355 CFGNODE aHDNode, CFGNODE aVDINode) 1356 1356 { 1357 LogFlow Member (("HVirtualDiskImage::init (load)\n"));1357 LogFlowThisFunc (("aHDNode=%p, aVDINode=%p\n", aHDNode, aVDINode)); 1358 1358 1359 1359 AssertReturn (aHDNode && aVDINode, E_FAIL); … … 1381 1381 CheckComRCBreakRC (rc); 1382 1382 1383 LogFlow Member (("'%ls'\n", mFilePathFull.raw()));1383 LogFlowThisFunc (("'%ls'\n", mFilePathFull.raw())); 1384 1384 1385 1385 /* load basic settings and children */ … … 1417 1417 const BSTR aFilePath, BOOL aRegistered /* = FALSE */) 1418 1418 { 1419 LogFlow Member (("HVirtualDiskImage::init (aFilePath='%ls', aRegistered=%d)\n",1420 aFilePath, aRegistered));1419 LogFlowThisFunc (("aFilePath='%ls', aRegistered=%d\n", 1420 aFilePath, aRegistered)); 1421 1421 1422 1422 AutoLock alock (this); … … 1484 1484 void HVirtualDiskImage::uninit() 1485 1485 { 1486 LogFlow Member (("HVirtualDiskImage::uninit()\n"));1486 LogFlowThisFunc (("\n")); 1487 1487 1488 1488 AutoLock alock (this); … … 1834 1834 /** 1835 1835 * Creates a clone of this hard disk by storing hard disk data in the given 1836 * VDI file name. 1837 * 1838 * @param aId UUID to assign to the created image 1839 * @param aTargetPath VDI file where the cloned image is to be to stored 1840 * @param aProgress progress object to run during operation 1836 * VDI file. 1837 * 1838 * If the operation fails, @a aDeleteTarget will be set to @c true unless the 1839 * failure happened because the target file already existed. 1840 * 1841 * @param aId UUID to assign to the created image. 1842 * @param aTargetPath VDI file where the cloned image is to be to stored. 1843 * @param aProgress progress object to run during operation. 1844 * @param aDeleteTarget Whether it is recommended to delete target on 1845 * failure or not. 1841 1846 */ 1842 1847 HRESULT 1843 1848 HVirtualDiskImage::cloneToImage (const Guid &aId, const Utf8Str &aTargetPath, 1844 Progress *aProgress) 1845 { 1849 Progress *aProgress, bool &aDeleteTarget) 1850 { 1851 /* normally, the target file should be deleted on error */ 1852 aDeleteTarget = true; 1853 1846 1854 AssertReturn (!aId.isEmpty(), E_FAIL); 1847 1855 AssertReturn (!aTargetPath.isNull(), E_FAIL); … … 1872 1880 alock.enter(); 1873 1881 releaseReader(); 1882 1883 /* We don't want to delete existing user files */ 1884 if (vrc == VERR_ALREADY_EXISTS) 1885 aDeleteTarget = false; 1874 1886 1875 1887 if (VBOX_SUCCESS (vrc)) … … 2068 2080 HRESULT HVirtualDiskImage::mergeImageToParent (Progress *aProgress) 2069 2081 { 2070 LogFlowMember (("HVirtualDiskImage::mergeImageToParent(): image='%ls'\n", 2071 mFilePathFull.raw())); 2082 LogFlowThisFunc (("mFilePathFull='%ls'\n", mFilePathFull.raw())); 2072 2083 2073 2084 AutoLock alock (this); … … 2183 2194 HRESULT HVirtualDiskImage::mergeImageToChildren (Progress *aProgress) 2184 2195 { 2185 LogFlowMember (("HVirtualDiskImage::mergeImageToChildren(): image='%ls'\n", 2186 mFilePathFull.raw())); 2196 LogFlowThisFunc (("mFilePathFull='%ls'\n", mFilePathFull.raw())); 2187 2197 2188 2198 AutoLock alock (this); … … 2671 2681 Utf8Str errorMsg; 2672 2682 2683 bool deleteTarget = true; 2684 2673 2685 if (task->operation == VDITask::CloneToImage) 2674 2686 { … … 2678 2690 rc = task->source->cloneToImage (task->vdi->id(), 2679 2691 Utf8Str (task->vdi->filePathFull()), 2680 task->progress );2692 task->progress, deleteTarget); 2681 2693 2682 2694 /* release reader added in HardDisk::CloneToImage() */ … … 2690 2702 progressCallback, 2691 2703 static_cast <Progress *> (task->progress)); 2704 2705 /* We don't want to delete existing user files */ 2706 if (vrc == VERR_ALREADY_EXISTS) 2707 deleteTarget = false; 2692 2708 2693 2709 if (VBOX_SUCCESS (vrc) && task->vdi->id()) … … 2733 2749 { 2734 2750 /* delete the target file so we don't have orphaned files */ 2735 RTFileDelete(Utf8Str (task->vdi->filePathFull())); 2751 if (deleteTarget) 2752 RTFileDelete(Utf8Str (task->vdi->filePathFull())); 2736 2753 2737 2754 task->vdi->mState = HVirtualDiskImage::NotCreated; … … 2794 2811 CFGNODE aHDNode, CFGNODE aISCSINode) 2795 2812 { 2796 LogFlow Member (("HISCSIHardDisk::init (load)\n"));2813 LogFlowThisFunc (("aHDNode=%p, aISCSINode=%p\n", aHDNode, aISCSINode)); 2797 2814 2798 2815 AssertReturn (aHDNode && aISCSINode, E_FAIL); … … 2827 2844 CFGLDRQueryBSTR (aISCSINode, "password", mPassword.asOutParam()); 2828 2845 2829 LogFlow Member (("'iscsi:%ls:%hu@%ls/%ls:%llu'\n",2830 mServer.raw(), mPort, mUserName.raw(), mTarget.raw(),2831 mLun));2846 LogFlowThisFunc (("'iscsi:%ls:%hu@%ls/%ls:%llu'\n", 2847 mServer.raw(), mPort, mUserName.raw(), mTarget.raw(), 2848 mLun)); 2832 2849 2833 2850 /* load basic settings and children */ … … 2860 2877 HRESULT HISCSIHardDisk::init (VirtualBox *aVirtualBox) 2861 2878 { 2862 LogFlow Member (("HISCSIHardDisk::init()\n"));2879 LogFlowThisFunc (("\n")); 2863 2880 2864 2881 AutoLock alock (this); … … 2898 2915 void HISCSIHardDisk::uninit() 2899 2916 { 2900 LogFlow Member (("HISCSIHardDisk::uninit()\n"));2917 LogFlowThisFunc (("\n")); 2901 2918 2902 2919 AutoLock alock (this); … … 3265 3282 /** 3266 3283 * Creates a clone of this hard disk by storing hard disk data in the given 3267 * VDI file name. 3268 * 3269 * @param aId UUID to assign to the created image 3270 * @param aTargetPath VDI file where the cloned image is to be to stored 3271 * @param aProgress progress object to run during operation 3284 * VDI file. 3285 * 3286 * If the operation fails, @a aDeleteTarget will be set to @c true unless the 3287 * failure happened because the target file already existed. 3288 * 3289 * @param aId UUID to assign to the created image. 3290 * @param aTargetPath VDI file where the cloned image is to be to stored. 3291 * @param aProgress progress object to run during operation. 3292 * @param aDeleteTarget Whether it is recommended to delete target on 3293 * failure or not. 3272 3294 */ 3273 3295 HRESULT 3274 3296 HISCSIHardDisk::cloneToImage (const Guid &aId, const Utf8Str &aTargetPath, 3275 Progress *aProgress )3297 Progress *aProgress, bool &aDeleteTarget) 3276 3298 { 3277 3299 ComAssertMsgFailed (("Not implemented")); … … 3377 3399 CFGNODE aHDNode, CFGNODE aVMDKNode) 3378 3400 { 3379 LogFlow Member (("HVMDKImage::init (load)\n"));3401 LogFlowThisFunc (("aHDNode=%p, aVMDKNode=%p\n", aHDNode, aVMDKNode)); 3380 3402 3381 3403 AssertReturn (aHDNode && aVMDKNode, E_FAIL); … … 3403 3425 CheckComRCBreakRC (rc); 3404 3426 3405 LogFlow Member (("'%ls'\n", mFilePathFull.raw()));3427 LogFlowThisFunc (("'%ls'\n", mFilePathFull.raw())); 3406 3428 3407 3429 /* load basic settings and children */ … … 3448 3470 const BSTR aFilePath, BOOL aRegistered /* = FALSE */) 3449 3471 { 3450 LogFlowMember (("HVMDKImage::init (aFilePath='%ls', aRegistered=%d)\n", 3451 aFilePath, aRegistered)); 3472 LogFlowThisFunc (("aFilePath='%ls', aRegistered=%d\n", aFilePath, aRegistered)); 3452 3473 3453 3474 AssertReturn (aParent == NULL, E_FAIL); … … 3520 3541 void HVMDKImage::uninit() 3521 3542 { 3522 LogFlow Member (("HVMDKImage::uninit()\n"));3543 LogFlowThisFunc (("\n")); 3523 3544 3524 3545 AutoLock alock (this); … … 3886 3907 /** 3887 3908 * Creates a clone of this hard disk by storing hard disk data in the given 3888 * VDI file name. 3889 * 3890 * @param aId UUID to assign to the created image 3891 * @param aTargetPath VDI file where the cloned image is to be to stored 3892 * @param aProgress progress object to run during operation 3909 * VDI file. 3910 * 3911 * If the operation fails, @a aDeleteTarget will be set to @c true unless the 3912 * failure happened because the target file already existed. 3913 * 3914 * @param aId UUID to assign to the created image. 3915 * @param aTargetPath VDI file where the cloned image is to be to stored. 3916 * @param aProgress progress object to run during operation. 3917 * @param aDeleteTarget Whether it is recommended to delete target on 3918 * failure or not. 3893 3919 */ 3894 3920 HRESULT 3895 3921 HVMDKImage::cloneToImage (const Guid &aId, const Utf8Str &aTargetPath, 3896 Progress *aProgress )3922 Progress *aProgress, bool &aDeleteTarget) 3897 3923 { 3898 3924 ComAssertMsgFailed (("Not implemented")); -
trunk/src/VBox/Main/include/HardDiskImpl.h
r3317 r3411 146 146 147 147 virtual HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath, 148 Progress *aProgress ) = 0;148 Progress *aProgress, bool &aDeleteTarget) = 0; 149 149 virtual HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath, 150 150 Progress *aProgress) = 0; … … 274 274 275 275 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath, 276 Progress *aProgress );276 Progress *aProgress, bool &aDeleteTarget); 277 277 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath, 278 278 Progress *aProgress); … … 403 403 404 404 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath, 405 Progress *aProgress );405 Progress *aProgress, bool &aDeleteTarget); 406 406 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath, 407 407 Progress *aProgress); … … 495 495 496 496 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath, 497 Progress *aProgress );497 Progress *aProgress, bool &aDeleteTarget); 498 498 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath, 499 499 Progress *aProgress);
Note:
See TracChangeset
for help on using the changeset viewer.

