Changeset 84615 in vbox
- Timestamp:
- May 29, 2020 3:47:55 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py
r84590 r84615 414 414 return (fRc, uExitStatus, iExitCode, aBuf); 415 415 416 def uploadString(self, o Session, sSrcString, sDst):416 def uploadString(self, oGuestSession, sSrcString, sDst): 417 417 """ 418 418 Upload the string into guest. 419 419 """ 420 421 fRc, oGuestSession = self.createSession(oSession, 'vbox session for installing guest additions', 422 'vbox', 'password', cMsTimeout = 10 * 1000, fIsError = True); 423 if fRc is not True: 424 return reporter.errorXcpt('Upload string failed: Could not create session for vbox'); 425 420 fRc = True; 426 421 try: 427 422 oFile = oGuestSession.fileOpenEx(sDst, vboxcon.FileAccessMode_ReadWrite, vboxcon.FileOpenAction_CreateOrReplace, … … 439 434 fRc = reporter.errorXcpt('Upload string failed. Could not close the file %s' % sDst); 440 435 441 self.closeSession(oGuestSession); 442 return fRc; 443 444 def uploadFile(self, oSession, sSrc, sDst): 436 return fRc; 437 438 def uploadFile(self, oGuestSession, sSrc, sDst): 445 439 """ 446 440 Upload the string into guest. 447 441 """ 448 449 fRc, oGuestSession = self.createSession(oSession, 'vbox session for upload the file', 450 'vbox', 'password', cMsTimeout = 10 * 1000, fIsError = True); 451 if fRc is not True: 452 return reporter.errorXcpt('Upload file failed: Could not create session for vbox'); 453 442 fRc = True; 454 443 try: 455 444 if self.fpApiVer >= 5.0: … … 472 461 fRc = reporter.error('No progress object returned'); 473 462 474 self.closeSession(oGuestSession); 475 return fRc; 476 477 def downloadFile(self, oSession, sSrc, sDst, fIgnoreErrors = False): 463 return fRc; 464 465 def downloadFile(self, oGuestSession, sSrc, sDst, fIgnoreErrors = False): 478 466 """ 479 467 Upload the string into guest. 480 468 """ 481 482 fRc, oGuestSession = self.createSession(oSession, 'vbox session for download the file', 483 'vbox', 'password', cMsTimeout = 10 * 1000, fIsError = True); 484 if fRc is not True: 485 if not fIgnoreErrors: 486 return reporter.errorXcpt('Download file failed: Could not create session for vbox'); 487 reporter.log('warning: Download file failed: Could not create session for vbox'); 488 return False; 489 469 fRc = True; 490 470 try: 491 471 if self.fpApiVer >= 5.0: … … 514 494 fRc = False; 515 495 516 self.closeSession(oGuestSession); 517 return fRc; 518 519 def downloadFiles(self, oSession, asFiles, fIgnoreErrors = False): 496 return fRc; 497 498 def downloadFiles(self, oGuestSession, asFiles, fIgnoreErrors = False): 520 499 """ 521 500 Convenience function to get files from the guest and stores it … … 535 514 ## @todo Check for already existing files on the host and create a new 536 515 # name for the current file to download. 537 fRc = self.downloadFile(o Session, sGstFile, sTmpFile, fIgnoreErrors);516 fRc = self.downloadFile(oGuestSession, sGstFile, sTmpFile, fIgnoreErrors); 538 517 if fRc: 539 518 reporter.addLogFile(sTmpFile, 'misc/other', 'guest - ' + sGstFile); … … 560 539 """ 561 540 Waits the VM is ready after start or reboot. 541 Returns result (true or false) and guest session obtained 562 542 """ 563 543 # Give the VM a time to reboot … … 568 548 569 549 cAttempt = 0; 570 550 oGuestSession = None; 571 551 while cAttempt < 30: 572 552 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', … … 577 557 ['ifconfig',], 578 558 False, False); 579 fRc = self.closeSession(oGuestSession, False) and fRc and True; # pychecker hack.580 581 559 if fRc: 582 560 break; … … 585 563 cAttempt += 1; 586 564 587 return fRc;588 589 def rebootVMAndCheckReady(self, oSession ):565 return (fRc, oGuestSession); 566 567 def rebootVMAndCheckReady(self, oSession, oGuestSession): 590 568 """ 591 569 Reboot the VM and wait the VM is ready. 592 """ 593 594 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 595 'vbox', 'password', 10 * 1000, True); 596 if not fRc: 597 return fRc; 598 570 Returns result and guest session obtained after reboot 571 """ 599 572 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Reboot the VM', 600 573 30 * 1000, '/usr/bin/sudo', … … 602 575 False, True); 603 576 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 604 fRc = fRc and self.waitVMisReady(oSession); 605 return fRc; 606 607 def powerDownVM(self, oSession): 577 if fRc: 578 (fRc, oGuestSession) = self.waitVMisReady(oSession); 579 return (fRc, oGuestSession); 580 581 def powerDownVM(self, oGuestSession): 608 582 """ 609 583 Power down the VM by calling guest process without wating 610 the VM is really powered off. 584 the VM is really powered off. Also, closes the guest session. 611 585 It helps the terminateBySession to stop the VM without aborting. 612 586 """ 613 614 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 615 'vbox', 'password', 10 * 1000, True); 616 if not fRc: 617 return fRc; 587 588 if oGuestSession is None: 589 return False; 618 590 619 591 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Power down the VM', … … 624 596 return fRc; 625 597 626 def installAdditions(self, oSession, o VM):598 def installAdditions(self, oSession, oGuestSession, oVM): 627 599 """ 628 600 Install guest additions in the guest. 629 601 """ 630 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 631 'vbox', 'password', 10 * 1000, True); 632 if not fRc: 633 return fRc; 634 602 603 fRc = False; 635 604 # Install Kernel headers, which are required for actually installing the Linux Additions. 636 605 if oVM.OSTypeId.startswith('Debian') \ … … 671 640 672 641 else: 673 reporter.error('Installing Linux Additions for kind "%s" is not supported yet' % oVM.sKind);642 reporter.error('Installing Linux Additions for the "%s" is not supported yet' % oVM.OSTypeId); 674 643 fRc = False; 675 644 … … 688 657 # Due to the GA updates as separate process the above function returns before 689 658 # the actual installation finished. So just wait until the GA installed 690 fRc = self.waitVMisReady(oSession); 659 fRc = self.closeSession(oGuestSession); 660 if fRc: 661 (fRc, oGuestSession) = self.waitVMisReady(oSession); 691 662 692 663 # Download log files. … … 696 667 asLogFile = []; 697 668 asLogFile.append('/var/log/vboxadd-install.log'); 698 self.downloadFiles(oSession, asLogFile, fIgnoreErrors = True); 699 700 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 701 if fRc: 702 fRc = self.rebootVMAndCheckReady(oSession); 703 704 return fRc; 705 706 def installVirtualBox(self, oSession): 669 self.downloadFiles(oGuestSession, asLogFile, fIgnoreErrors = True); 670 671 if fRc: 672 (fRc, oGuestSession) = self.rebootVMAndCheckReady(oSession, oGuestSession); 673 674 return (fRc, oGuestSession); 675 676 def installVirtualBox(self, oGuestSession): 707 677 """ 708 678 Install VirtualBox in the guest. … … 711 681 return False; 712 682 713 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 714 'vbox', 'password', 10 * 1000, True); 715 if not fRc: 716 return fRc; 717 718 fRc = self.uploadFile(oSession, self.sTestBuild, 683 fRc = self.uploadFile(oGuestSession, self.sTestBuild, 719 684 '/tmp/' + os.path.basename(self.sTestBuild)); 720 685 … … 732 697 '/tmp/' + os.path.basename(self.sTestBuild),], 733 698 False, True); 734 735 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 736 return fRc; 737 738 def configureAutostart(self, oSession, sDefaultPolicy = 'allow', 699 return fRc; 700 701 def configureAutostart(self, oGuestSession, sDefaultPolicy = 'allow', 739 702 asUserAllow = (), asUserDeny = ()): 740 703 """ 741 704 Configures the autostart feature in the guest. 742 705 """ 743 744 fRc, oGuestSession = self.createSession(oSession, 'Session for confiure autostart',745 'vbox', 'password', 10 * 1000, True);746 if not fRc:747 return fRc;748 706 749 707 # Create autostart database directory writeable for everyone … … 755 713 sVBoxCfg = 'VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg\n' \ 756 714 + 'VBOXAUTOSTART_DB=/etc/vbox/autostart.d\n'; 757 fRc = fRc and self.uploadString(o Session, sVBoxCfg, '/tmp/virtualbox');715 fRc = fRc and self.uploadString(oGuestSession, sVBoxCfg, '/tmp/virtualbox'); 758 716 if fRc: 759 717 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Moving to destination', … … 770 728 771 729 sVBoxCfg = self._createAutostartCfg(sDefaultPolicy, asUserAllow, asUserDeny); 772 fRc = fRc and self.uploadString(o Session, sVBoxCfg, '/tmp/autostart.cfg');730 fRc = fRc and self.uploadString(oGuestSession, sVBoxCfg, '/tmp/autostart.cfg'); 773 731 if fRc: 774 732 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Moving to destination', … … 783 741 '/etc/vbox/autostart.cfg'], 784 742 False, True); 785 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 786 return fRc; 787 788 def createUser(self, oSession, sUser): 743 return fRc; 744 745 def createUser(self, oGuestSession, sUser): 789 746 """ 790 747 Create a new user with the given name 791 748 """ 792 749 793 fRc, oGuestSession = self.createSession(oSession, 'Creating new user', 794 'vbox', 'password', 10 * 1000, True); 795 if fRc: 796 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Creating new user', 797 30 * 1000, '/usr/bin/sudo', 798 ['/usr/bin/sudo', '/usr/sbin/useradd', '-m', '-U', 799 sUser], False, True); 800 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 750 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Creating new user', 751 30 * 1000, '/usr/bin/sudo', 752 ['/usr/bin/sudo', '/usr/sbin/useradd', '-m', '-U', 753 sUser], False, True); 801 754 return fRc; 802 755 803 756 # pylint: enable=too-many-arguments 804 757 805 def createTestVM(self, oSession, sUser, sVmName):758 def createTestVM(self, oSession, oGuestSession, sUser, sVmName): 806 759 """ 807 760 Create a test VM in the guest and enable autostart. … … 809 762 all calls will be perfomed using 'sudo -u sUser' 810 763 """ 811 812 fRc, oGuestSession = self.createSession(oSession, 'Session for create VM for user: %s' % (sUser,), 813 'vbox', 'password', 10 * 1000, True); 814 if not fRc: 815 return fRc; 764 765 _ = oSession; 816 766 817 767 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Configuring autostart database', … … 832 782 '/opt/VirtualBox/VBoxManage', 'modifyvm', 833 783 sVmName, '--autostart-enabled', 'on'], False, True); 834 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 835 return fRc; 836 837 def checkForRunningVM(self, oSession, sUser, sVmName): 784 return fRc; 785 786 def checkForRunningVM(self, oSession, oGuestSession, sUser, sVmName): 838 787 """ 839 788 Check for VM running in the guest after autostart. … … 842 791 """ 843 792 844 fRc, oGuestSession = self.createSession(oSession, 'Session for checking running VMs for user: %s' % (sUser,), 845 'vbox', 'password', 10 * 1000, True); 846 if not fRc: 847 return fRc; 793 _ = oSession; 848 794 849 795 (fRc, _, _, aBuf) = self.guestProcessExecute(oGuestSession, 'Check for running VM', … … 857 803 fRc = bufWrapper.sVmRunning == sVmName; 858 804 859 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack.860 805 return fRc; 861 806 … … 906 851 907 852 cAttempt = 0; 908 853 oGuestSession = None; 909 854 while cAttempt < 10: 910 855 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', … … 915 860 ['C:\\Windows\\System32\\ipconfig.exe',], 916 861 False, False); 917 fRc = self.closeSession(oGuestSession, False) and fRc and True; # pychecker hack.918 919 862 if fRc: 920 863 break; … … 923 866 cAttempt += 1; 924 867 925 return fRc;926 927 def rebootVMAndCheckReady(self, oSession ):868 return (fRc, oGuestSession); 869 870 def rebootVMAndCheckReady(self, oSession, oGuestSession): 928 871 """ 929 872 Reboot the VM and wait the VM is ready. 930 873 """ 931 932 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox',933 'vbox', 'password', 10 * 1000, True);934 if not fRc:935 return fRc;936 874 937 875 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Reboot the VM', … … 941 879 False, True); 942 880 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 943 944 fRc = fRc andself.waitVMisReady(oSession);945 return fRc;946 947 def powerDownVM(self, o Session):881 if fRc: 882 (fRc, oGuestSession) = self.waitVMisReady(oSession); 883 return (fRc, oGuestSession); 884 885 def powerDownVM(self, oGuestSession): 948 886 """ 949 887 Power down the VM by calling guest process without wating 950 the VM is really powered off. 888 the VM is really powered off. Also, closes the guest session. 951 889 It helps the terminateBySession to stop the VM without aborting. 952 890 """ 953 954 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 955 'vbox', 'password', 10 * 1000, True); 956 if not fRc: 957 return fRc; 891 892 if oGuestSession is None: 893 return False; 958 894 959 895 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Power down the VM', … … 965 901 return fRc; 966 902 967 def installAdditions(self, oSession, o VM):903 def installAdditions(self, oSession, oGuestSession, oVM): 968 904 """ 969 905 Installs the Windows guest additions using the test execution service. 970 906 """ 971 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox',972 'vbox', 'password', 10 * 1000, True);973 if not fRc:974 return fRc;975 907 # 976 908 # Delete relevant log files. … … 1000 932 except: pass; 1001 933 1002 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack.934 fRc = self.closeSession(oGuestSession, True); # pychecker hack. 1003 935 1004 936 try: … … 1020 952 1021 953 if fRc: 1022 fRc = self.rebootVMAndCheckReady(oSession); 954 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 955 'vbox', 'password', 10 * 1000, True); 1023 956 if fRc is True: 1024 # Add the Windows Guest Additions installer files to the files we want to download 1025 # from the guest. 1026 sGuestAddsDir = 'C:/Program Files/Oracle/VirtualBox Guest Additions/'; 1027 asLogFiles.append(sGuestAddsDir + 'install.log'); 1028 # Note: There won't be a install_ui.log because of the silent installation. 1029 asLogFiles.append(sGuestAddsDir + 'install_drivers.log'); 1030 asLogFiles.append('C:/Windows/setupapi.log'); 1031 1032 # Note: setupapi.dev.log only is available since Windows 2000. 1033 if fHaveSetupApiDevLog: 1034 asLogFiles.append('C:/Windows/setupapi.dev.log'); 1035 1036 # 1037 # Download log files. 1038 # Ignore errors as all files above might not be present (or in different locations) 1039 # on different Windows guests. 1040 # 1041 self.downloadFiles(oSession, asLogFiles, fIgnoreErrors = True); 1042 1043 return fRc; 1044 1045 def installVirtualBox(self, oSession): 957 (fRc, oGuestSession) = self.rebootVMAndCheckReady(oSession, oGuestSession); 958 if fRc is True: 959 # Add the Windows Guest Additions installer files to the files we want to download 960 # from the guest. 961 sGuestAddsDir = 'C:/Program Files/Oracle/VirtualBox Guest Additions/'; 962 asLogFiles.append(sGuestAddsDir + 'install.log'); 963 # Note: There won't be a install_ui.log because of the silent installation. 964 asLogFiles.append(sGuestAddsDir + 'install_drivers.log'); 965 asLogFiles.append('C:/Windows/setupapi.log'); 966 967 # Note: setupapi.dev.log only is available since Windows 2000. 968 if fHaveSetupApiDevLog: 969 asLogFiles.append('C:/Windows/setupapi.dev.log'); 970 971 # 972 # Download log files. 973 # Ignore errors as all files above might not be present (or in different locations) 974 # on different Windows guests. 975 # 976 self.downloadFiles(oGuestSession, asLogFiles, fIgnoreErrors = True); 977 978 return (fRc, oGuestSession); 979 980 def installVirtualBox(self, oGuestSession): 1046 981 """ 1047 982 Install VirtualBox in the guest. … … 1051 986 return False; 1052 987 1053 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox',1054 'vbox', 'password', 10 * 1000, True);1055 if not fRc:1056 return fRc;1057 1058 988 # Used windows image already contains the C:\Temp 1059 fRc = fRc and self.uploadFile(oSession, self.sTestBuild,1060 989 fRc = self.uploadFile(oGuestSession, self.sTestBuild, 990 'C:\\Temp\\' + os.path.basename(self.sTestBuild)); 1061 991 1062 992 if fRc: … … 1072 1002 ['C:\\Temp\\' + os.path.basename(self.sTestBuild), '--silent'], 1073 1003 False, True); 1074 1075 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 1076 return fRc; 1077 1078 def configureAutostart(self, oSession, sDefaultPolicy = 'allow', 1004 return fRc; 1005 1006 def configureAutostart(self, oGuestSession, sDefaultPolicy = 'allow', 1079 1007 asUserAllow = (), asUserDeny = ()): 1080 1008 """ 1081 1009 Configures the autostart feature in the guest. 1082 1010 """ 1083 1084 fRc, oGuestSession = self.createSession(oSession, 'Session for confiure autostart',1085 'vbox', 'password', 10 * 1000, True);1086 if not fRc:1087 return fRc;1088 1011 1089 1012 # Create autostart database directory writeable for everyone … … 1098 1021 1099 1022 sVBoxCfg = self._createAutostartCfg(sDefaultPolicy, asUserAllow, asUserDeny); 1100 fRc = fRc and self.uploadString(oSession, sVBoxCfg, 'C:\\ProgramData\\autostart.cfg'); 1101 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 1102 return fRc; 1103 1104 def createTestVM(self, oSession, sUser, sVmName): 1023 fRc = fRc and self.uploadString(oGuestSession, sVBoxCfg, 'C:\\ProgramData\\autostart.cfg'); 1024 return fRc; 1025 1026 def createTestVM(self, oSession, oGuestSession, sUser, sVmName): 1105 1027 """ 1106 1028 Create a test VM in the guest and enable autostart. 1107 1029 """ 1030 _ = oGuestSession; 1108 1031 1109 1032 fRc, oGuestSession = self.createSession(oSession, 'Session for user: %s' % (sUser,), … … 1123 1046 ['C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 1124 1047 'modifyvm', sVmName, '--autostart-enabled', 'on'], False, True); 1125 fRc = fRc and self.uploadString(o Session, 'password', 'C:\\ProgramData\\password.cfg');1048 fRc = fRc and self.uploadString(oGuestSession, 'password', 'C:\\ProgramData\\password.cfg'); 1126 1049 if fRc: 1127 1050 (fRc, _, _, _) = \ … … 1136 1059 return fRc; 1137 1060 1138 def checkForRunningVM(self, oSession, sUser, sVmName):1061 def checkForRunningVM(self, oSession, oGuestSession, sUser, sVmName): 1139 1062 """ 1140 1063 Check for VM running in the guest after autostart. 1141 1064 """ 1142 1065 1066 _ = oGuestSession; 1067 1143 1068 fRc, oGuestSession = self.createSession(oSession, 'Session for user: %s' % (sUser,), 1144 1069 sUser, 'password', 10 * 1000, True); … … 1159 1084 return fRc; 1160 1085 1161 def createUser(self, o Session, sUser):1086 def createUser(self, oGuestSession, sUser): 1162 1087 """ 1163 1088 Create a new user with the given name 1164 1089 """ 1165 1166 fRc, oGuestSession = self.createSession(oSession, 'Creating user %s to run a VM' % sUser,1167 'vbox', 'password', 10 * 1000, True);1168 if not fRc:1169 return fRc;1170 1090 1171 1091 # Create user … … 1216 1136 WScript.Echo "Logon As A Service Right granted to user '"& strUserName &"'" 1217 1137 """ % sUser; 1218 fRc = fRc and self.uploadString(o Session, sSecPolicyEditor, 'C:\\Temp\\adjustsec.vbs');1138 fRc = fRc and self.uploadString(oGuestSession, sSecPolicyEditor, 'C:\\Temp\\adjustsec.vbs'); 1219 1139 if fRc: 1220 1140 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, … … 1226 1146 except: 1227 1147 fRc = reporter.errorXcpt('Removing policy script failed'); 1228 1229 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack.1230 1148 return fRc; 1231 1149 … … 1245 1163 vbox.TestDriver.__init__(self); 1246 1164 self.asRsrcs = None; 1247 self.asTestVMsDef = [self.ksOs Linux, self.ksOsWindows];1165 self.asTestVMsDef = [self.ksOsWindows, self.ksOsLinux]; #[self.ksOsLinux, self.ksOsWindows]; 1248 1166 self.asTestVMs = self.asTestVMsDef; 1249 1167 self.asSkipVMs = []; … … 1428 1346 if oGuestOsHlp is not None: 1429 1347 #wait the VM is ready after starting 1430 fRc= oGuestOsHlp.waitVMisReady(oSession);1348 (fRc, oGuestSession) = oGuestOsHlp.waitVMisReady(oSession); 1431 1349 #install fresh guest additions 1432 fRc = fRc and oGuestOsHlp.installAdditions(oSession, oVM); 1350 if fRc: 1351 (fRc, oGuestSession) = oGuestOsHlp.installAdditions(oSession, oGuestSession, oVM); 1433 1352 # Create two new users 1434 fRc = fRc and oGuestOsHlp.createUser(o Session, sTestUserAllow);1435 fRc = fRc and oGuestOsHlp.createUser(o Session, sTestUserDeny);1353 fRc = fRc and oGuestOsHlp.createUser(oGuestSession, sTestUserAllow); 1354 fRc = fRc and oGuestOsHlp.createUser(oGuestSession, sTestUserDeny); 1436 1355 if fRc is True: 1437 1356 # Install VBox first 1438 fRc = oGuestOsHlp.installVirtualBox(o Session);1357 fRc = oGuestOsHlp.installVirtualBox(oGuestSession); 1439 1358 if fRc is True: 1440 fRc = oGuestOsHlp.configureAutostart(o Session, 'allow', (sTestUserAllow,), (sTestUserDeny,));1359 fRc = oGuestOsHlp.configureAutostart(oGuestSession, 'allow', (sTestUserAllow,), (sTestUserDeny,)); 1441 1360 if fRc is True: 1442 1361 # Create a VM with autostart enabled in the guest for both users 1443 fRc = oGuestOsHlp.createTestVM(oSession, sTestUserAllow, sTestVmName);1444 fRc = fRc and oGuestOsHlp.createTestVM(oSession, sTestUserDeny, sTestVmName);1362 fRc = oGuestOsHlp.createTestVM(oSession, oGuestSession, sTestUserAllow, sTestVmName); 1363 fRc = fRc and oGuestOsHlp.createTestVM(oSession, oGuestSession, sTestUserDeny, sTestVmName); 1445 1364 if fRc is True: 1446 1365 # Reboot the guest 1447 fRc = oGuestOsHlp.rebootVMAndCheckReady(oSession);1366 (fRc, oGuestSession) = oGuestOsHlp.rebootVMAndCheckReady(oSession, oGuestSession); 1448 1367 if fRc is True: 1449 1368 # Fudge factor - Allow the guest to finish starting up. 1450 1369 self.sleep(30); 1451 fRc = oGuestOsHlp.checkForRunningVM(oSession, sTestUserAllow, sTestVmName);1370 fRc = oGuestOsHlp.checkForRunningVM(oSession, oGuestSession, sTestUserAllow, sTestVmName); 1452 1371 if fRc is True: 1453 fRc = oGuestOsHlp.checkForRunningVM(oSession, sTestUserDeny, sTestVmName);1372 fRc = oGuestOsHlp.checkForRunningVM(oSession, oGuestSession, sTestUserDeny, sTestVmName); 1454 1373 if fRc is True: 1455 1374 reporter.error('Test VM is running inside the guest for denied user'); … … 1468 1387 reporter.log('Creating test users failed'); 1469 1388 1470 try: oGuestOsHlp.powerDownVM(oSession);1471 except: pass;1472 1389 if oGuestSession is not None: 1390 try: oGuestOsHlp.powerDownVM(oGuestSession); 1391 except: pass; 1473 1392 else: 1474 1393 reporter.log('Guest OS helper not created for VM %s' % (sVmName));
Note:
See TracChangeset
for help on using the changeset viewer.