Changeset 73216 in vbox
- Timestamp:
- Jul 18, 2018 4:01:16 PM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r73169 r73216 3578 3578 using <link to="IMachine::groups"/>, after importing.</desc> 3579 3579 </const> 3580 <const name="CloudOCIInstanceShape" value="27" /> 3581 <const name="CloudOCIDomain" value="28" /> 3582 <const name="CloudOCIBootDiskSize" value="29" /> 3583 <const name="CloudOCIBucket" value="30" /> 3584 <const name="CloudOCIVCN" value="31" /> 3585 <const name="CloudOCIPublicIP" value="32" /> 3580 3586 </enum> 3581 3587 -
trunk/src/VBox/Main/include/CloudClientImpl.h
r73173 r73216 71 71 }; 72 72 73 class CloudClientOCI : 74 public CloudClient 75 { 76 public: 77 DECLARE_EMPTY_CTOR_DTOR(CloudClientOCI) 78 79 HRESULT initCloudClient(CloudUserProfileList *aProfiles, 80 VirtualBox *aParent, 81 CloudProviderId_T aCloudProvider, 82 const com::Utf8Str &aProfileName); 83 84 private: 85 HRESULT getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString); 86 87 HRESULT createOperation(const com::Utf8Str &aProfileName, 88 CloudOperation_T aCloudOperation, 89 com::Guid &aOpId); 90 HRESULT runOperation(const com::Guid &aOpId, 91 LONG64 aTimeout); 92 HRESULT checkOperationResult(const com::Guid &aOpId, 93 LONG64 *aStartOpTime, 94 LONG64 *aLastTime, 95 CloudOperationResult_T *aResult); 96 HRESULT getOperationParameterNames(CloudOperation_T aCloudOperation, 97 std::vector<com::Utf8Str> &aParameterNames); 98 HRESULT getOperationParameterProperties(const com::Utf8Str &aOpParameterName, 99 com::Utf8Str &aOpParameterType, 100 com::Utf8Str &aOpParameterDesc, 101 std::vector<com::Utf8Str> &aOpParameterValues); 102 HRESULT setParametersForOperation(const com::Guid &aOpId, 103 const std::vector<com::Utf8Str> &aValues); 104 }; 105 73 106 #endif // !____H_CLOUDCLIENTIMPL 74 107 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-server/CloudClientImpl.cpp
r73173 r73216 244 244 return hrc; 245 245 } 246 247 //////////////////////////////////////////////////////////////////////////////// 248 // 249 // CloudClient constructor / destructor 250 // 251 // //////////////////////////////////////////////////////////////////////////////// 252 CloudClientOCI::CloudClientOCI() 253 { 254 LogRel(("CloudClientOCI::CloudClientOCI()\n")); 255 } 256 257 CloudClientOCI::~CloudClientOCI() 258 { 259 LogRel(("CloudClientOCI::~CloudClientOCI()\n")); 260 } 261 262 HRESULT CloudClientOCI::initCloudClient(CloudUserProfileList *aProfiles, 263 VirtualBox *aParent, 264 CloudProviderId_T aCloudProvider, 265 const com::Utf8Str &aProfileName) 266 { 267 LogRel(("aParent=%p\n", aParent)); 268 ComAssertRet(aParent, E_INVALIDARG); 269 270 /* Enclose the state transition NotReady->InInit->Ready */ 271 AutoInitSpan autoInitSpan(this); 272 AssertReturn(autoInitSpan.isOk(), E_FAIL); 273 274 unconst(mParent) = aParent; 275 276 HRESULT hrc = S_OK; 277 278 try 279 { 280 mCloudProvider = aCloudProvider; 281 LogRel(("CloudClientOCI = %d\n", mCloudProvider)); 282 CloudUserProfileList *lProfiles = aProfiles; 283 std::vector<com::Utf8Str> lNames; 284 std::vector<com::Utf8Str> lValues; 285 hrc = lProfiles->getProfileProperties(aProfileName, lNames, lValues); 286 if (FAILED(hrc)) 287 { 288 throw hrc; 289 } 290 291 for (size_t i=0;i<lNames.size();++i) 292 { 293 com::Utf8Str value = (i<lValues.size()) ? lValues.at(i) : ""; 294 userProfile[lNames.at(i)] = value; 295 } 296 297 CloudProviderId_T aProvider; 298 hrc = lProfiles->getProvider(&aProvider); 299 300 switch(aProvider) 301 { 302 case CloudProviderId_OCI: 303 default: 304 LogRel(("Reading profile %s has been done\n", aProfileName.c_str())); 305 break; 306 } 307 } 308 catch (HRESULT arc) 309 { 310 hrc = arc; 311 LogRel(("Get cought an exception %d\n", hrc)); 312 } 313 catch (std::bad_alloc) 314 { 315 return E_OUTOFMEMORY; 316 } 317 318 /* 319 * Confirm a successful initialization 320 */ 321 autoInitSpan.setSucceeded(); 322 323 return hrc; 324 } 325 326 //static Utf8Str strExportParametersToOCI = "{\n" 327 // "\"Shape of instance\": {\n" 328 // "\"type\":27,\n" 329 // "\"items\": [\n" 330 // "\"VM.Standard1.1\",\n" 331 // "\"VM.Standard1.2\",\n" 332 // "\"VM.Standard1.4\",\n" 333 // "\"VM.Standard1.8\",\n" 334 // "\"VM.Standard1.16\",\n" 335 // "],\n" 336 // "},\n" 337 // "\"Availability domain\": {\n" 338 // "\"type\":28,\n" 339 // "\"items\": [\n" 340 // "\"ergw:US-ASHBURN-AD-1\",\n" 341 // "\"ergw:US-ASHBURN-AD-2\",\n" 342 // "\"ergw:US-ASHBURN-AD-3\",\n" 343 // "],\n" 344 // "},\n" 345 // "\"Disk size\": {\n" 346 // "\"type\":29,\n" 347 // "\range\":10 ... 50,\n" 348 // "\"size\":10,\n" 349 // "\"unit\":\"Gb\"\n" 350 // "},\n" 351 // "\"Bucket\": {\n" 352 // "\"type\":30,\n" 353 // "\"items\": [\n" 354 // "\"temporarly-bucket-python-ubuntu-14-x64-server\",\n" 355 // "\"temporarly-bucket-python-un-ubuntu\",\n" 356 // "\"test_cpp_bucket\",\n" 357 // "\"vbox_test_bucket_1\",\n" 358 // "],\n" 359 // "},\n" 360 // "\"Virtual Cloud Network\": {\n" 361 // "\"type\":31,\n" 362 // "\"items\": [\n" 363 // "\"vcn-scoter\",\n" 364 // "\"vcn20180510154500\",\n" 365 // "\"vcn_spider\",\n" 366 // "],\n" 367 // "},\n" 368 // "\"Public IP address\": {\n" 369 // "\"type\":32,\n" 370 // "\"set\":\"yes\n" 371 // "}\n" 372 //"}"; 373 374 static Utf8Str strExportParametersToOCI = "{\n" 375 "\t""\"Shape of instance\": {\n" 376 "\t""\t""\"type\":27,\n" 377 "\t""\t""\"items\": [\n" 378 "\t""\t""\t""\"VM.Standard1.1\",\n" 379 "\t""\t""\t""\"VM.Standard1.2\",\n" 380 "\t""\t""\t""\"VM.Standard1.4\",\n" 381 "\t""\t""\t""\"VM.Standard1.8\",\n" 382 "\t""\t""\t""\"VM.Standard1.16\",\n" 383 "\t""\t""],\n" 384 "\t""},\n" 385 "\t""\"Availability domain\": {\n" 386 "\t""\t""\"type\":28,\n" 387 "\t""\t""\"items\": [\n" 388 "\t""\t""\t""\"ergw:US-ASHBURN-AD-1\",\n" 389 "\t""\t""\t""\"ergw:US-ASHBURN-AD-2\",\n" 390 "\t""\t""\t""\"ergw:US-ASHBURN-AD-3\",\n" 391 "\t""\t""],\n" 392 "\t""},\n" 393 "\t""\"Disk size\": {\n" 394 "\t""\t""\"type\":29,\n" 395 "\t""\t""\"range\":10 ... 50,\n" 396 "\t""\t""\"size\":10,\n" 397 "\t""\t""\"unit\":\"Gb\"\n" 398 "\t""},\n" 399 "\t""\"Bucket\": {\n" 400 "\t""\t""\"type\":30,\n" 401 "\t""\t""\"items\": [\n" 402 "\t""\t""\t""\"temporarly-bucket-python-ubuntu-14-x64-server\",\n" 403 "\t""\t""\t""\"temporarly-bucket-python-un-ubuntu\",\n" 404 "\t""\t""\t""\"test_cpp_bucket\",\n" 405 "\t""\t""\t""\"vbox_test_bucket_1\",\n" 406 "\t""\t""],\n" 407 "\t""},\n" 408 "\t""\"Virtual Cloud Network\": {\n" 409 "\t""\t""\"type\":31,\n" 410 "\t""\t""\"items\": [\n" 411 "\t""\t""\t""\"vcn-scoter\",\n" 412 "\t""\t""\t""\"vcn20180510154500\",\n" 413 "\t""\t""\t""\"vcn_spider\",\n" 414 "\t""\t""],\n" 415 "\t""},\n" 416 "\t""\"Public IP address\": {\n" 417 "\t""\t""\"type\":32,\n" 418 "\t""\t""\"set\":\"yes\n" 419 "\t""}\n" 420 "}"; 421 422 HRESULT CloudClientOCI::getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString) 423 { 424 LogRel(("CloudClientOCI::getOperationParameters: %d, %s\n", aCloudOperation, aJsonString.c_str())); 425 HRESULT hrc = S_OK; 426 if (aCloudOperation == CloudOperation_exportVM) 427 aJsonString = strExportParametersToOCI; 428 else 429 hrc = VERR_NOT_IMPLEMENTED; 430 return hrc; 431 } 432 433 HRESULT CloudClientOCI::createOperation(const com::Utf8Str &aProfileName, 434 CloudOperation_T aCloudOperation, 435 com::Guid &aOpId) 436 { 437 LogRel(("CloudClientOCI::createOperation: %s, %d, %s\n", aProfileName.c_str(), 438 aCloudOperation, 439 aOpId.toString().c_str())); 440 HRESULT hrc = VERR_NOT_IMPLEMENTED; 441 return hrc; 442 } 443 444 HRESULT CloudClientOCI::runOperation(const com::Guid &aOpId, 445 LONG64 aTimeout) 446 { 447 LogRel(("CloudClientOCI::runOperation: %s, %d\n", aOpId.toString().c_str(), aTimeout)); 448 HRESULT hrc = VERR_NOT_IMPLEMENTED; 449 return hrc; 450 } 451 452 HRESULT CloudClientOCI::checkOperationResult(const com::Guid &aOpId, 453 LONG64 *aStartOpTime, 454 LONG64 *aLastTime, 455 CloudOperationResult_T *aResult) 456 { 457 LogRel(("CloudClientOCI::checkOperationResult: %s, %d, %d, %d\n", 458 aOpId.toString().c_str(), 459 *aStartOpTime, 460 *aLastTime, 461 *aResult)); 462 HRESULT hrc = VERR_NOT_IMPLEMENTED; 463 return hrc; 464 } 465 466 HRESULT CloudClientOCI::getOperationParameterNames(CloudOperation_T aCloudOperation, 467 std::vector<com::Utf8Str> &aParameterNames) 468 { 469 LogRel(("CloudClientOCI::getOperationParameterNames: %d\n", aCloudOperation)); 470 aParameterNames.clear(); 471 HRESULT hrc = VERR_NOT_IMPLEMENTED; 472 return hrc; 473 } 474 475 HRESULT CloudClientOCI::getOperationParameterProperties(const com::Utf8Str &aOpParameterName, 476 com::Utf8Str &aOpParameterType, 477 com::Utf8Str &aOpParameterDesc, 478 std::vector<com::Utf8Str> &aOpParameterValues) 479 { 480 LogRel(("CloudClientOCI::getOperationParameterProperties: %s, %s, %s\n", 481 aOpParameterName.c_str(), 482 aOpParameterType.c_str(), 483 aOpParameterDesc.c_str())); 484 aOpParameterValues.clear(); 485 HRESULT hrc = VERR_NOT_IMPLEMENTED; 486 return hrc; 487 } 488 489 HRESULT CloudClientOCI::setParametersForOperation(const com::Guid &aOpId, 490 const std::vector<com::Utf8Str> &aValues) 491 { 492 LogRel(("CloudClientOCI::setParametersForOperation: %s\n", aOpId.toString().c_str())); 493 for (size_t i=0;i<aValues.size();++i) 494 { 495 LogRel(("value %d: %s\n", i, aValues.at(i).c_str())); 496 } 497 498 HRESULT hrc = VERR_NOT_IMPLEMENTED; 499 return hrc; 500 } 501 -
trunk/src/VBox/Main/src-server/CloudUserProfileListImpl.cpp
r73188 r73216 380 380 if (SUCCEEDED(hrc)) 381 381 { 382 ComObjPtr<CloudClientOCI> ptrCloudClientOCI; 383 hrc = ptrCloudClientOCI.createObject(); 382 384 AutoReadLock wlock(this COMMA_LOCKVAL_SRC_POS); 383 hrc = ptrCloudClient ->initCloudClient(this, mParent, providerId, aProfileName);385 hrc = ptrCloudClientOCI->initCloudClient(this, mParent, providerId, aProfileName); 384 386 if (SUCCEEDED(hrc)) 385 387 { 388 ptrCloudClient = ptrCloudClientOCI; 386 389 hrc = ptrCloudClient.queryInterfaceTo(aCloudClient.asOutParam()); 387 390 }
Note:
See TracChangeset
for help on using the changeset viewer.