儲存庫 vbox 的更動 16606
- 時間撮記:
- 2009-2-9 下午05:17:34 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r16601 r16606 51 51 /////////////////////////////////////////////////////////////////////////////// 52 52 53 typedef std::map<Utf8Str, Utf8Str> ArgsMap; // pairs of strings like "-vmname" => "newvmname" 54 typedef std::map<uint32_t, ArgsMap> ArgsMapsMap; // map of maps, one for each virtual system, sorted by index 53 typedef std::map<Utf8Str, Utf8Str> ArgsMap; // pairs of strings like "-vmname" => "newvmname" 54 typedef std::map<uint32_t, ArgsMap> ArgsMapsMap; // map of maps, one for each virtual system, sorted by index 55 56 typedef std::map<uint32_t, bool> IgnoresMap; // pairs of numeric description entry indices 57 typedef std::map<uint32_t, IgnoresMap> IgnoresMapsMap; // map of maps, one for each virtual system, sorted by index 55 58 56 59 static bool findArgValue(Utf8Str &strOut, 57 constArgsMap *pmapArgs,60 ArgsMap *pmapArgs, 58 61 const Utf8Str &strKey) 59 62 { 60 63 if (pmapArgs) 61 64 { 62 ArgsMap:: const_iterator it;65 ArgsMap::iterator it; 63 66 it = pmapArgs->find(strKey); 64 67 if (it != pmapArgs->end()) 65 68 { 66 69 strOut = it->second; 70 pmapArgs->erase(it); 67 71 return true; 68 72 } … … 85 89 // actually check whether they make sense semantically) 86 90 ArgsMapsMap mapArgsMapsPerVsys; 91 IgnoresMapsMap mapIgnoresMapsPerVsys; 87 92 88 93 for (int i = 0; … … 90 95 ++i) 91 96 { 97 bool fIsIgnore = false; 92 98 Utf8Str strThisArg(a->argv[i]); 93 99 if (strThisArg == "-exec") … … 98 104 { 99 105 uint32_t ulVsys; 100 if (VINF_SUCCESS == (rc = Utf8Str(a->argv[i]).toInt(ulVsys))) // don't use SUCCESS() macro, fail even on warnings 101 ulCurVsys = ulVsys; 102 else 106 if (VINF_SUCCESS != (rc = Utf8Str(a->argv[i]).toInt(ulVsys))) // don't use SUCCESS() macro, fail even on warnings 103 107 return errorSyntax(USAGE_IMPORTAPPLIANCE, "Argument to -vsys option must be a non-negative number."); 108 109 ulCurVsys = ulVsys; 104 110 } 105 111 else … … 109 115 || (strThisArg == "-vmname") 110 116 || (strThisArg == "-memory") 111 || ( strThisArg == "-ignore")117 || (fIsIgnore = (strThisArg == "-ignore")) 112 118 || (strThisArg.substr(0, 5) == "-type") 113 119 || (strThisArg.substr(0, 11) == "-controller") … … 117 123 return errorSyntax(USAGE_IMPORTAPPLIANCE, "Option \"%s\" requires preceding -vsys argument.", strThisArg.c_str()); 118 124 119 // store both this arg and the next one in the strings map for later parsing120 125 if (++i < a->argc) 121 mapArgsMapsPerVsys[ulCurVsys][strThisArg] = Utf8Str(a->argv[i]); 126 if (fIsIgnore) 127 { 128 uint32_t ulItem; 129 if (VINF_SUCCESS != Utf8Str(a->argv[i]).toInt(ulItem)) 130 return errorSyntax(USAGE_IMPORTAPPLIANCE, "Argument to -vsys option must be a non-negative number."); 131 132 mapIgnoresMapsPerVsys[ulCurVsys][ulItem] = true; 133 } 134 else 135 { 136 // store both this arg and the next one in the strings map for later parsing 137 mapArgsMapsPerVsys[ulCurVsys][strThisArg] = Utf8Str(a->argv[i]); 138 } 122 139 else 123 140 return errorSyntax(USAGE_IMPORTAPPLIANCE, "Missing argument to \"%s\" option.", strThisArg.c_str()); … … 197 214 198 215 // look up the corresponding command line options, if any 199 constArgsMap *pmapArgs = NULL;200 ArgsMapsMap:: const_iterator itm = mapArgsMapsPerVsys.find(i);216 ArgsMap *pmapArgs = NULL; 217 ArgsMapsMap::iterator itm = mapArgsMapsPerVsys.find(i); 201 218 if (itm != mapArgsMapsPerVsys.end()) 202 219 pmapArgs = &itm->second; 203 204 // ArgsMap::const_iterator it3;205 // for (it3 = pmapArgs->begin();206 // it3 != pmapArgs->end();207 // ++it3)208 // {209 // RTPrintf("%s -> %s\n", it3->first.c_str(), it3->second.c_str());210 // }211 // }212 213 // Bstr bstrVMName;214 // Bstr bstrOSType;215 220 216 221 // this collects the final values for setFinalValues() … … 225 230 226 231 Bstr bstrFinalValue = aConfigValues[a]; 232 233 bool fIgnoreThis = mapIgnoresMapsPerVsys[i][a]; 227 234 228 235 switch (t) … … 281 288 282 289 case VirtualSystemDescriptionType_HardDiskControllerIDE: 283 RTPrintf("%2d: IDE controller, type %ls" 284 "\n (disable with \"-vsys %d -ignore %d\")\n", 285 a, 286 aConfigValues[a], 287 i, a); 290 if (fIgnoreThis) 291 { 292 RTPrintf("%2d: IDE controller, type %ls -- disabled\n", 293 a, 294 aConfigValues[a]); 295 aEnabled[a] = false; 296 } 297 else 298 RTPrintf("%2d: IDE controller, type %ls" 299 "\n (disable with \"-vsys %d -ignore %d\")\n", 300 a, 301 aConfigValues[a], 302 i, a); 288 303 break; 289 304 290 305 case VirtualSystemDescriptionType_HardDiskControllerSATA: 291 RTPrintf("%2d: SATA controller, type %ls" 292 "\n (disable with \"-vsys %d -ignore %d\")\n", 293 a, 294 aConfigValues[a], 295 i, a); 306 if (fIgnoreThis) 307 { 308 RTPrintf("%2d: SATA controller, type %ls -- disabled\n", 309 a, 310 aConfigValues[a]); 311 aEnabled[a] = false; 312 } 313 else 314 RTPrintf("%2d: SATA controller, type %ls" 315 "\n (disable with \"-vsys %d -ignore %d\")\n", 316 a, 317 aConfigValues[a], 318 i, a); 296 319 break; 297 320 298 321 case VirtualSystemDescriptionType_HardDiskControllerSCSI: 299 RTPrintf("%2d: SCSI controller, type %ls" 300 "\n (change with \"-vsys %d -type%d={BusLogic|LsiLogic}\";" 301 "\n disable with \"-vsys %d -ignore %d\")\n", 302 a, 303 aConfigValues[a], 304 i, a, i, a); 322 if (fIgnoreThis) 323 { 324 RTPrintf("%2d: SCSI controller, type %ls -- disabled\n", 325 a, 326 aConfigValues[a]); 327 aEnabled[a] = false; 328 } 329 else 330 RTPrintf("%2d: SCSI controller, type %ls" 331 "\n (change with \"-vsys %d -type%d={BusLogic|LsiLogic}\";" // @todo 332 "\n disable with \"-vsys %d -ignore %d\")\n", 333 a, 334 aConfigValues[a], 335 i, a, i, a); 305 336 break; 306 337 307 338 case VirtualSystemDescriptionType_HardDiskImage: 308 RTPrintf("%2d: Hard disk image: source image=%ls, target path=%ls, %ls" 309 "\n (change controller with \"-vsys %d -controller%d=<id>\";" 310 "\n disable with \"-vsys %d -ignore %d\")\n", 311 a, 312 aOrigValues[a], 313 aConfigValues[a], 314 aExtraConfigValues[a], 315 i, a, i, a); 339 if (fIgnoreThis) 340 { 341 RTPrintf("%2d: Hard disk image: source image=%ls -- disabled\n", 342 a, 343 aOrigValues[a]); 344 aEnabled[a] = false; 345 } 346 else 347 RTPrintf("%2d: Hard disk image: source image=%ls, target path=%ls, %ls" 348 "\n (change controller with \"-vsys %d -controller%d=<id>\";" // @todo 349 "\n disable with \"-vsys %d -ignore %d\")\n", 350 a, 351 aOrigValues[a], 352 aConfigValues[a], 353 aExtraConfigValues[a], 354 i, a, i, a); 316 355 break; 317 356 318 357 case VirtualSystemDescriptionType_CDROM: 319 RTPrintf("%2d: CD-ROM" 320 "\n (disable with \"-vsys %d -ignore %d\")\n", 321 a, i, a); 358 if (fIgnoreThis) 359 { 360 RTPrintf("%2d: CD-ROM -- disabled\n", 361 a); 362 aEnabled[a] = false; 363 } 364 else 365 RTPrintf("%2d: CD-ROM" 366 "\n (disable with \"-vsys %d -ignore %d\")\n", 367 a, i, a); 322 368 break; 323 369 324 370 case VirtualSystemDescriptionType_Floppy: 325 RTPrintf("%2d: Floppy" 326 "\n (disable with \"-vsys %d -ignore %d\")\n", 327 a, i, a); 371 if (fIgnoreThis) 372 { 373 RTPrintf("%2d: Floppy -- disabled\n", 374 a); 375 aEnabled[a] = false; 376 } 377 else 378 RTPrintf("%2d: Floppy" 379 "\n (disable with \"-vsys %d -ignore %d\")\n", 380 a, i, a); 328 381 break; 329 382 330 383 case VirtualSystemDescriptionType_NetworkAdapter: 331 RTPrintf("%2d: Network adapter: orig %ls, config %ls, extra %ls\n", 384 RTPrintf("%2d: Network adapter: orig %ls, config %ls, extra %ls\n", // @todo 332 385 a, 333 386 aOrigValues[a], … … 337 390 338 391 case VirtualSystemDescriptionType_USBController: 339 RTPrintf("%2d: USB controller" 340 "\n (disable with \"-vsys %d -ignore %d\")\n", 341 a, i, a); 392 if (fIgnoreThis) 393 { 394 RTPrintf("%2d: USB controller -- disabled\n", 395 a); 396 aEnabled[a] = false; 397 } 398 else 399 RTPrintf("%2d: USB controller" 400 "\n (disable with \"-vsys %d -ignore %d\")\n", 401 a, i, a); 342 402 break; 343 403 344 404 case VirtualSystemDescriptionType_SoundCard: 345 RTPrintf("%2d: Sound card (appliance expects \"%ls\", can change on import)" 346 "\n (disable with \"-vsys %d -ignore %d\")\n", 347 a, 348 aOrigValues[a], 349 i, 350 a); 405 if (fIgnoreThis) 406 { 407 RTPrintf("%2d: Sound card \"%ls\" -- disabled\n", 408 a, 409 aOrigValues[a]); 410 aEnabled[a] = false; 411 } 412 else 413 RTPrintf("%2d: Sound card (appliance expects \"%ls\", can change on import)" 414 "\n (disable with \"-vsys %d -ignore %d\")\n", 415 a, 416 aOrigValues[a], 417 i, 418 a); 351 419 break; 352 420 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器