- Timestamp:
- May 24, 2019 7:28:12 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloud.cpp
r78148 r78734 43 43 typedef struct 44 44 { 45 const char *pszProviderName; 46 const char *pszProfileName; 45 struct { 46 const char *pszProviderName; 47 ComPtr<ICloudProvider> pCloudProvider; 48 }provider; 49 struct { 50 const char *pszProfileName; 51 ComPtr<ICloudProfile> pCloudProfile; 52 }profile; 53 47 54 } CLOUDCOMMONOPT; 48 55 typedef CLOUDCOMMONOPT *PCLOUDCOMMONOPT; 56 57 static HRESULT checkAndSetCommonOptions(HandlerArg *a, PCLOUDCOMMONOPT pCommonOpts) 58 { 59 HRESULT hrc = S_OK; 60 61 Bstr bstrProvider(pCommonOpts->provider.pszProviderName); 62 Bstr bstrProfile(pCommonOpts->profile.pszProfileName); 63 64 /* check for required options */ 65 if (bstrProvider.isEmpty()) 66 { 67 errorSyntax(USAGE_S_NEWCMD, "Parameter --provider is required"); 68 return E_FAIL; 69 } 70 if (bstrProfile.isEmpty()) 71 { 72 errorSyntax(USAGE_S_NEWCMD, "Parameter --profile is required"); 73 return E_FAIL; 74 } 75 76 ComPtr<IVirtualBox> pVirtualBox = a->virtualBox; 77 ComPtr<ICloudProviderManager> pCloudProviderManager; 78 CHECK_ERROR2_RET(hrc, pVirtualBox, 79 COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()), 80 RTEXITCODE_FAILURE); 81 82 ComPtr<ICloudProvider> pCloudProvider; 83 CHECK_ERROR2_RET(hrc, pCloudProviderManager, 84 GetProviderByShortName(bstrProvider.raw(), pCloudProvider.asOutParam()), 85 RTEXITCODE_FAILURE); 86 pCommonOpts->provider.pCloudProvider = pCloudProvider; 87 88 ComPtr<ICloudProfile> pCloudProfile; 89 CHECK_ERROR2_RET(hrc, pCloudProvider, 90 GetProfileByName(bstrProfile.raw(), pCloudProfile.asOutParam()), 91 RTEXITCODE_FAILURE); 92 pCommonOpts->profile.pCloudProfile = pCloudProfile; 93 94 return hrc; 95 } 49 96 50 97 /** … … 94 141 95 142 CHECK_ERROR2_RET(hrc, pCloudProviderManager, 96 GetProviderByShortName(Bstr(pCommonOpts->p szProviderName).raw(), pCloudProvider.asOutParam()),143 GetProviderByShortName(Bstr(pCommonOpts->provider.pszProviderName).raw(), pCloudProvider.asOutParam()), 97 144 RTEXITCODE_FAILURE); 98 145 ComPtr<ICloudProfile> pCloudProfile; 99 146 100 147 CHECK_ERROR2_RET(hrc, pCloudProvider, 101 GetProfileByName(Bstr(pCommonOpts->p szProfileName).raw(), pCloudProfile.asOutParam()),148 GetProfileByName(Bstr(pCommonOpts->profile.pszProfileName).raw(), pCloudProfile.asOutParam()), 102 149 RTEXITCODE_FAILURE); 103 150 … … 111 158 { 112 159 RTPrintf("Parameter \'compartment\' is empty or absent.\n" 113 "Trying to get the compartment from the passed cloud profile \'%s\'\n", pCommonOpts->p szProfileName);160 "Trying to get the compartment from the passed cloud profile \'%s\'\n", pCommonOpts->profile.pszProfileName); 114 161 Bstr bStrCompartmentId; 115 162 CHECK_ERROR2_RET(hrc, pCloudProfile, … … 117 164 RTEXITCODE_FAILURE); 118 165 strCompartmentId = bStrCompartmentId; 119 RTPrintf("Found the compartment \'%s\':\n", strCompartmentId.c_str()); 166 if (strCompartmentId.isNotEmpty()) 167 RTPrintf("Found the compartment \'%s\':\n", strCompartmentId.c_str()); 168 else 169 return errorSyntax(USAGE_S_NEWCMD, "Parameter --compartment-id is required"); 120 170 } 121 171 … … 152 202 RTEXITCODE_FAILURE); 153 203 154 RTPrintf("List of availableinstances for the cloud profile \'%ls\' \nand compartment \'%s\':\n",204 RTPrintf("List of running instances for the cloud profile \'%ls\' \nand compartment \'%s\':\n", 155 205 bstrProfileName.raw(), strCompartmentId.c_str()); 156 206 size_t cIds = arrayVMIds.size(); … … 185 235 RTEXITCODE_FAILURE); 186 236 237 RTPrintf("List of paused instances for the cloud profile \'%ls\' \nand compartment \'%s\':\n", 238 bstrProfileName.raw(), strCompartmentId.c_str()); 187 239 cNames = arrayVMNames.size(); 188 240 cIds = arrayVMIds.size(); … … 243 295 244 296 CHECK_ERROR2_RET(hrc, pCloudProviderManager, 245 GetProviderByShortName(Bstr(pCommonOpts->p szProviderName).raw(), pCloudProvider.asOutParam()),297 GetProviderByShortName(Bstr(pCommonOpts->provider.pszProviderName).raw(), pCloudProvider.asOutParam()), 246 298 RTEXITCODE_FAILURE); 247 299 ComPtr<ICloudProfile> pCloudProfile; 248 300 249 301 CHECK_ERROR2_RET(hrc, pCloudProvider, 250 GetProfileByName(Bstr(pCommonOpts->p szProfileName).raw(), pCloudProfile.asOutParam()),302 GetProfileByName(Bstr(pCommonOpts->profile.pszProfileName).raw(), pCloudProfile.asOutParam()), 251 303 RTEXITCODE_FAILURE); 252 304 if (strCompartmentId.isNotEmpty()) … … 259 311 { 260 312 RTPrintf("Parameter \'compartment\' is empty or absent.\n" 261 "Trying to get the compartment from the passed cloud profile \'%s\'\n", pCommonOpts->p szProfileName);313 "Trying to get the compartment from the passed cloud profile \'%s\'\n", pCommonOpts->profile.pszProfileName); 262 314 Bstr bStrCompartmentId; 263 315 CHECK_ERROR2_RET(hrc, pCloudProfile, … … 265 317 RTEXITCODE_FAILURE); 266 318 strCompartmentId = bStrCompartmentId; 267 RTPrintf("Found the compartment \'%s\':\n", strCompartmentId.c_str()); 319 if (strCompartmentId.isNotEmpty()) 320 RTPrintf("Found the compartment \'%s\':\n", strCompartmentId.c_str()); 321 else 322 return errorSyntax(USAGE_S_NEWCMD, "Parameter --compartment-id is required"); 268 323 } 269 324 … … 339 394 }; 340 395 341 342 Bstr bstrProvider(pCommonOpts->pszProviderName); 343 Bstr bstrProfile(pCommonOpts->pszProfileName); 396 Bstr bstrProvider(pCommonOpts->provider.pszProviderName); 397 Bstr bstrProfile(pCommonOpts->profile.pszProfileName); 344 398 345 399 /* check for required options */ 346 400 if (bstrProvider.isEmpty()) 347 return errorSyntax(USAGE_ CLOUDPROFILE, "Parameter --provider is required");401 return errorSyntax(USAGE_S_NEWCMD, "Parameter --provider is required"); 348 402 if (bstrProfile.isEmpty()) 349 return errorSyntax(USAGE_ CLOUDPROFILE, "Parameter --profile is required");403 return errorSyntax(USAGE_S_NEWCMD, "Parameter --profile is required"); 350 404 351 405 RTGETOPTSTATE GetState; … … 360 414 { 361 415 case 1000: 362 // setCurrentSubcommand(HELP_SCOPE_CLOUDIMAGE_ CREATE);416 // setCurrentSubcommand(HELP_SCOPE_CLOUDIMAGE_LIST); 363 417 return listCloudImages(a, GetState.iNext, pCommonOpts); 364 418 case 1001: 365 // setCurrentSubcommand(HELP_SCOPE_CLOUDI MAGE_INFO);419 // setCurrentSubcommand(HELP_SCOPE_CLOUDINSTANCE_LIST); 366 420 return listCloudInstances(a, GetState.iNext, pCommonOpts); 421 case VINF_GETOPT_NOT_OPTION: 422 return errorUnknownSubcommand(ValueUnion.psz); 423 424 default: 425 return errorGetOpt(c, &ValueUnion); 426 } 427 } 428 429 return errorNoSubcommand(); 430 } 431 432 static RTEXITCODE createCloudInstance(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts) 433 { 434 RT_NOREF(iFirst); 435 RT_NOREF(pCommonOpts); 436 return RTEXITCODE_SUCCESS; 437 } 438 439 static RTEXITCODE updateCloudInstance(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts) 440 { 441 RT_NOREF(iFirst); 442 RT_NOREF(pCommonOpts); 443 return RTEXITCODE_SUCCESS; 444 } 445 446 static RTEXITCODE showCloudInstanceInfo(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts) 447 { 448 HRESULT hrc = S_OK; 449 450 hrc = checkAndSetCommonOptions(a, pCommonOpts); 451 if (FAILED(hrc)) 452 return RTEXITCODE_FAILURE; 453 454 static const RTGETOPTDEF s_aOptions[] = 455 { 456 { "--id", 'i', RTGETOPT_REQ_STRING } 457 }; 458 RTGETOPTSTATE GetState; 459 RTGETOPTUNION ValueUnion; 460 int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0); 461 AssertRCReturn(vrc, RTEXITCODE_FAILURE); 462 463 Utf8Str strInstanceId; 464 int c; 465 while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0) 466 { 467 switch (c) 468 { 469 case 'i': 470 strInstanceId = ValueUnion.psz; 471 break; 472 case VINF_GETOPT_NOT_OPTION: 473 return errorUnknownSubcommand(ValueUnion.psz); 474 default: 475 return errorGetOpt(c, &ValueUnion); 476 } 477 } 478 479 Bstr bstrProfileName; 480 ComPtr<ICloudProfile> pCloudProfile = pCommonOpts->profile.pCloudProfile; 481 pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam()); 482 483 ComObjPtr<ICloudClient> oCloudClient; 484 CHECK_ERROR2_RET(hrc, pCloudProfile, 485 CreateCloudClient(oCloudClient.asOutParam()), 486 RTEXITCODE_FAILURE); 487 RTPrintf("Getting information about cloud instance with id %s...\n", strInstanceId.c_str()); 488 RTPrintf("Reply is in the form \'setting name\' = \'value\'\n"); 489 490 ComPtr<IAppliance> pAppliance; 491 CHECK_ERROR2_RET(hrc, a->virtualBox, CreateAppliance(pAppliance.asOutParam()), RTEXITCODE_FAILURE); 492 493 com::SafeIfaceArray<IVirtualSystemDescription> vsdArray; 494 uint32_t requestedVSDnums = 1; 495 uint32_t newVSDnums = 0; 496 CHECK_ERROR2_RET(hrc, pAppliance, CreateVirtualSystemDescriptions(requestedVSDnums, &newVSDnums), RTEXITCODE_FAILURE); 497 if (requestedVSDnums != newVSDnums) 498 return RTEXITCODE_FAILURE; 499 500 CHECK_ERROR2_RET(hrc, pAppliance, COMGETTER(VirtualSystemDescriptions)(ComSafeArrayAsOutParam(vsdArray)), RTEXITCODE_FAILURE); 501 ComPtr<IVirtualSystemDescription> instanceDescription = vsdArray[0]; 502 CHECK_ERROR2_RET(hrc, oCloudClient, 503 GetInstanceInfo(Bstr(strInstanceId.c_str()).raw(), instanceDescription), 504 RTEXITCODE_FAILURE); 505 RTPrintf("Cloud instance info (provider '%s'):\n", 506 pCommonOpts->provider.pszProviderName); 507 508 struct vsdHReadable { 509 VirtualSystemDescriptionType_T vsdType; 510 Utf8Str strFound; 511 Utf8Str strNotFound; 512 }; 513 514 size_t vsdHReadableArraySize = 9;//the number of items in the vsdHReadableArray 515 vsdHReadable vsdHReadableArray[vsdHReadableArraySize] = { 516 {VirtualSystemDescriptionType_CloudDomain, "Availability domain = '%ls'\n", "Availability domain wasn't found\n"}, 517 {VirtualSystemDescriptionType_Name, "Instance displayed name = '%ls'\n", "Instance displayed name wasn't found\n"}, 518 {VirtualSystemDescriptionType_CloudInstanceState, "Instance state = '%ls'\n", "Instance state wasn't found\n"}, 519 {VirtualSystemDescriptionType_CloudInstanceId, "Instance Id = '%ls'\n", "Instance Id wasn't found\n"}, 520 {VirtualSystemDescriptionType_CloudImageId, "Bootable image Id = '%ls'\n", 521 "Image Id whom the instance is booted up wasn't found\n"}, 522 {VirtualSystemDescriptionType_CloudInstanceShape, "Shape of the instance = '%ls'\n", 523 "The shape of the instance wasn't found\n"}, 524 {VirtualSystemDescriptionType_OS, "Type of guest OS = '%ls'\n", "Type of guest OS wasn't found.\n"}, 525 {VirtualSystemDescriptionType_Memory, "RAM = '%ls MB'\n", "Value for RAM wasn't found\n"}, 526 {VirtualSystemDescriptionType_CPU, "CPUs = '%ls'\n", "Numbers of CPUs weren't found\n"} 527 }; 528 529 com::SafeArray<VirtualSystemDescriptionType_T> retTypes; 530 com::SafeArray<BSTR> aRefs; 531 com::SafeArray<BSTR> aOvfValues; 532 com::SafeArray<BSTR> aVBoxValues; 533 com::SafeArray<BSTR> aExtraConfigValues; 534 535 for (size_t i=0; i<vsdHReadableArraySize ; ++i) 536 { 537 hrc = instanceDescription->GetDescriptionByType(vsdHReadableArray[i].vsdType, 538 ComSafeArrayAsOutParam(retTypes), 539 ComSafeArrayAsOutParam(aRefs), 540 ComSafeArrayAsOutParam(aOvfValues), 541 ComSafeArrayAsOutParam(aVBoxValues), 542 ComSafeArrayAsOutParam(aExtraConfigValues)); 543 if (FAILED(hrc) || aVBoxValues.size() == 0) 544 LogRel((vsdHReadableArray[i].strNotFound.c_str())); 545 else 546 RTPrintf(vsdHReadableArray[i].strFound.c_str(), aVBoxValues[0]); 547 548 retTypes.setNull(); 549 aRefs.setNull(); 550 aOvfValues.setNull(); 551 aVBoxValues.setNull(); 552 aExtraConfigValues.setNull(); 553 } 554 555 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 556 } 557 558 static RTEXITCODE startCloudInstance(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts) 559 { 560 HRESULT hrc = S_OK; 561 hrc = checkAndSetCommonOptions(a, pCommonOpts); 562 if (FAILED(hrc)) 563 return RTEXITCODE_FAILURE; 564 565 static const RTGETOPTDEF s_aOptions[] = 566 { 567 { "--id", 'i', RTGETOPT_REQ_STRING } 568 }; 569 RTGETOPTSTATE GetState; 570 RTGETOPTUNION ValueUnion; 571 int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0); 572 AssertRCReturn(vrc, RTEXITCODE_FAILURE); 573 574 Utf8Str strInstanceId; 575 int c; 576 while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0) 577 { 578 switch (c) 579 { 580 case 'i': 581 strInstanceId = ValueUnion.psz; 582 break; 583 case VINF_GETOPT_NOT_OPTION: 584 return errorUnknownSubcommand(ValueUnion.psz); 585 default: 586 return errorGetOpt(c, &ValueUnion); 587 } 588 } 589 590 Bstr bstrProfileName; 591 ComPtr<ICloudProfile> pCloudProfile = pCommonOpts->profile.pCloudProfile; 592 pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam()); 593 594 ComObjPtr<ICloudClient> oCloudClient; 595 CHECK_ERROR2_RET(hrc, pCloudProfile, 596 CreateCloudClient(oCloudClient.asOutParam()), 597 RTEXITCODE_FAILURE); 598 RTPrintf("Starting cloud instance with id %s...\n", strInstanceId.c_str()); 599 600 ComPtr<IProgress> progress; 601 CHECK_ERROR2_RET(hrc, oCloudClient, 602 StartInstance(Bstr(strInstanceId.c_str()).raw(), progress.asOutParam()), 603 RTEXITCODE_FAILURE); 604 hrc = showProgress(progress); 605 CHECK_PROGRESS_ERROR_RET(progress, ("Starting the cloud instance failed"), RTEXITCODE_FAILURE); 606 607 if (SUCCEEDED(hrc)) 608 RTPrintf("Cloud instance with id %s (provider = '%s', profile = '%s') was started\n", 609 strInstanceId.c_str(), 610 pCommonOpts->provider.pszProviderName, 611 pCommonOpts->profile.pszProfileName); 612 613 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 614 } 615 616 static RTEXITCODE pauseCloudInstance(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts) 617 { 618 HRESULT hrc = S_OK; 619 hrc = checkAndSetCommonOptions(a, pCommonOpts); 620 621 if (FAILED(hrc)) 622 return RTEXITCODE_FAILURE; 623 624 static const RTGETOPTDEF s_aOptions[] = 625 { 626 { "--id", 'i', RTGETOPT_REQ_STRING } 627 }; 628 RTGETOPTSTATE GetState; 629 RTGETOPTUNION ValueUnion; 630 int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0); 631 AssertRCReturn(vrc, RTEXITCODE_FAILURE); 632 633 Utf8Str strInstanceId; 634 int c; 635 while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0) 636 { 637 switch (c) 638 { 639 case 'i': 640 strInstanceId = ValueUnion.psz; 641 break; 642 case VINF_GETOPT_NOT_OPTION: 643 return errorUnknownSubcommand(ValueUnion.psz); 644 default: 645 return errorGetOpt(c, &ValueUnion); 646 } 647 } 648 649 Bstr bstrProfileName; 650 ComPtr<ICloudProfile> pCloudProfile = pCommonOpts->profile.pCloudProfile; 651 pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam()); 652 653 ComObjPtr<ICloudClient> oCloudClient; 654 CHECK_ERROR2_RET(hrc, pCloudProfile, 655 CreateCloudClient(oCloudClient.asOutParam()), 656 RTEXITCODE_FAILURE); 657 RTPrintf("Pausing cloud instance with id %s...\n", strInstanceId.c_str()); 658 659 ComPtr<IProgress> progress; 660 CHECK_ERROR2_RET(hrc, oCloudClient, 661 PauseInstance(Bstr(strInstanceId.c_str()).raw(), progress.asOutParam()), 662 RTEXITCODE_FAILURE); 663 hrc = showProgress(progress); 664 CHECK_PROGRESS_ERROR_RET(progress, ("Pause the cloud instance failed"), RTEXITCODE_FAILURE); 665 666 if (SUCCEEDED(hrc)) 667 RTPrintf("Cloud instance with id %s (provider = '%s', profile = '%s') was paused\n", 668 strInstanceId.c_str(), 669 pCommonOpts->provider.pszProviderName, 670 pCommonOpts->profile.pszProfileName); 671 672 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 673 } 674 675 static RTEXITCODE terminateCloudInstance(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts) 676 { 677 HRESULT hrc = S_OK; 678 679 hrc = checkAndSetCommonOptions(a, pCommonOpts); 680 if (FAILED(hrc)) 681 return RTEXITCODE_FAILURE; 682 683 static const RTGETOPTDEF s_aOptions[] = 684 { 685 { "--id", 'i', RTGETOPT_REQ_STRING } 686 }; 687 RTGETOPTSTATE GetState; 688 RTGETOPTUNION ValueUnion; 689 int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0); 690 AssertRCReturn(vrc, RTEXITCODE_FAILURE); 691 692 Utf8Str strInstanceId; 693 int c; 694 while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0) 695 { 696 switch (c) 697 { 698 case 'i': 699 strInstanceId = ValueUnion.psz; 700 break; 701 case VINF_GETOPT_NOT_OPTION: 702 return errorUnknownSubcommand(ValueUnion.psz); 703 default: 704 return errorGetOpt(c, &ValueUnion); 705 } 706 } 707 708 Bstr bstrProfileName; 709 ComPtr<ICloudProfile> pCloudProfile = pCommonOpts->profile.pCloudProfile; 710 pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam()); 711 712 ComObjPtr<ICloudClient> oCloudClient; 713 CHECK_ERROR2_RET(hrc, pCloudProfile, 714 CreateCloudClient(oCloudClient.asOutParam()), 715 RTEXITCODE_FAILURE); 716 RTPrintf("Terminating cloud instance with id %s...\n", strInstanceId.c_str()); 717 718 ComPtr<IProgress> progress; 719 CHECK_ERROR2_RET(hrc, oCloudClient, 720 TerminateInstance(Bstr(strInstanceId.c_str()).raw(), progress.asOutParam()), 721 RTEXITCODE_FAILURE); 722 hrc = showProgress(progress); 723 CHECK_PROGRESS_ERROR_RET(progress, ("Termination the cloud instance failed"), RTEXITCODE_FAILURE); 724 725 if (SUCCEEDED(hrc)) 726 RTPrintf("Cloud instance with id %s (provider = '%s', profile = '%s') was terminated\n", 727 strInstanceId.c_str(), 728 pCommonOpts->provider.pszProviderName, 729 pCommonOpts->profile.pszProfileName); 730 731 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 732 } 733 734 static RTEXITCODE handleCloudInstance(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts) 735 { 736 if (a->argc < 1) 737 return errorNoSubcommand(); 738 739 static const RTGETOPTDEF s_aOptions[] = 740 { 741 { "create", 1000, RTGETOPT_REQ_NOTHING }, 742 { "start", 1001, RTGETOPT_REQ_NOTHING }, 743 { "pause", 1002, RTGETOPT_REQ_NOTHING }, 744 { "info", 1003, RTGETOPT_REQ_NOTHING }, 745 { "update", 1004, RTGETOPT_REQ_NOTHING }, 746 { "terminate", 1005, RTGETOPT_REQ_NOTHING } 747 }; 748 749 RTGETOPTSTATE GetState; 750 int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0); 751 AssertRCReturn(vrc, RTEXITCODE_FAILURE); 752 753 int c; 754 RTGETOPTUNION ValueUnion; 755 while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0) 756 { 757 switch (c) 758 { 759 /* Sub-commands: */ 760 case 1000: 761 // setCurrentSubcommand(HELP_SCOPE_CLOUDINSTANCE_CREATE); 762 return createCloudInstance(a, GetState.iNext, pCommonOpts); 763 case 1001: 764 setCurrentSubcommand(HELP_SCOPE_CLOUDINSTANCE_START); 765 return startCloudInstance(a, GetState.iNext, pCommonOpts); 766 case 1002: 767 setCurrentSubcommand(HELP_SCOPE_CLOUDINSTANCE_PAUSE); 768 return pauseCloudInstance(a, GetState.iNext, pCommonOpts); 769 case 1003: 770 setCurrentSubcommand(HELP_SCOPE_CLOUDINSTANCE_INFO); 771 return showCloudInstanceInfo(a, GetState.iNext, pCommonOpts); 772 case 1004: 773 // setCurrentSubcommand(HELP_SCOPE_CLOUDINSTANCE_UPDATE); 774 return updateCloudInstance(a, GetState.iNext, pCommonOpts); 775 case 1005: 776 setCurrentSubcommand(HELP_SCOPE_CLOUDINSTANCE_TERMINATE); 777 return terminateCloudInstance(a, GetState.iNext, pCommonOpts); 367 778 case VINF_GETOPT_NOT_OPTION: 368 779 return errorUnknownSubcommand(ValueUnion.psz); … … 398 809 AssertRCReturn(vrc, RTEXITCODE_FAILURE); 399 810 400 CLOUDCOMMONOPT CommonOpts = { NULL, NULL};811 CLOUDCOMMONOPT commonOpts = { {NULL, NULL}, {NULL, NULL} }; 401 812 int c; 402 813 RTGETOPTUNION ValueUnion; … … 406 817 { 407 818 case 'v': // --provider 408 CommonOpts.pszProviderName = ValueUnion.psz;819 commonOpts.provider.pszProviderName = ValueUnion.psz; 409 820 break; 410 821 case 'f': // --profile 411 CommonOpts.pszProfileName = ValueUnion.psz;822 commonOpts.profile.pszProfileName = ValueUnion.psz; 412 823 break; 413 824 /* Sub-commands: */ 414 825 case 1000: 415 // setCurrentSubcommand(HELP_SCOPE_CLOUDLIST); 416 return handleCloudLists(a, GetState.iNext, &CommonOpts); 826 return handleCloudLists(a, GetState.iNext, &commonOpts); 827 case 1002: 828 return handleCloudInstance(a, GetState.iNext, &commonOpts); 417 829 case VINF_GETOPT_NOT_OPTION: 418 830 return errorUnknownSubcommand(ValueUnion.psz); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r78694 r78734 3650 3650 <enum 3651 3651 name="VirtualSystemDescriptionType" 3652 uuid=" 48875667-19f6-4329-a208-735adf9a47ee"3652 uuid="9eed2b05-fe6c-46a7-ad75-b039ac2919f9" 3653 3653 > 3654 3654 <desc>Used with <link to="IVirtualSystemDescription" /> to describe the type of … … 3707 3707 <const name="CloudInstanceId" value="37" /> 3708 3708 <const name="CloudImageId" value="38" /> 3709 <const name="CloudInstanceState" value="39" /> 3710 <const name="CloudImageState" value="40" /> 3709 3711 </enum> 3710 3712 … … 25785 25787 name="ICloudClient" extends="$unknown" 25786 25788 uuid="6d4dfab6-7718-11e9-9775-1f99c815d0b3" 25787 wsmap="managed" reservedMethods="1 6" reservedAttributes="8"25789 wsmap="managed" reservedMethods="13" reservedAttributes="8" 25788 25790 > 25789 25791 … … 25934 25936 </param> 25935 25937 <param name="progress" type="IProgress" dir="in"> 25938 <desc>Progress object to track the operation completion.</desc> 25939 </param> 25940 </method> 25941 25942 <method name="startInstance"> 25943 <desc> 25944 Start an existing instance with passed id. 25945 </desc> 25946 <param name="uid" type="wstring" dir="in"> 25947 <desc>the UUID of instance in the Cloud.</desc> 25948 </param> 25949 <param name="progress" type="IProgress" dir="return"> 25950 <desc>Progress object to track the operation completion.</desc> 25951 </param> 25952 </method> 25953 25954 <method name="pauseInstance"> 25955 <desc> 25956 Pause an existing instance with passed id. 25957 </desc> 25958 <param name="uid" type="wstring" dir="in"> 25959 <desc>the UUID of instance in the Cloud.</desc> 25960 </param> 25961 <param name="progress" type="IProgress" dir="return"> 25962 <desc>Progress object to track the operation completion.</desc> 25963 </param> 25964 </method> 25965 25966 <method name="terminateInstance"> 25967 <desc> 25968 Terminate an existing instance with passed id. 25969 </desc> 25970 <param name="uid" type="wstring" dir="in"> 25971 <desc>the UUID of instance in the Cloud.</desc> 25972 </param> 25973 <param name="progress" type="IProgress" dir="return"> 25936 25974 <desc>Progress object to track the operation completion.</desc> 25937 25975 </param>
Note:
See TracChangeset
for help on using the changeset viewer.