Changeset 53266 in vbox for trunk/src/VBox
- Timestamp:
- Nov 7, 2014 4:02:36 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96836
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r51889 r53266 225 225 int level = 0); 226 226 int handleShowVMInfo(HandlerArg *a); 227 HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,228 ComPtr<IMachine> machine,229 VMINFO_DETAILS details = VMINFO_NONE,230 ComPtr<IConsole> console = ComPtr<IConsole>());227 HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox, 228 ComPtr<IMachine> pMachine, 229 ComPtr<ISession> pSession, 230 VMINFO_DETAILS details = VMINFO_NONE); 231 231 const char *machineStateToName(MachineState_T machineState, bool fShort); 232 232 HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
r50085 r53266 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 289 289 } 290 290 291 /* See showVMInfo. */292 291 if (FAILED(showBandwidthGroups(rptrBWControl, enmDetails))) 293 292 return RTEXITCODE_FAILURE; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r52978 r53266 351 351 #endif 352 352 353 HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,353 HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox, 354 354 ComPtr<IMachine> machine, 355 VMINFO_DETAILS details /*= VMINFO_NONE*/,356 ComPtr<IConsole> console /*= ComPtr<IConsole> ()*/)355 ComPtr<ISession> pSession, 356 VMINFO_DETAILS details /*= VMINFO_NONE*/) 357 357 { 358 358 HRESULT rc; 359 ComPtr<IConsole> pConsole; 360 if (pSession) 361 pSession->COMGETTER(Console)(pConsole.asOutParam()); 359 362 360 363 #define SHOW_BOOLEAN_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \ … … 500 503 CHECK_ERROR2_RET(machine, COMGETTER(OSTypeId)(osTypeId.asOutParam()), hrcCheck); 501 504 ComPtr<IGuestOSType> osType; 502 CHECK_ERROR2_RET( virtualBox, GetGuestOSType(osTypeId.raw(), osType.asOutParam()), hrcCheck);505 CHECK_ERROR2_RET(pVirtualBox, GetGuestOSType(osTypeId.raw(), osType.asOutParam()), hrcCheck); 503 506 SHOW_STRINGARRAY_PROP( machine, Groups, "groups", "Groups"); 504 507 SHOW_STRING_PROP( osType, Description, "ostype", "Guest OS"); … … 609 612 610 613 ComPtr<ISystemProperties> systemProperties; 611 CHECK_ERROR2_RET( virtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);614 CHECK_ERROR2_RET(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck); 612 615 ULONG maxBootPosition = 0; 613 616 CHECK_ERROR2_RET(systemProperties, COMGETTER(MaxBootPosition)(&maxBootPosition), hrcCheck); … … 957 960 958 961 /* get the maximum amount of NICS */ 959 ULONG maxNICs = getMaxNics( virtualBox, machine);962 ULONG maxNICs = getMaxNics(pVirtualBox, machine); 960 963 961 964 for (ULONG currentNIC = 0; currentNIC < maxNICs; currentNIC++) … … 1337 1340 1338 1341 ComPtr<ISystemProperties> sysProps; 1339 virtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam());1342 pVirtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam()); 1340 1343 1341 1344 /* get the maximum amount of UARTs */ … … 1667 1670 } 1668 1671 1669 if ( console)1672 if (pConsole) 1670 1673 { 1671 1674 do 1672 1675 { 1673 1676 ComPtr<IDisplay> display; 1674 rc = console->COMGETTER(Display)(display.asOutParam());1677 rc = pConsole->COMGETTER(Display)(display.asOutParam()); 1675 1678 if (rc == E_ACCESSDENIED || display.isNull()) 1676 1679 break; /* VM not powered up */ 1677 1680 if (FAILED(rc)) 1678 1681 { 1679 com::GlueHandleComError( console, "COMGETTER(Display)(display.asOutParam())", rc, __FILE__, __LINE__);1682 com::GlueHandleComError(pConsole, "COMGETTER(Display)(display.asOutParam())", rc, __FILE__, __LINE__); 1680 1683 return rc; 1681 1684 } … … 1753 1756 break; 1754 1757 } 1755 if ( console)1758 if (pConsole) 1756 1759 { 1757 1760 ComPtr<IVRDEServerInfo> vrdeServerInfo; 1758 CHECK_ERROR_RET( console, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);1761 CHECK_ERROR_RET(pConsole, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc); 1759 1762 if (!vrdeServerInfo.isNull()) 1760 1763 { … … 1790 1793 address = "0.0.0.0"; 1791 1794 RTPrintf("VRDE: enabled (Address %ls, Ports %ls, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n", address.raw(), ports.raw(), fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType); 1792 if ( console && currentPort != -1 && currentPort != 0)1795 if (pConsole && currentPort != -1 && currentPort != 0) 1793 1796 RTPrintf("VRDE port: %d\n", currentPort); 1794 1797 if (fVideoChannel) … … 1969 1972 } 1970 1973 1971 if ( console)1974 if (pConsole) 1972 1975 { 1973 1976 /* scope */ … … 1977 1980 1978 1981 SafeIfaceArray <IHostUSBDevice> coll; 1979 CHECK_ERROR_RET( console, COMGETTER(RemoteUSBDevices)(ComSafeArrayAsOutParam(coll)), rc);1982 CHECK_ERROR_RET(pConsole, COMGETTER(RemoteUSBDevices)(ComSafeArrayAsOutParam(coll)), rc); 1980 1983 1981 1984 if (coll.size() == 0) … … 2066 2069 2067 2070 SafeIfaceArray <IUSBDevice> coll; 2068 CHECK_ERROR_RET( console, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)), rc);2071 CHECK_ERROR_RET(pConsole, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)), rc); 2069 2072 2070 2073 if (coll.size() == 0) … … 2214 2217 { 2215 2218 SafeIfaceArray <ISharedFolder> sfColl; 2216 CHECK_ERROR_RET( virtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sfColl)), rc);2219 CHECK_ERROR_RET(pVirtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sfColl)), rc); 2217 2220 for (size_t i = 0; i < sfColl.size(); ++i) 2218 2221 { … … 2257 2260 } 2258 2261 /* transient mappings */ 2259 if ( console)2262 if (pConsole) 2260 2263 { 2261 2264 com::SafeIfaceArray <ISharedFolder> folders; 2262 2265 2263 CHECK_ERROR_RET( console, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);2266 CHECK_ERROR_RET(pConsole, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc); 2264 2267 2265 2268 for (size_t i = 0; i < folders.size(); ++i) … … 2289 2292 RTPrintf("\n"); 2290 2293 2291 if ( console)2294 if (pConsole) 2292 2295 { 2293 2296 /* … … 2295 2298 */ 2296 2299 ComPtr<IVRDEServerInfo> vrdeServerInfo; 2297 CHECK_ERROR_RET( console, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);2300 CHECK_ERROR_RET(pConsole, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc); 2298 2301 BOOL Active = FALSE; 2299 2302 ULONG NumberOfClients = 0; … … 2503 2506 } 2504 2507 2505 if ( console)2508 if (pConsole) 2506 2509 { 2507 2510 ComPtr<IGuest> guest; 2508 rc = console->COMGETTER(Guest)(guest.asOutParam());2511 rc = pConsole->COMGETTER(Guest)(guest.asOutParam()); 2509 2512 if (SUCCEEDED(rc) && !guest.isNull()) 2510 2513 { … … 2698 2701 ULONG64 uOffset = 0; 2699 2702 SafeArray<BYTE> aLogData; 2700 ULONGcbLogData;2703 size_t cbLogData; 2701 2704 while (true) 2702 2705 { … … 2712 2715 * Unix style, as RTStrmWrite does the LF -> CR/LF replacement on 2713 2716 * Windows. Otherwise we end up with CR/CR/LF on Windows. */ 2714 ULONGcbLogDataPrint = cbLogData;2717 size_t cbLogDataPrint = cbLogData; 2715 2718 for (BYTE *s = aLogData.raw(), *d = s; 2716 2719 s - aLogData.raw() < (ssize_t)cbLogData; … … 2741 2744 details = VMINFO_STANDARD; 2742 2745 2743 ComPtr<IConsole> console;2744 2745 2746 /* open an existing session for the VM */ 2746 2747 rc = machine->LockMachine(a->session, LockType_Shared); … … 2748 2749 /* get the session machine */ 2749 2750 rc = a->session->COMGETTER(Machine)(machine.asOutParam()); 2750 if (SUCCEEDED(rc)) 2751 /* get the session console */ 2752 rc = a->session->COMGETTER(Console)(console.asOutParam()); 2753 2754 rc = showVMInfo(a->virtualBox, machine, details, console); 2755 2756 if (console) 2757 a->session->UnlockMachine(); 2751 2752 rc = showVMInfo(a->virtualBox, machine, a->session, details); 2753 2754 a->session->UnlockMachine(); 2758 2755 } 2759 2756 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r52200 r53266 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 862 862 { 863 863 if (machines[i]) 864 rc = showVMInfo(pVirtualBox, machines[i], fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);864 rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT); 865 865 } 866 866 } … … 895 895 case MachineState_Paused: 896 896 case MachineState_TeleportingPausedVM: 897 rc = showVMInfo(pVirtualBox, machines[i], fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);897 rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT); 898 898 break; 899 899 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
r47544 r53266 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 162 162 * @returns Exit code. 163 163 * @param pArgs The handler argument package. 164 * @param rptrMachineReference to the VM (locked) we're operating on.165 */ 166 static RTEXITCODE handleSnapshotList(HandlerArg *pArgs, ComPtr<IMachine> & rptrMachine)164 * @param pMachine Reference to the VM (locked) we're operating on. 165 */ 166 static RTEXITCODE handleSnapshotList(HandlerArg *pArgs, ComPtr<IMachine> &pMachine) 167 167 { 168 168 static const RTGETOPTDEF g_aOptions[] = … … 188 188 } 189 189 190 /* See showVMInfo. */ 191 ComPtr<ISnapshot> ptrSnapshot; 192 HRESULT hrc = rptrMachine->FindSnapshot(Bstr().raw(), ptrSnapshot.asOutParam()); 190 ComPtr<ISnapshot> pSnapshot; 191 HRESULT hrc = pMachine->FindSnapshot(Bstr().raw(), pSnapshot.asOutParam()); 193 192 if (FAILED(hrc)) 194 193 { … … 196 195 return RTEXITCODE_FAILURE; 197 196 } 198 if (p trSnapshot)199 { 200 ComPtr<ISnapshot> p trCurrentSnapshot;201 CHECK_ERROR2_RET( rptrMachine,COMGETTER(CurrentSnapshot)(ptrCurrentSnapshot.asOutParam()), RTEXITCODE_FAILURE);202 hrc = showSnapshots(p trSnapshot, ptrCurrentSnapshot, enmDetails);197 if (pSnapshot) 198 { 199 ComPtr<ISnapshot> pCurrentSnapshot; 200 CHECK_ERROR2_RET(pMachine,COMGETTER(CurrentSnapshot)(pCurrentSnapshot.asOutParam()), RTEXITCODE_FAILURE); 201 hrc = showSnapshots(pSnapshot, pCurrentSnapshot, enmDetails); 203 202 if (FAILED(hrc)) 204 203 return RTEXITCODE_FAILURE; … … 276 275 /* the first argument must be the VM */ 277 276 Bstr bstrMachine(a->argv[0]); 278 ComPtr<IMachine> p trMachine;277 ComPtr<IMachine> pMachine; 279 278 CHECK_ERROR(a->virtualBox, FindMachine(bstrMachine.raw(), 280 p trMachine.asOutParam()));281 if (!p trMachine)279 pMachine.asOutParam())); 280 if (!pMachine) 282 281 return 1; 283 282 … … 285 284 { 286 285 /* we have to open a session for this task (new or shared) */ 287 rc = ptrMachine->LockMachine(a->session, LockType_Shared); 288 ComPtr<IConsole> console; 289 CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam())); 286 rc = pMachine->LockMachine(a->session, LockType_Shared); 290 287 291 288 /* switch based on the command */ … … 347 344 break; 348 345 349 if (fPause) 350 { 351 MachineState_T machineState; 352 CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState)); 353 if (machineState == MachineState_Running) 354 CHECK_ERROR_BREAK(console, Pause()); 355 else 356 fPause = false; 357 } 358 359 ComPtr<IProgress> progress; 360 CHECK_ERROR_BREAK(console, TakeSnapshot(name.raw(), desc.raw(), 361 progress.asOutParam())); 362 363 rc = showProgress(progress); 364 CHECK_PROGRESS_ERROR(progress, ("Failed to take snapshot")); 365 366 if (fPause) 367 { 368 MachineState_T machineState; 369 CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState)); 370 if (machineState == MachineState_Paused) 371 { 372 if (SUCCEEDED(rc)) 373 CHECK_ERROR_BREAK(console, Resume()); 374 else 375 console->Resume(); 376 } 377 } 346 ComPtr<IProgress> pProgress; 347 CHECK_ERROR_BREAK(pMachine, TakeSnapshot(name.raw(), desc.raw(), 348 fPause, 349 pProgress.asOutParam())); 350 351 rc = showProgress(pProgress); 352 CHECK_PROGRESS_ERROR(pProgress, ("Failed to take snapshot")); 378 353 } 379 354 else if ( (fDelete = !strcmp(a->argv[1], "delete")) … … 405 380 if (fRestoreCurrent) 406 381 { 407 CHECK_ERROR_BREAK(p trMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam()));382 CHECK_ERROR_BREAK(pMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam())); 408 383 } 409 384 else 410 385 { 411 386 // restore or delete snapshot: then resolve cmd line argument to snapshot instance 412 CHECK_ERROR_BREAK(p trMachine, FindSnapshot(Bstr(a->argv[2]).raw(),387 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]).raw(), 413 388 pSnapshot.asOutParam())); 414 389 } … … 418 393 if (fDelete) 419 394 { 420 CHECK_ERROR_BREAK( console, DeleteSnapshot(bstrSnapGuid.raw(),421 pProgress.asOutParam()));395 CHECK_ERROR_BREAK(pMachine, DeleteSnapshot(bstrSnapGuid.raw(), 396 pProgress.asOutParam())); 422 397 } 423 398 else … … 425 400 // restore or restore current 426 401 RTPrintf("Restoring snapshot %ls\n", bstrSnapGuid.raw()); 427 CHECK_ERROR_BREAK( console, RestoreSnapshot(pSnapshot, pProgress.asOutParam()));402 CHECK_ERROR_BREAK(pMachine, RestoreSnapshot(pSnapshot, pProgress.asOutParam())); 428 403 } 429 404 … … 440 415 } 441 416 442 ComPtr<ISnapshot> snapshot;417 ComPtr<ISnapshot> pSnapshot; 443 418 444 419 if ( !strcmp(a->argv[2], "--current") 445 420 || !strcmp(a->argv[2], "-current")) 446 421 { 447 CHECK_ERROR_BREAK(p trMachine, COMGETTER(CurrentSnapshot)(snapshot.asOutParam()));422 CHECK_ERROR_BREAK(pMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam())); 448 423 } 449 424 else 450 425 { 451 CHECK_ERROR_BREAK(p trMachine, FindSnapshot(Bstr(a->argv[2]).raw(),452 snapshot.asOutParam()));426 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]).raw(), 427 pSnapshot.asOutParam())); 453 428 } 454 429 … … 467 442 } 468 443 i++; 469 snapshot->COMSETTER(Name)(Bstr(a->argv[i]).raw());444 pSnapshot->COMSETTER(Name)(Bstr(a->argv[i]).raw()); 470 445 } 471 446 else if ( !strcmp(a->argv[i], "--description") … … 480 455 } 481 456 i++; 482 snapshot->COMSETTER(Description)(Bstr(a->argv[i]).raw());457 pSnapshot->COMSETTER(Description)(Bstr(a->argv[i]).raw()); 483 458 } 484 459 else … … 501 476 } 502 477 503 ComPtr<ISnapshot> snapshot;504 505 CHECK_ERROR_BREAK(p trMachine, FindSnapshot(Bstr(a->argv[2]).raw(),506 snapshot.asOutParam()));478 ComPtr<ISnapshot> pSnapshot; 479 480 CHECK_ERROR_BREAK(pMachine, FindSnapshot(Bstr(a->argv[2]).raw(), 481 pSnapshot.asOutParam())); 507 482 508 483 /* get the machine of the given snapshot */ 509 ComPtr<IMachine> p trMachine2;510 snapshot->COMGETTER(Machine)(ptrMachine2.asOutParam());511 showVMInfo(a->virtualBox, p trMachine2, VMINFO_NONE, console);484 ComPtr<IMachine> pMachine2; 485 pSnapshot->COMGETTER(Machine)(pMachine2.asOutParam()); 486 showVMInfo(a->virtualBox, pMachine2, NULL, VMINFO_NONE); 512 487 } 513 488 else if (!strcmp(a->argv[1], "list")) 514 rc = handleSnapshotList(a, p trMachine) == RTEXITCODE_SUCCESS ? S_OK : E_FAIL;489 rc = handleSnapshotList(a, pMachine) == RTEXITCODE_SUCCESS ? S_OK : E_FAIL; 515 490 else if (!strcmp(a->argv[1], "dump")) // undocumented parameter to debug snapshot info 516 DumpSnapshot(p trMachine);491 DumpSnapshot(pMachine); 517 492 else 518 493 {
Note:
See TracChangeset
for help on using the changeset viewer.