Changeset 17033 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 23, 2009 8:12:10 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 43246
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r16960 r17033 315 315 { 316 316 RTPrintf("VBoxManage import <ovf>\n" 317 "\n"); // @todo 318 } 319 320 if (u64Cmd & USAGE_EXPORTAPPLIANCE) 321 { 322 RTPrintf("VBoxManage export <machines> -o <ovf>\n" 317 323 "\n"); 318 324 } … … 3007 3013 { "metrics", handleMetrics }, 3008 3014 { "import", handleImportAppliance }, 3015 { "export", handleExportAppliance }, 3009 3016 { NULL, NULL } 3010 3017 }; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r16485 r17033 87 87 #define USAGE_CONVERTHD RT_BIT_64(43) 88 88 #define USAGE_IMPORTAPPLIANCE RT_BIT_64(44) 89 #define USAGE_EXPORTAPPLIANCE RT_BIT_64(45) 89 90 #define USAGE_ALL (~(uint64_t)0) 90 91 /** @} */ … … 170 171 // VBoxManageImport.cpp 171 172 int handleImportAppliance(HandlerArg *a); 173 int handleExportAppliance(HandlerArg *a); 172 174 173 175 /* VBoxManageUSB.cpp */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r16834 r17033 98 98 Utf8Str strThisArg(a->argv[i]); 99 99 if ( (strThisArg == "--dry-run") 100 || (strThisArg == "-dry-run") 100 101 || (strThisArg == "-n") 101 102 ) … … 156 157 { 157 158 Bstr bstrOvfFilename(strOvfFilename); 158 ComPtr<IAppliance> appliance;159 CHECK_ERROR_BREAK(a->virtualBox, CreateAppliance( appliance.asOutParam()));160 161 CHECK_ERROR_BREAK( appliance, Read(bstrOvfFilename));159 ComPtr<IAppliance> pAppliance; 160 CHECK_ERROR_BREAK(a->virtualBox, CreateAppliance(pAppliance.asOutParam())); 161 162 CHECK_ERROR_BREAK(pAppliance, Read(bstrOvfFilename)); 162 163 163 164 RTPrintf("Interpreting %s... ", strOvfFilename.c_str()); 164 CHECK_ERROR_BREAK( appliance, Interpret());165 CHECK_ERROR_BREAK(pAppliance, Interpret()); 165 166 RTPrintf("OK.\n"); 166 167 167 168 // fetch all disks 168 169 com::SafeArray<BSTR> retDisks; 169 CHECK_ERROR_BREAK( appliance,170 CHECK_ERROR_BREAK(pAppliance, 170 171 COMGETTER(Disks)(ComSafeArrayAsOutParam(retDisks))); 171 172 if (retDisks.size() > 0) … … 179 180 // fetch virtual system descriptions 180 181 com::SafeIfaceArray<IVirtualSystemDescription> aVirtualSystemDescriptions; 181 CHECK_ERROR_BREAK( appliance,182 CHECK_ERROR_BREAK(pAppliance, 182 183 COMGETTER(VirtualSystemDescriptions)(ComSafeArrayAsOutParam(aVirtualSystemDescriptions))); 183 184 … … 469 470 { 470 471 ComPtr<IProgress> progress; 471 CHECK_ERROR_BREAK( appliance,472 CHECK_ERROR_BREAK(pAppliance, 472 473 ImportMachines(progress.asOutParam())); 473 474 … … 492 493 } 493 494 495 int handleExportAppliance(HandlerArg *a) 496 { 497 HRESULT rc = S_OK; 498 499 Utf8Str strOutputFile; 500 std::list< ComPtr<IMachine> > llMachines; 501 502 do 503 { 504 for (int i = 0; 505 i < a->argc; 506 ++i) 507 { 508 Utf8Str strThisArg(a->argv[i]); 509 510 if ( strThisArg == "--output" 511 || strThisArg == "-output" 512 || strThisArg == "-o" 513 ) 514 { 515 if (++i < a->argc) 516 { 517 if (strOutputFile.length()) 518 return errorSyntax(USAGE_EXPORTAPPLIANCE, "You can only specify --output once."); 519 else 520 strOutputFile = strThisArg; 521 } 522 else 523 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Missing argument to --output option."); 524 } 525 else 526 { 527 // must be machine: try UUID or name 528 ComPtr<IMachine> machine; 529 /* assume it's a UUID */ 530 rc = a->virtualBox->GetMachine(Guid(strThisArg), machine.asOutParam()); 531 if (FAILED(rc) || !machine) 532 { 533 /* must be a name */ 534 CHECK_ERROR_BREAK(a->virtualBox, FindMachine(Bstr(strThisArg), machine.asOutParam())); 535 } 536 537 if (machine) 538 llMachines.push_back(machine); 539 } 540 } 541 542 if (llMachines.size() == 0) 543 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Missing arguments to export command."); 544 545 ComPtr<IAppliance> pAppliance; 546 CHECK_ERROR_BREAK(a->virtualBox, CreateAppliance(pAppliance.asOutParam())); 547 548 std::list< ComPtr<IMachine> >::iterator itM; 549 for (itM = llMachines.begin(); 550 itM != llMachines.end(); 551 ++itM) 552 { 553 ComPtr<IMachine> pMachine = *itM; 554 CHECK_ERROR_BREAK(pMachine, Export(pAppliance)); 555 } 556 557 if (FAILED(rc)) 558 break; 559 560 CHECK_ERROR_BREAK(pAppliance, Write(Bstr(strOutputFile))); 561 562 } while (0); 563 564 return SUCCEEDED(rc) ? 0 : 1; 565 } 566 494 567 #endif /* !VBOX_ONLY_DOCS */
Note:
See TracChangeset
for help on using the changeset viewer.