Changeset 91161 in vbox
- Timestamp:
- Sep 8, 2021 3:05:23 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146815
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloudMachine.cpp
r91157 r91161 34 34 const ComPtr<ICloudProvider> &pProvider, 35 35 const char *pszProviderName); 36 static int getCloudClient(ComPtr<ICloudClient> &aClient, 37 HandlerArg *a, 38 const char *pcszProviderName, 39 const char *pcszProfileName); 36 40 37 41 static RTEXITCODE handleCloudMachineImpl(HandlerArg *a, int iFirst, 38 const ComPtr<ICloud Profile> &pProfile);42 const ComPtr<ICloudClient> &pClient); 39 43 40 44 static RTEXITCODE handleCloudMachineConsoleHistory(HandlerArg *a, int iFirst, 41 const ComPtr<ICloud Profile> &pProfile);45 const ComPtr<ICloudClient> &pClient); 42 46 static RTEXITCODE listCloudMachinesImpl(HandlerArg *a, int iFirst, 43 const ComPtr<ICloud Profile> &pProfile);47 const ComPtr<ICloudClient> &pClient); 44 48 static RTEXITCODE handleCloudMachineInfo(HandlerArg *a, int iFirst, 45 const ComPtr<ICloud Profile> &pProfile);49 const ComPtr<ICloudClient> &pClient); 46 50 47 51 static HRESULT printMachineInfo(const ComPtr<ICloudMachine> &pMachine); … … 70 74 * in handleCloud). 71 75 */ 72 static int73 getCloudProfile(ComPtr<ICloudProfile> &aProfile,74 HandlerArg *a,75 const char *pcszProviderName,76 const char *pcszProfileName)77 {78 int rc;79 80 ComPtr<ICloudProvider> pProvider;81 rc = selectCloudProvider(pProvider, a->virtualBox, pcszProviderName);82 if (RT_FAILURE(rc))83 return rc;84 85 ComPtr<ICloudProfile> pProfile;86 rc = selectCloudProfile(pProfile, pProvider, pcszProfileName);87 if (RT_FAILURE(rc))88 return rc;89 90 aProfile = pProfile;91 return VINF_SUCCESS;92 }93 94 95 76 RTEXITCODE 96 77 handleCloudMachine(HandlerArg *a, int iFirst, … … 98 79 const char *pcszProfileName) 99 80 { 100 ComPtr<ICloud Profile> pProfile;101 int rc = getCloud Profile(pProfile, a, pcszProviderName, pcszProfileName);81 ComPtr<ICloudClient> pClient; 82 int rc = getCloudClient(pClient, a, pcszProviderName, pcszProfileName); 102 83 if (RT_FAILURE(rc)) 103 84 return RTEXITCODE_FAILURE; 104 85 105 return handleCloudMachineImpl(a, iFirst, p Profile);86 return handleCloudMachineImpl(a, iFirst, pClient); 106 87 } 107 88 … … 235 216 236 217 218 static int 219 getCloudClient(ComPtr<ICloudClient> &aCloudClient, 220 HandlerArg *a, 221 const char *pcszProviderName, 222 const char *pcszProfileName) 223 { 224 HRESULT hrc; 225 int rc; 226 227 ComPtr<ICloudProvider> pProvider; 228 rc = selectCloudProvider(pProvider, a->virtualBox, pcszProviderName); 229 if (RT_FAILURE(rc)) 230 return rc; 231 232 ComPtr<ICloudProfile> pProfile; 233 rc = selectCloudProfile(pProfile, pProvider, pcszProfileName); 234 if (RT_FAILURE(rc)) 235 return rc; 236 237 ComPtr<ICloudClient> pCloudClient; 238 CHECK_ERROR2_RET(hrc, pProfile, 239 CreateCloudClient(pCloudClient.asOutParam()), 240 VERR_GENERAL_FAILURE); 241 242 aCloudClient = pCloudClient; 243 return VINF_SUCCESS; 244 } 245 246 237 247 static HRESULT 238 248 getMachineById(ComPtr<ICloudMachine> &pMachineOut, 239 const ComPtr<ICloud Profile> &pProfile,249 const ComPtr<ICloudClient> &pClient, 240 250 const char *pcszStrId) 241 251 { 242 252 HRESULT hrc; 243 253 244 ComPtr<ICloudClient> pCloudClient;245 CHECK_ERROR2_RET(hrc, pProfile,246 CreateCloudClient(pCloudClient.asOutParam()), hrc);247 248 254 ComPtr<ICloudMachine> pMachine; 249 CHECK_ERROR2_RET(hrc, pCl oudClient,255 CHECK_ERROR2_RET(hrc, pClient, 250 256 GetCloudMachine(com::Bstr(pcszStrId).raw(), 251 257 pMachine.asOutParam()), hrc); … … 284 290 static RTEXITCODE 285 291 handleCloudMachineImpl(HandlerArg *a, int iFirst, 286 const ComPtr<ICloud Profile> &pProfile)292 const ComPtr<ICloudClient> &pClient) 287 293 { 288 294 /* … … 325 331 { 326 332 case kMachine_ConsoleHistory: 327 return handleCloudMachineConsoleHistory(a, OptState.iNext, p Profile);333 return handleCloudMachineConsoleHistory(a, OptState.iNext, pClient); 328 334 329 335 case kMachine_Info: 330 return handleCloudMachineInfo(a, OptState.iNext, p Profile);336 return handleCloudMachineInfo(a, OptState.iNext, pClient); 331 337 332 338 case kMachine_List: 333 return listCloudMachinesImpl(a, OptState.iNext, p Profile);339 return listCloudMachinesImpl(a, OptState.iNext, pClient); 334 340 335 341 … … 368 374 int rc; 369 375 370 ComPtr<ICloud Provider> pProvider;371 rc = selectCloudProvider(pProvider, a->virtualBox, pcszProviderName);376 ComPtr<ICloudClient> pClient; 377 rc = getCloudClient(pClient, a, pcszProviderName, pcszProfileName); 372 378 if (RT_FAILURE(rc)) 373 379 return RTEXITCODE_FAILURE; 374 380 375 ComPtr<ICloudProfile> pProfile; 376 rc = selectCloudProfile(pProfile, pProvider, pcszProfileName); 377 if (RT_FAILURE(rc)) 378 return RTEXITCODE_FAILURE; 379 380 return listCloudMachinesImpl(a, iFirst, pProfile); 381 return listCloudMachinesImpl(a, iFirst, pClient); 381 382 } 382 383 … … 388 389 static RTEXITCODE 389 390 listCloudMachinesImpl(HandlerArg *a, int iFirst, 390 const ComPtr<ICloud Profile> &pProfile)391 const ComPtr<ICloudClient> &pClient) 391 392 { 392 393 /* … … 448 449 } 449 450 450 ComPtr<ICloudClient> pClient;451 CHECK_ERROR2_RET(hrc, pProfile,452 CreateCloudClient(pClient.asOutParam()),453 RTEXITCODE_FAILURE);454 455 451 ComPtr<IProgress> pListProgress; 456 452 CHECK_ERROR2_RET(hrc, pClient, … … 554 550 const char *pcszProfileName) 555 551 { 556 ComPtr<ICloudProfile> pProfile; 557 int rc = getCloudProfile(pProfile, a, pcszProviderName, pcszProfileName); 552 int rc; 553 554 ComPtr<ICloudClient> pClient; 555 rc = getCloudClient(pClient, a, pcszProviderName, pcszProfileName); 558 556 if (RT_FAILURE(rc)) 559 557 return RTEXITCODE_FAILURE; 560 558 561 return handleCloudMachineInfo(a, iFirst, p Profile);559 return handleCloudMachineInfo(a, iFirst, pClient); 562 560 } 563 561 … … 568 566 static RTEXITCODE 569 567 handleCloudMachineInfo(HandlerArg *a, int iFirst, 570 const ComPtr<ICloud Profile> &pProfile)568 const ComPtr<ICloudClient> &pClient) 571 569 { 572 570 HRESULT hrc; … … 584 582 { 585 583 ComPtr<ICloudMachine> pMachine; 586 hrc = getMachineById(pMachine, p Profile, a->argv[i]);584 hrc = getMachineById(pMachine, pClient, a->argv[i]); 587 585 if (FAILED(hrc)) 588 586 return RTEXITCODE_FAILURE; … … 831 829 static RTEXITCODE 832 830 handleCloudMachineConsoleHistory(HandlerArg *a, int iFirst, 833 const ComPtr<ICloud Profile> &pProfile)831 const ComPtr<ICloudClient> &pClient) 834 832 { 835 833 HRESULT hrc; … … 852 850 853 851 ComPtr<ICloudMachine> pMachine; 854 hrc = getMachineById(pMachine, p Profile, a->argv[iFirst]);852 hrc = getMachineById(pMachine, pClient, a->argv[iFirst]); 855 853 if (FAILED(hrc)) 856 854 return RTEXITCODE_FAILURE;
Note:
See TracChangeset
for help on using the changeset viewer.