Changeset 71379 in vbox for trunk/src/VBox/ValidationKit/tests
- Timestamp:
- Mar 19, 2018 7:48:02 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/api/tdMoveVM.py
r71377 r71379 151 151 if os.path.abspath(sFilePath) != os.path.abspath(sActualFilePath): 152 152 reporter.log('medium location expected to be "%s" but is "%s"' % (sFilePath, sActualFilePath)) 153 fRc = False ;153 fRc = False 154 154 if not os.path.exists(sFilePath): 155 155 reporter.log('medium file does not exist at "%s"' % (sFilePath,)) 156 fRc = False ;156 fRc = False 157 157 return fRc 158 158 … … 176 176 177 177 if not self.oTstDrv.importVBoxApi(): 178 return False ;178 return False 179 179 180 180 isSupported = self.checkAPIVersion() … … 284 284 # And next move VM 285 285 286 #Close and delete Session object because after starting VM we get new instance of session 287 # fRc = oSession.close() and fRc 288 # if fRc is False: 289 # reporter.log('Couldn\'t close machine session') 290 # 291 # del oSession 292 # 293 # #Run VM and get new Session object 294 # oSession = self.oTstDrv.startVm(oMachine) 295 # 296 # #some time interval should be here for not closing VM just after start 297 # time.sleep(1) 298 # 299 # if oMachine.state != self.oTstDrv.oVBoxMgr.constants.MachineState_Running: 300 # reporter.log("Machine '%s' is not Running" % (oMachine.name)) 301 # fRc = False 302 # 303 # oConsole = oSession.o.console 304 # 305 # #logic comes from handleControlVM() 306 # #Pause VM using console object 307 # fRc = oConsole.pause() and fRc 308 # 309 # #Check VM state 310 # if oMachine.state == self.oTstDrv.oVBoxMgr.constants.MachineState_Paused: 311 # reporter.log("Machine '%s' is Paused" % (oMachine.name)) 312 # fRc = True 313 # 314 # #call Session::saveState() 315 # if fRc is True: 316 # oProgress = oSession.o.machine.saveState() 317 # rc = self.oTstDrv.waitOnProgress(oProgress,1000) 318 # self.oTstDrv.sleep(2) 319 # 320 # #Close and delete Session object because this session hasn't been locked 321 # #but locking is needed to run moveVMToLocation(). 322 # #if to use the current session object we'll get the error "The session is not locked (session state: Unlocked)" 323 # fRc = oSession.close() and fRc 324 # if fRc is False: 325 # reporter.log('Couldn\'t close machine session') 326 # 327 # del oSession 328 # del oConsole 329 # 330 # sLoc = sMoveLoc + os.sep + oMachine.name + os.sep 331 # sMoveLoc = os.path.join(sOrigLoc, 'moveFolder_4th_scenario') 332 # os.mkdir(sMoveLoc, 0o775) 333 # 334 # #Create a new Session object 335 # #It seems that it's possible to lock VM only via creating a pure Session object (not SessionWrapper as it was before) 336 # #and call Machine::lockMachine() 337 # oVirtualBox = self.oTstDrv.oVBoxMgr.getVirtualBox() 338 # oNewSession = self.oTstDrv.oVBoxMgr.mgr.getSessionObject(oVirtualBox) 339 # 340 # oMachine.lockMachine(oNewSession, self.oTstDrv.oVBoxMgr.constants.LockType_Write) 341 # fRc = self.moveVMToLocation(sMoveLoc, oNewSession.machine) and fRc 342 # oNewSession.unlockMachine() 343 # 344 # del oNewSession 345 # 346 # #call Session::discardSavedState() 347 # #for this we delete oNewSession object earlier and creating SessionWrapper object here 348 # oSession = self.oTstDrv.openSession(oMachine) 349 # fRc = oSession.o.machine.discardSavedState(True) 350 # reporter.log('Discard save machine state') 351 # 352 # del oMachine 353 # del oVirtualBox 354 # 355 # if fRc is False: 356 # reporter.log('Failed to discard the saved state of machine') 286 #Close Session object because after starting VM we get new instance of session 287 fRc = oSession.close() and fRc 288 if fRc is False: 289 reporter.log('Couldn\'t close machine session') 290 291 #Run VM and get new Session object 292 oSession = self.oTstDrv.startVm(oMachine) 293 294 #some time interval should be here for not closing VM just after start 295 time.sleep(1) 296 297 if oMachine.state != self.oTstDrv.oVBoxMgr.constants.MachineState_Running: 298 reporter.log("Machine '%s' is not Running" % (oMachine.name)) 299 fRc = False 300 301 #call Session::saveState(), already closes session unless it failed 302 fRc = fRc and oSession.saveState() 303 self.oTstDrv.terminateVmBySession(oSession) 304 305 if fRc: 306 sLoc = sMoveLoc + os.sep + oMachine.name + os.sep 307 sMoveLoc = os.path.join(sOrigLoc, 'moveFolder_4th_scenario') 308 os.mkdir(sMoveLoc, 0o775) 309 310 #create a new Session object for moving VM 311 oSession = self.oTstDrv.openSession(oMachine) 312 fRc = self.moveVMToLocation(sMoveLoc, oSession.o.machine) and fRc 313 314 # cleaning up: get rid of saved state 315 fRc = fRc and oSession.o.machine.discardSavedState(True) 316 if fRc is False: 317 reporter.log('Failed to discard the saved state of machine') 357 318 358 319 ############## 5 case. ##########################################################################################
Note:
See TracChangeset
for help on using the changeset viewer.