Changeset 31008 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Jul 22, 2010 3:24:27 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r30321 r31008 1864 1864 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]), ptrMachine.asOutParam()), 1); 1865 1865 1866 Bstr bstrMachineUuid; 1867 CHECK_ERROR_RET(ptrMachine, COMGETTER(Id)(bstrMachineUuid.asOutParam()), 1); 1868 CHECK_ERROR_RET(aVirtualBox, OpenExistingSession(aSession, bstrMachineUuid), 1); 1866 CHECK_ERROR_RET(ptrMachine, LockForSession(aSession, true /* fPermitShared */, NULL), 1); 1869 1867 1870 1868 /* -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r30396 r31008 73 73 /* try to find the given machine */ 74 74 ComPtr <IMachine> machine; 75 Bstr machineuuid 75 Bstr machineuuid(a->argv[0]); 76 76 if (!Guid(machineuuid).isEmpty()) 77 77 { … … 88 88 89 89 /* open a session for the VM */ 90 CHECK_ERROR_RET( a->virtualBox, OpenExistingSession(a->session, machineuuid), 1);90 CHECK_ERROR_RET(machine, LockForSession(a->session, true /* fPermitShared */, NULL), 1); 91 91 92 92 do -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r30681 r31008 285 285 do 286 286 { 287 Bstr uuid; 288 machine->COMGETTER(Id)(uuid.asOutParam()); 289 290 /* open an existing session for VM - so the VM has to be running */ 291 CHECK_ERROR_BREAK(a->virtualBox, OpenExistingSession(a->session, uuid)); 287 /* open an existing session for VM */ 288 CHECK_ERROR_BREAK(machine, LockForSession(a->session, true /* fPermitShared */, NULL)); 289 // @todo r=dj assert that it's an existing session 292 290 293 291 /* get the mutable session machine */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp
r30871 r31008 87 87 if (machine) 88 88 { 89 Bstr uuid;90 machine->COMGETTER(Id)(uuid.asOutParam());91 92 89 /* open a session for the VM - new or existing */ 93 if (FAILED (a->virtualBox->OpenSession(a->session, uuid))) 94 CHECK_ERROR_RET(a->virtualBox, OpenExistingSession(a->session, uuid), 1); 90 CHECK_ERROR_RET(machine, LockForSession(a->session, true /* fPermitShared */, NULL), 1); 95 91 96 92 /* get the mutable session machine */ … … 156 152 if (machine) 157 153 { 158 Bstr uuid;159 machine->COMGETTER(Id)(uuid.asOutParam());160 161 154 /* open a session for the VM - new or existing */ 162 if (FAILED (a->virtualBox->OpenSession(a->session, uuid))) 163 CHECK_ERROR_RET (a->virtualBox, OpenExistingSession(a->session, uuid), 1); 155 CHECK_ERROR_RET(machine, LockForSession(a->session, true /* fPermitShared */, NULL), 1); 164 156 165 157 /* get the mutable session machine */ … … 220 212 if (machine) 221 213 { 222 Bstr uuid;223 machine->COMGETTER(Id)(uuid.asOutParam());224 225 214 /* open a session for the VM - new or existing */ 226 if (FAILED(a->virtualBox->OpenSession(a->session, uuid))) 227 CHECK_ERROR_RET (a->virtualBox, OpenExistingSession(a->session, uuid), 1); 215 CHECK_ERROR_RET(machine, LockForSession(a->session, true /* fPermitShared */, NULL), 1); 228 216 229 217 /* get the mutable session machine */ 230 218 a->session->COMGETTER(Machine)(machine.asOutParam()); 231 219 232 com::SafeArray 233 com::SafeArray 234 com::SafeArray 235 com::SafeArray 220 com::SafeArray<BSTR> names; 221 com::SafeArray<BSTR> values; 222 com::SafeArray<ULONG64> timestamps; 223 com::SafeArray<BSTR> flags; 236 224 CHECK_ERROR(machine, EnumerateGuestProperties(Bstr(Utf8Patterns), 237 225 ComSafeArrayAsOutParam(names), -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r30976 r31008 2132 2132 details = VMINFO_STANDARD; 2133 2133 2134 ComPtr 2134 ComPtr<IConsole> console; 2135 2135 2136 2136 /* open an existing session for the VM */ 2137 rc = a->virtualBox->OpenExistingSession(a->session, uuid);2137 rc = machine->LockForSession(a->session, true /* fPermitShared */, NULL); 2138 2138 if (SUCCEEDED(rc)) 2139 2139 /* get the session machine */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r31002 r31008 356 356 if (machine) 357 357 { 358 Bstr uuid;359 machine->COMGETTER(Id)(uuid.asOutParam());360 361 362 358 Bstr env; 363 359 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) … … 373 369 #endif 374 370 ComPtr<IProgress> progress; 375 CHECK_ERROR_RET(a->virtualBox, OpenRemoteSession(a->session, uuid, sessionType, 376 env, progress.asOutParam()), rc); 371 CHECK_ERROR_RET(machine, LaunchVMProcess(a->session, sessionType, env, progress.asOutParam()), rc); 377 372 RTPrintf("Waiting for the VM to power on...\n"); 378 373 CHECK_ERROR_RET(progress, WaitForCompletion(-1), 1); … … 423 418 { 424 419 /* we have to open a session for this task */ 425 Bstr guid; 426 machine->COMGETTER(Id)(guid.asOutParam()); 427 CHECK_ERROR_BREAK(a->virtualBox, OpenSession(a->session, guid)); 420 CHECK_ERROR_BREAK(machine, LockForSession(a->session, false /* fPermitShared */, NULL)); 428 421 do 429 422 { … … 459 452 { 460 453 /* we have to open a session for this task */ 461 Bstr guid; 462 machine->COMGETTER(Id)(guid.asOutParam()); 463 CHECK_ERROR_BREAK(a->virtualBox, OpenSession(a->session, guid)); 454 CHECK_ERROR_BREAK(machine, LockForSession(a->session, false /* fPermitShared */, NULL)); 464 455 do 465 456 { … … 671 662 if (!machine) 672 663 return 1; 673 Bstr uuid;674 machine->COMGETTER(Id)(uuid.asOutParam());675 664 676 665 if (!strcmp(a->argv[0], "add")) … … 737 726 738 727 /* open an existing session for the VM */ 739 CHECK_ERROR_RET( a->virtualBox, OpenExistingSession(a->session, uuid), 1);728 CHECK_ERROR_RET(machine, LockForSession(a->session, true /* fPermitShared */, NULL), 1); 740 729 /* get the session machine */ 741 730 CHECK_ERROR_RET(a->session, COMGETTER(Machine)(machine.asOutParam()), 1); … … 751 740 { 752 741 /* open a session for the VM */ 753 CHECK_ERROR_RET( a->virtualBox, OpenSession(a->session, uuid), 1);742 CHECK_ERROR_RET(machine, LockForSession(a->session, false /* fPermitShared */, NULL), 1); 754 743 755 744 /* get the mutable session machine */ … … 801 790 802 791 /* open an existing session for the VM */ 803 CHECK_ERROR_RET( a->virtualBox, OpenExistingSession(a->session, uuid), 1);792 CHECK_ERROR_RET(machine, LockForSession(a->session, true /* fPermitShared */, NULL), 1); 804 793 /* get the session machine */ 805 794 CHECK_ERROR_RET(a->session, COMGETTER(Machine)(machine.asOutParam()), 1); … … 815 804 { 816 805 /* open a session for the VM */ 817 CHECK_ERROR_RET( a->virtualBox, OpenSession(a->session, uuid), 1);806 CHECK_ERROR_RET(machine, LockForSession(a->session, false /* fPermitShared */, NULL), 1); 818 807 819 808 /* get the mutable session machine */ … … 842 831 843 832 /* try to find the given machine */ 844 ComPtr 845 Bstr uuid 846 if (!Guid 833 ComPtr<IMachine> machine; 834 Bstr uuid(a->argv[0]); 835 if (!Guid(a->argv[0]).isEmpty()) 847 836 CHECK_ERROR(a->virtualBox, GetMachine(uuid, machine.asOutParam())); 848 837 else 849 838 { 850 839 CHECK_ERROR(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam())); 851 if (SUCCEEDED 840 if (SUCCEEDED(rc)) 852 841 machine->COMGETTER(Id)(uuid.asOutParam()); 853 842 } … … 885 874 886 875 /* open an existing session for the VM. */ 887 CHECK_ERROR( a->virtualBox, OpenExistingSession(a->session, uuid));876 CHECK_ERROR(machine, LockForSession(a->session, true /* fPermitShared */, NULL)); 888 877 if (SUCCEEDED(rc)) 889 878 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r30976 r31008 275 275 HRESULT rc; 276 276 Bstr name; 277 Bstr machineuuid 277 Bstr machineuuid(a->argv[0]); 278 278 RTGETOPTUNION ValueUnion; 279 279 RTGETOPTSTATE GetOptState; … … 312 312 313 313 /* open a session for the VM */ 314 CHECK_ERROR_RET( a->virtualBox, OpenSession(a->session, machineuuid), 1);314 CHECK_ERROR_RET(machine, LockForSession(a->session, false /* fPermitShared */, NULL), 1); 315 315 316 316 /* get the mutable session machine */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
r28870 r31008 236 236 if (!pMachine) 237 237 return 1; 238 Bstr guidMachine;239 pMachine->COMGETTER(Id)(guidMachine.asOutParam());240 238 241 239 do 242 240 { 243 /* we have to open a session for this task. First try an existing session */ 244 rc = a->virtualBox->OpenExistingSession(a->session, guidMachine); 245 if (FAILED(rc)) 246 CHECK_ERROR_BREAK(a->virtualBox, OpenSession(a->session, guidMachine)); 241 /* we have to open a session for this task (new or shared) */ 242 rc = pMachine->LockForSession(a->session, true /* fPermitShared */, NULL); 247 243 ComPtr<IConsole> console; 248 244 CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam())); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r30403 r31008 60 60 ULONG port = ~0U; 61 61 ULONG device = ~0U; 62 bool fRunTime = false;63 62 bool fForceUnmount = false; 64 63 const char *pszCtl = NULL; … … 148 147 } 149 148 } 150 149 151 150 if (FAILED(rc)) 152 151 return 1; … … 173 172 } 174 173 175 /* open a session for the VM */ 176 rc = a->virtualBox->OpenSession(a->session, machineuuid); 177 if (FAILED(rc)) 178 { 179 /* try to open an existing session for the VM */ 180 CHECK_ERROR_RET(a->virtualBox, OpenExistingSession(a->session, machineuuid), 1); 181 fRunTime = true; 182 } 183 174 /* open a session for the VM (new or shared) */ 175 SessionType_T type; 176 rc = machine->LockForSession(a->session, true /* fPermitShared */, &type); 177 bool fRunTime = (type == SessionType_Shared); 184 178 if (fRunTime && !RTStrICmp(pszType, "hdd")) 185 179 { … … 761 755 762 756 /* open a session for the VM */ 763 CHECK_ERROR_RET( a->virtualBox, OpenSession (a->session, machineuuid), 1);757 CHECK_ERROR_RET(machine, LockForSession(a->session, false /* fPermitShared */, NULL), 1); 764 758 765 759 /* get the mutable session machine */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp
r28800 r31008 416 416 else 417 417 { 418 Bstr uuid;419 cmd.mMachine->COMGETTER(Id)(uuid.asOutParam());420 418 /* open a session for the VM */ 421 CHECK_ERROR_RET (a->virtualBox, OpenSession(a->session, uuid), 1);419 CHECK_ERROR_RET(cmd.mMachine, LockForSession(a->session, false /* fPermitShared */, NULL), 1); 422 420 /* get the mutable session machine */ 423 421 a->session->COMGETTER(Machine)(cmd.mMachine.asOutParam()); 424 422 /* and get the USB controller */ 425 CHECK_ERROR_RET (cmd.mMachine, COMGETTER(USBController)(ctl.asOutParam()), 1);423 CHECK_ERROR_RET(cmd.mMachine, COMGETTER(USBController)(ctl.asOutParam()), 1); 426 424 } 427 425
Note:
See TracChangeset
for help on using the changeset viewer.