Changeset 25755 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 12, 2010 11:59:39 AM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r25702 r25755 356 356 " delete <uuid>|<name> |\n" 357 357 " restore <uuid>|<name> |\n" 358 " restorecurrent |\n" 358 359 " edit <uuid>|<name>|--current\n" 359 360 " [--name <name>]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
r25019 r25755 253 253 254 254 /* switch based on the command */ 255 bool fDelete = false, fRestore = false; 255 bool fDelete = false, 256 fRestore = false, 257 fRestoreCurrent = false; 258 256 259 if (!strcmp(a->argv[1], "take")) 257 260 { … … 339 342 else if ( (fDelete = !strcmp(a->argv[1], "delete")) 340 343 || (fRestore = !strcmp(a->argv[1], "restore")) 344 || (fRestoreCurrent = !strcmp(a->argv[1], "restorecurrent")) 341 345 ) 342 346 { 347 if (fRestoreCurrent) 348 { 349 if (a->argc > 2) 350 { 351 errorSyntax(USAGE_SNAPSHOT, "Too many arguments"); 352 rc = E_FAIL; 353 break; 354 } 355 } 343 356 /* exactly one parameter: snapshot name */ 344 if (a->argc != 3)357 else if (a->argc != 3) 345 358 { 346 359 errorSyntax(USAGE_SNAPSHOT, "Expecting snapshot name only"); … … 350 363 351 364 ComPtr<ISnapshot> pSnapshot; 352 353 /* assume it's a UUID */ 354 Bstr guidSnap(a->argv[2]); 355 if (!guidSnap.isEmpty()) 356 { 357 CHECK_ERROR_BREAK(pMachine, GetSnapshot(guidSnap, pSnapshot.asOutParam())); 365 ComPtr<IProgress> pProgress; 366 Bstr bstrSnapGuid; 367 368 if (fRestoreCurrent) 369 { 370 CHECK_ERROR_BREAK(pMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam())); 371 CHECK_ERROR_BREAK(pSnapshot, COMGETTER(Id)(bstrSnapGuid.asOutParam())); 358 372 } 359 373 else 360 374 { 361 /* then it must be a name */ 362 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]), pSnapshot.asOutParam())); 363 pSnapshot->COMGETTER(Id)(guidSnap.asOutParam()); 364 } 365 366 ComPtr<IProgress> pProgress; 375 // restore or delete snapshot: then resolve cmd line argument to snapshot instance 376 // assume it's a UUID 377 bstrSnapGuid = a->argv[2]; 378 if (FAILED(pMachine->GetSnapshot(bstrSnapGuid, pSnapshot.asOutParam()))) 379 { 380 // then it must be a name 381 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]), pSnapshot.asOutParam())); 382 CHECK_ERROR_BREAK(pSnapshot, COMGETTER(Id)(bstrSnapGuid.asOutParam())); 383 } 384 } 385 367 386 if (fDelete) 368 387 { 369 CHECK_ERROR_BREAK(console, DeleteSnapshot( guidSnap, pProgress.asOutParam()));388 CHECK_ERROR_BREAK(console, DeleteSnapshot(bstrSnapGuid, pProgress.asOutParam())); 370 389 } 371 390 else 372 391 { 373 // must be restore 392 // restore or restore current 393 RTPrintf("Restoring snapshot %ls\n", bstrSnapGuid.raw()); 374 394 CHECK_ERROR_BREAK(console, RestoreSnapshot(pSnapshot, pProgress.asOutParam())); 375 395 }
Note:
See TracChangeset
for help on using the changeset viewer.