Changeset 37929 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Jul 13, 2011 6:34:49 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r37925 r37929 458 458 "VBoxManage storageattach <uuid|vmname>\n" 459 459 " --storagectl <name>\n" 460 " --port <number>\n"460 " [--port <number>]\n" 461 461 " [--device <number>]\n" 462 462 " [--type dvddrive|hdd|fdd]\n" … … 475 475 " [--server <name>|<ip>]\n" 476 476 " [--target <target>]\n" 477 " [-- port <port>]\n"477 " [--tport <port>]\n" 478 478 " [--lun <lun>]\n" 479 479 " [--encodedlun <lun>]\n" -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r37925 r37929 62 62 { "--server", 'S', RTGETOPT_REQ_STRING }, 63 63 { "--target", 'T', RTGETOPT_REQ_STRING }, 64 { "-- port",'P', RTGETOPT_REQ_STRING },64 { "--tport", 'P', RTGETOPT_REQ_STRING }, 65 65 { "--lun", 'L', RTGETOPT_REQ_STRING }, 66 66 { "--encodedlun", 'E', RTGETOPT_REQ_STRING }, … … 75 75 HRESULT rc = S_OK; 76 76 ULONG port = ~0U; 77 ULONG device = 0; /* device is optional, default is 0 */77 ULONG device = ~0U; 78 78 bool fForceUnmount = false; 79 79 bool fSetMediumType = false; … … 239 239 break; 240 240 241 case 'P': // -- port241 case 'P': // --tport 242 242 bstrPort = ValueUnion.psz; 243 243 break; … … 286 286 if (!pszCtl) 287 287 return errorSyntax(USAGE_STORAGEATTACH, "Storage controller name not specified"); 288 if (port == ~0U)289 return errorSyntax(USAGE_STORAGEATTACH, "Port not specified");290 288 291 289 /* get the virtualbox system properties */ … … 317 315 if (FAILED(rc)) 318 316 throw Utf8StrFmt("Could not find a controller named '%s'\n", pszCtl); 317 318 StorageBus_T storageBus = StorageBus_Null; 319 CHECK_ERROR_RET(storageCtl, COMGETTER(Bus)(&storageBus), 1); 320 ULONG maxPorts = 0; 321 CHECK_ERROR_RET(systemProperties, GetMaxPortCountForStorageBus(storageBus, &maxPorts), 1); 322 ULONG maxDevices = 0; 323 CHECK_ERROR_RET(systemProperties, GetMaxDevicesPerPortForStorageBus(storageBus, &maxDevices), 1); 324 325 if (port == ~0U) 326 { 327 if (maxPorts == 1) 328 port = 0; 329 else 330 return errorSyntax(USAGE_STORAGEATTACH, "Port not specified"); 331 } 332 if (device == ~0U) 333 { 334 if (maxDevices == 1) 335 device = 0; 336 else 337 return errorSyntax(USAGE_STORAGEATTACH, "Device not specified"); 338 } 319 339 320 340 /* for sata controller check if the port count is big enough … … 376 396 else 377 397 { 378 StorageBus_T storageBus = StorageBus_Null;379 398 DeviceType_T deviceType = DeviceType_Null; 380 399 com::SafeArray <DeviceType_T> saDeviceTypes; … … 382 401 383 402 /* check if the device type is supported by the controller */ 384 CHECK_ERROR(storageCtl, COMGETTER(Bus)(&storageBus));385 403 CHECK_ERROR(systemProperties, GetDeviceTypesForStorageBus(storageBus, ComSafeArrayAsOutParam(saDeviceTypes))); 386 404 for (size_t i = 0; i < saDeviceTypes.size(); ++ i) … … 461 479 /* check if the device type is supported by the controller */ 462 480 { 463 StorageBus_T storageBus = StorageBus_Null;464 481 com::SafeArray <DeviceType_T> saDeviceTypes; 465 482 466 CHECK_ERROR(storageCtl, COMGETTER(Bus)(&storageBus));467 483 CHECK_ERROR(systemProperties, GetDeviceTypesForStorageBus(storageBus, ComSafeArrayAsOutParam(saDeviceTypes))); 468 484 if (SUCCEEDED(rc))
Note:
See TracChangeset
for help on using the changeset viewer.