Changeset 37449 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 14, 2011 4:34:16 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 72256
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r37272 r37449 334 334 RTStrmPrintf(pStrm, 335 335 "VBoxManage clonevm <uuid>|<name>\n" 336 " [--snapshot <uuid>|<name>]\n" 336 337 " [--name <name>]\n" 337 338 " [--basefolder <basefolder>]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r37118 r37449 270 270 static const RTGETOPTDEF g_aCloneVMOptions[] = 271 271 { 272 { "--snapshot", 's', RTGETOPT_REQ_STRING }, 272 273 { "--name", 'n', RTGETOPT_REQ_STRING }, 274 { "--mode", 'm', RTGETOPT_REQ_STRING }, 273 275 { "--register", 'r', RTGETOPT_REQ_NOTHING }, 274 276 { "--basefolder", 'p', RTGETOPT_REQ_STRING }, … … 276 278 }; 277 279 280 static int parseCloneMode(const char *psz, CloneMode_T *pMode) 281 { 282 if (!RTStrICmp(psz, "machine")) 283 *pMode = CloneMode_MachineState; 284 else if (!RTStrICmp(psz, "machineandchilds")) 285 *pMode = CloneMode_MachineAndChildStates; 286 else if (!RTStrICmp(psz, "all")) 287 *pMode = CloneMode_AllStates; 288 else 289 return VERR_PARSE_ERROR; 290 291 return VINF_SUCCESS; 292 } 293 278 294 int handleCloneVM(HandlerArg *a) 279 295 { 280 HRESULT rc;296 HRESULT rc; 281 297 const char *pszSrcName = NULL; 298 const char *pszSnapshotName = NULL; 299 CloneMode_T mode = CloneMode_MachineState; 282 300 const char *pszTrgName = NULL; 283 301 const char *pszTrgBaseFolder = NULL; 284 bool fRegister= false;285 RTUUID trgUuid;302 bool fRegister = false; 303 RTUUID trgUuid; 286 304 287 305 int c; … … 295 313 switch (c) 296 314 { 315 case 's': // --snapshot 316 pszSnapshotName = ValueUnion.psz; 317 break; 318 319 case 'm': // --mode 320 if (RT_FAILURE(parseCloneMode(ValueUnion.psz, &mode))) 321 return errorArgument("Invalid clone mode '%s'\n", ValueUnion.psz); 322 break; 323 297 324 case 'n': // --name 298 325 pszTrgName = ValueUnion.psz; … … 324 351 } 325 352 326 /* ~heck for required options */353 /* Check for required options */ 327 354 if (!pszSrcName) 328 355 return errorSyntax(USAGE_CLONEVM, "VM name required"); 329 356 357 /* Get the machine object */ 330 358 ComPtr<IMachine> srcMachine; 331 359 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(pszSrcName).raw(), … … 333 361 RTEXITCODE_FAILURE); 334 362 363 /* If a snapshot name/uuid was given, get the particular machine of this 364 * snapshot. */ 365 if (pszSnapshotName) 366 { 367 ComPtr<ISnapshot> srcSnapshot; 368 CHECK_ERROR_RET(srcMachine, FindSnapshot(Bstr(pszSnapshotName).raw(), 369 srcSnapshot.asOutParam()), 370 RTEXITCODE_FAILURE); 371 CHECK_ERROR_RET(srcSnapshot, COMGETTER(Machine)(srcMachine.asOutParam()), 372 RTEXITCODE_FAILURE); 373 } 374 335 375 /* Default name necessary? */ 336 376 if (!pszTrgName) 337 pszTrgName = RTStrAPrintf2("%s C opy", pszSrcName);377 pszTrgName = RTStrAPrintf2("%s Clone", pszSrcName); 338 378 339 379 Bstr bstrSettingsFile; … … 354 394 ComPtr<IProgress> progress; 355 395 CHECK_ERROR_RET(srcMachine, CloneTo(trgMachine, 396 mode, 356 397 FALSE, 357 398 progress.asOutParam()),
Note:
See TracChangeset
for help on using the changeset viewer.