Changeset 70674 in vbox
- Timestamp:
- Jan 22, 2018 12:00:30 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120410
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp
r70648 r70674 375 375 } 376 376 377 /** weak VirtualBox parent */ 378 VirtualBox* const pVirtualBox = NULL; 379 unconst(pVirtualBox) = m_pMachine->i_getVirtualBox(); 380 rc = m_pProgress->init(pVirtualBox, 381 static_cast<IMachine*>(m_pMachine) /* aInitiator */, 382 Bstr(m_pMachine->tr("Moving Machine")).raw(), 383 true /* fCancellable */, 384 uCount, 385 uTotalWeight, 386 Bstr(m_pMachine->tr("Initialize Moving")).raw(), 387 1); 388 if (FAILED(rc)) 389 { 390 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, 391 m_pMachine->tr("Couldn't correctly setup the progress object for moving VM operation (%Rrc)"), 392 rc); 377 /* Init both Progress instances */ 378 { 379 /** weak VirtualBox parent */ 380 VirtualBox* const pVirtualBox = NULL; 381 unconst(pVirtualBox) = m_pMachine->i_getVirtualBox(); 382 rc = m_pProgress->init(pVirtualBox, 383 static_cast<IMachine*>(m_pMachine) /* aInitiator */, 384 Bstr(m_pMachine->tr("Moving Machine")).raw(), 385 true /* fCancellable */, 386 uCount, 387 uTotalWeight, 388 Bstr(m_pMachine->tr("Initialize Moving")).raw(), 389 1); 390 if (FAILED(rc)) 391 { 392 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, 393 m_pMachine->tr("Couldn't correctly setup the progress object " 394 "for moving VM operation (%Rrc)"), 395 rc); 396 } 397 398 m_pRollBackProgress.createObject(); 399 rc = m_pRollBackProgress->init(pVirtualBox, 400 static_cast<IMachine*>(m_pMachine) /* aInitiator */, 401 Bstr(m_pMachine->tr("Moving back Machine")).raw(), 402 true /* fCancellable */, 403 uCount, 404 uTotalWeight, 405 Bstr(m_pMachine->tr("Initialize Moving back")).raw(), 406 1); 407 if (FAILED(rc)) 408 { 409 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, 410 m_pMachine->tr("Couldn't correctly setup the progress object " 411 "for possible rollback operation during moving VM (%Rrc)"), 412 rc); 413 } 393 414 } 394 415 … … 511 532 512 533 AutoCaller autoCaller(machine); 513 534 // if (FAILED(autoCaller.rc())) return;//Should we return something here? 514 535 515 536 Utf8Str strTargetFolder = taskMoveVM->m_targetPath; … … 852 873 Bstr bstrSrcName; 853 874 875 rc = pMedium->COMGETTER(Name)(bstrSrcName.asOutParam()); 876 if (FAILED(rc)) throw rc; 877 854 878 if (strTargetFolder != NULL && !strTargetFolder->isEmpty()) 855 879 { … … 869 893 870 894 strTargetImageName.append(RTPATH_DELIMITER).append(strLocation); 871 } 872 else 873 { 874 strTargetImageName = mt.strBaseName;//Should contain full path to the image 875 } 876 877 rc = pMedium->COMGETTER(Name)(bstrSrcName.asOutParam()); 878 if (FAILED(rc)) throw rc; 879 880 rc = m_pProgress->SetNextOperation(BstrFmt(machine->tr("Moving Disk '%ls' ..."), 895 rc = m_pProgress->SetNextOperation(BstrFmt(machine->tr("Moving Disk '%ls' ..."), 881 896 bstrSrcName.raw()).raw(), 882 897 mt.uWeight); 883 if (FAILED(rc)) throw rc; 898 if (FAILED(rc)) throw rc; 899 } 900 else 901 { 902 strTargetImageName = mt.strBaseName;//Should contain full path to the image 903 rc = m_pRollBackProgress->SetNextOperation(BstrFmt(machine->tr("Moving back Disk '%ls' ..."), 904 bstrSrcName.raw()).raw(), 905 mt.uWeight); 906 if (FAILED(rc)) throw rc; 907 } 908 909 884 910 885 911 /* consistency: use \ if appropriate on the platform */ … … 893 919 /* Wait until the async process has finished. */ 894 920 machineLock.release(); 895 rc = m_pProgress->WaitForAsyncProgressCompletion(moveDiskProgress); 921 if (strTargetFolder != NULL && !strTargetFolder->isEmpty()) 922 { 923 rc = m_pProgress->WaitForAsyncProgressCompletion(moveDiskProgress); 924 } 925 else 926 { 927 rc = m_pRollBackProgress->WaitForAsyncProgressCompletion(moveDiskProgress); 928 } 929 896 930 machineLock.acquire(); 897 931 if (FAILED(rc)) throw rc;
Note:
See TracChangeset
for help on using the changeset viewer.