Esempio n. 1
0
    def run(self, arglist=None):
        step("Trying to create SR of type %s" % (self.srtype))
        sr = self.createSR()

        step("Installing the guest %s on the SR %s" % (self.distro, self.srtype))
        self.guest = self.host.createBasicGuest(distro=self.distro, sr=sr.uuid)
        self.uninstallOnCleanup(self.guest)
        self.guest.preCloneTailor()
        self.guest.setState("DOWN")

        step("Preparing scripts and output")
        self.output = []
        if isinstance(self.host, xenrt.lib.xenserver.Host):
            self.host.execdom0("echo 'TIMEFORMAT=%%6R; (time xe vm-clone uuid=%s new-name-label=clone) > %s 2>&1' > %s" %
                    (self.guest.getUUID(), self.OUTPUT_PATH, self.SCRIPT_CLONE_PATH))
            self.host.execdom0("chmod +x %s" % self.SCRIPT_CLONE_PATH)
            self.host.execdom0("echo 'TIMEFORMAT=%%6R; (time xe vm-uninstall uuid=$1 --force) > %s 2>&1' > %s" %
                    (self.OUTPUT_PATH, self.SCRIPT_UNINSTALL_PATH))
            self.host.execdom0("chmod +x %s" % self.SCRIPT_UNINSTALL_PATH)

        step("Start cloning the guests sequentially...")
        self.cloneVMSerial()

        step("Start Uninstalling the guests sequentially...")
        self.destroyVMSerial()

        self.createLogFile()
Esempio n. 2
0
    def run(self, arglist=None):
        args = self.parseArgsKeyValue(arglist)
        # numThreads specifies the number of tcp streams between the two end points. By Default it is set to 1
        numThreads = int(args.get("num_threads", "1"))
        distmasterBase = xenrt.TEC().lookup("TEST_TARBALL_BASE")
        endpoint0 = ixiachariot.createEndpoint(
            args['endpointSpec0'], distmasterBase, self)
        endpoint1 = ixiachariot.createEndpoint(
            args['endpointSpec1'], distmasterBase, self)

        endpoint0.install(self.distmasterDir)
        endpoint1.install(self.distmasterDir)

        ixiaTest = args['ixiaTestFile']
        jobId = xenrt.GEC().jobid()

        pairTest = ixiachariot.PairTest(
            endpoint0.ipAddress, endpoint1.ipAddress, ixiaTest, jobId)

        console = ixiachariot.Console(
            self.consoleAddress, self.executeOnChariotConsole, XenRTLock())

        step("IXIA console is going to run %d TCP streams between the end points." % numThreads)
        for cmd in pairTest.getCommands(numThreads):
            console.run(cmd)

        logDir = xenrt.TEC().getLogdir()

        sftpclient = xenrt.ssh.SFTPSession(
            self.consoleAddress,
            username=self.consoleUser)

        sftpclient.copyTreeFrom(pairTest.workingDir, logDir + '/results')
        sftpclient.close()
Esempio n. 3
0
    def prepareIteration(self):
        """Prepare each iterations. All VDIs will be created in this process."""

        step("Creating VDIs and attaching them")

        count = self.vdicount / self.numWorker
        if self.runOnGuest:
            tasks = []
            for i in xrange(self.numWorker):
                tasks.append(xenrt.PTask(self.prepareVDIsOnGuest, self.guests[i * count:(i + 1) * count]))
            xenrt.pfarm(tasks)
            # Just in case.
            if self.vdicount % self.numWorker:
                self.prepareVDIsOnGuest(self.guests[-(self.vdicount % self.numWorker):])
            log("Created %d VDIs on guests" % (self.vdicount))

        else:
            xenrt.pfarm([xenrt.PTask(self.prepareVDIsOnHost, count) for i in xrange(self.numWorker)])
            # Just in case.
            if self.vdicount % self.numWorker:
                self.prepareVDIsOnHost(self.vdicount % self.numWorker)
            log("Created %d VDIs: %s" % (self.vdicount, self.vdis))

        log("After creating %d VDIs: %d" % (self.vdicount, self.getPhysicalUtil()))

        libsynexec.initialise_master_in_dom0(self.host)
Esempio n. 4
0
    def prepareIteration(self):
        """Prepare each iterations. All VDIs will be created in this process."""

        step("Creating VDIs and attaching them")

        count = self.vdicount / self.numWorker
        if self.runOnGuest:
            tasks = []
            for i in xrange(self.numWorker):
                tasks.append(
                    xenrt.PTask(self.prepareVDIsOnGuest,
                                self.guests[i * count:(i + 1) * count]))
            xenrt.pfarm(tasks)
            # Just in case.
            if self.vdicount % self.numWorker:
                self.prepareVDIsOnGuest(
                    self.guests[-(self.vdicount % self.numWorker):])
            log("Created %d VDIs on guests" % (self.vdicount))

        else:
            xenrt.pfarm([
                xenrt.PTask(self.prepareVDIsOnHost, count)
                for i in xrange(self.numWorker)
            ])
            # Just in case.
            if self.vdicount % self.numWorker:
                self.prepareVDIsOnHost(self.vdicount % self.numWorker)
            log("Created %d VDIs: %s" % (self.vdicount, self.vdis))

        log("After creating %d VDIs: %d" %
            (self.vdicount, self.getPhysicalUtil()))

        libsynexec.initialise_master_in_dom0(self.host)
Esempio n. 5
0
    def run(self, arglist=None):
        xapiRdpObj = XapiRdp(self.guest)

        # Enable RDP on the guest 
        if not xapiRdpObj.enableRdp():
            raise xenrt.XRTFailure("XAPI failed to enable the RDP on the guest %s with tools installed" % (self.guest))
        xenrt.TEC().logverbose("XAPI successfully enabled the RDP for the guest: %s " % (self.guest))

        # win_guest_agent takes at max 10 seconds to update RDP status change to XAPI
        xenrt.sleep(10)

        if not xapiRdpObj.isRdpEnabled():
            raise xenrt.XRTFailure("Guest agent does not updated  data/ts about the RDP status change for the guest %s " % (self.guest))
        xenrt.TEC().logverbose("Guest agent updated the RDP status in data/ts successfully for the guest %s" % (self.guest))

        # Disable the RDP on the guest 
        step("Test trying to disable RDP on the guest by setting  windows registry key fDenyTSConnections to 1")
        self.guest.winRegAdd('HKLM', 'System\\CurrentControlSet\\Control\\Terminal Server\\', 'fDenyTSConnections',"DWORD", 1)
        xenrt.sleep(10)

        if xapiRdpObj.isRdpEnabled():
            raise xenrt.XRTFailure("Guest agent does not updated data/ts about the RDP status change for the guest %s " % (self.guest))
        xenrt.TEC().logverbose("Guest agent updated the RDP status in data/ts successfully for the guest %s" % (self.guest))

        self.guest.checkHealth()
Esempio n. 6
0
    def runTest(self):
        metadata_array = []
        filename_array = []
        if self.IS_VALID_CLIENTTHREADS:
            metadata_array.append(str(self.httpClientThreads))
            filename_array.append("thd%d" % self.httpClientThreads)
        if self.IS_VALID_CLIENTPARALLELCONN:
            metadata_array.append(str(self.httpClientParallelconn))
            filename_array.append("pc%d" % self.httpClientParallelconn)

        filename_stem = "_".join(filename_array)
        self.log("metadata", "%s %s" % (filename_stem, " ".join(metadata_array)))

        now = time.time()
        finish = now + self.runtime
        i = 0

        step("runTest: sample the TCP counters on the DUT every 5 seconds")
        while now < finish:
            filename = "stats.%s.%d.ctr" % (filename_stem, i)
            self.sampleCounters(self.guest_dut, self.statsToCollect, filename)
            self.log("sampletimes.%s" % (filename_stem), "%d %f" % (i, now))

            # The counters only seem to be updated every ~5 seconds, so don't sample more often than that
            time.sleep(5)
            i = i + 1
            now = time.time()
Esempio n. 7
0
    def runTest(self):
        metadata_array = []
        filename_array = []
        if self.IS_VALID_CLIENTTHREADS:
            metadata_array.append(str(self.httpClientThreads))
            filename_array.append("thd%d" % self.httpClientThreads)
        if self.IS_VALID_CLIENTPARALLELCONN:
            metadata_array.append(str(self.httpClientParallelconn))
            filename_array.append("pc%d" % self.httpClientParallelconn)

        filename_stem = "_".join(filename_array)
        self.log("metadata",
                 "%s %s" % (filename_stem, " ".join(metadata_array)))

        now = time.time()
        finish = now + self.runtime
        i = 0

        step("runTest: sample the TCP counters on the DUT every 5 seconds")
        while now < finish:
            filename = "stats.%s.%d.ctr" % (filename_stem, i)
            self.sampleCounters(self.guest_dut, self.statsToCollect, filename)
            self.log("sampletimes.%s" % (filename_stem), "%d %f" % (i, now))

            # The counters only seem to be updated every ~5 seconds, so don't sample more often than that
            time.sleep(5)
            i = i + 1
            now = time.time()
Esempio n. 8
0
 def run(self,arglist=None):
     host = self.getDefaultHost()
     sessions_open = {}
     max_iterations = 10
     count = 0
     values = [] #Stores the number of sessions found open at every iteration
     step("Checking the number of open sessions every 20 minutes")
     for i in range(max_iterations): #Define the number of iterations
         xenrt.sleep(1200) #20 minutes of sleep
         step("Iteration number: %d" %(i+1))
         log("Checking which sessions get created in iteration %d" %(i+1))
         sessions_started = host.execdom0("grep 'Session.create.*uname=__dom0__vmpr' /var/log/xensource.log | true")          
         for entry in sessions_started.strip().splitlines():
                 track = re.search("trackid=(?P<id>[a-z0-9]+)", entry)
                 if not sessions_open.has_key(track.group('id')):
                     sessions_open[track.group('id')] = "open" 
                     count = count+1
         
         log("Checking which sessions are closed in iteration %d" %(i+1))
         for session in sessions_open:
             if sessions_open[session] == "open" and not host.execdom0("grep 'Session.destroy trackid=%s' /var/log/xensource.log" %session, retval="code"):
                 #The session has been successfully closed
                 sessions_open[session] = "closed"
                 count = count-1
         log("At the end of iteration %d, noticed that %d number of vmpr sessions are still open" %(i+1, count))
         values.append(count)
         
     #If the number of open sessions grows over time then we can say there's a leak.
     leak = True
     for i in range(1,len(values)):
         leak = leak and values[i]>values[i-1] #Check if the list is strictly increasing
     if leak:
         raise xenrt.XRTFailure("VMPR sessions leaked")
Esempio n. 9
0
 def __attemptLogParse(self, host):
     parser = TXTErrorParser.fromHostFile(host, "/var/log/messages", "/var/log/kern.log", "/var/log/user.log")
     step("Parsing logs from host: %s" % host)
     self.__writeToNewLog("extractedTPMErrors.log", '\n'.join(parser.locateAllTpmData()))
     keyErrs = parser.locateKeyErrors()
     self.__writeToNewLog("keyTPMErrors.log", '\n'.join(keyErrs))
     if len(keyErrs) > 0:
         return TxtLogObfuscator(keyErrs).fuzz()[0]
Esempio n. 10
0
 def run(self, arglist):
     lowlevel, both = self.getArgs(arglist)
     host = self.getDefaultHost()
     rcc = host.getReadCachingController()
     rcc.setVM(self.vm)
     rcc.disable()
     self.vm.reboot()
     step("Checking ReadCaching state disabled %s" % lowlevel)
     self.checkExpectedState(False, lowlevel, both)
Esempio n. 11
0
    def prepare(self, arglist):
        self.__ts = self.getDefaultToolstack()
        step("Spin up a %s" % self.__fetchOsFromArg(arglist))
        self.__distro = self.__fetchOsFromArg(arglist)

        self.__instance = self.__ts.createInstance(self.__distro,
                                                  useTemplateIfAvailable=False)

        self.getLogsFrom(self.__instance)
Esempio n. 12
0
 def run(self, arglist=None):
     # Initialize Service settings on pool and Enrol pool for Service
     self.service.initializeService(self.pool)
     self.service.activateService(self.pool)
     
     step("Now Attach the host to XenCenter")
     self.guest.attachXenCenterToHost(self.pool.master)
     
     self.triggerAndVerify(self.service)
Esempio n. 13
0
    def run(self, arglist=None):
        # Initialize Service settings on pool and Enrol pool for Service
        self.service.initializeService(self.pool)
        self.service.activateService(self.pool)

        step("Now Attach the host to XenCenter")
        self.guest.attachXenCenterToHost(self.pool.master)

        self.triggerAndVerify(self.service)
Esempio n. 14
0
    def prepare(self, arglist):
        self.__ts = self.getDefaultToolstack()
        step("Spin up a %s" % self.__fetchOsFromArg(arglist))
        self.__distro = self.__fetchOsFromArg(arglist)

        self.__instance = self.__ts.createInstance(
            self.__distro, useTemplateIfAvailable=False)

        self.getLogsFrom(self.__instance)
Esempio n. 15
0
 def run(self, arglist):
     lowlevel, both = self.getArgs(arglist)
     host = self.getDefaultHost()
     rcc = host.getReadCachingController()
     rcc.setVM(self.vm)
     rcc.disable()
     self.vm.reboot()
     step("Checking ReadCaching state disabled %s" % lowlevel)
     self.checkExpectedState(False, lowlevel, both)
Esempio n. 16
0
 def _getSdk(self):
     self.removePackage()
     step("Getting SDK....")
     target = self.__get_sdk_location()
     sdkfile = xenrt.TEC().getFile(target)
     sftp = self._runner.sftpClient()
     targetLocation = os.path.join(self.TARGET_ROOT, self._packageName)
     sftp.copyTo(sdkfile, targetLocation)
     log("Target location: %s" % targetLocation)
     sftp.close()
     return targetLocation
Esempio n. 17
0
    def runtestcase(self, testcaseId):
        self.__results = []

        step("Running firewall6 test case %d on guest %s" %
             (testcaseId, self.__attacker))

        self.__results.append(
            self.__attacker.execguest(
                "%s/%s %s %s %d %d" %
                (self.TARGET_PATH, self.TEST, self.__interface,
                 self.__targetipv6, self.__tcpPort, testcaseId)))
Esempio n. 18
0
    def run(self, arglist=None):
        
        step("Migrate the VM's")
        SxmFromLowToHighVersion.run(self, arglist)

        step("Verify windows pv updates are disabled after migration")
        for guest in self.guests:
            if guest.windows and guest.getAutoUpdateDriverState():
                raise xenrt.XRTFailure("Windows PV updates are enabled on the VM Migrated from Older host to Newer host")

        xenrt.TEC().logverbose("Windows PV updates are disabled on the VM Migrated from Older host to Newer host as expected")
Esempio n. 19
0
 def __attemptLogParse(self, host):
     parser = TXTErrorParser.fromHostFile(host, "/var/log/messages",
                                          "/var/log/kern.log",
                                          "/var/log/user.log")
     step("Parsing logs from host: %s" % host)
     self.__writeToNewLog("extractedTPMErrors.log",
                          '\n'.join(parser.locateAllTpmData()))
     keyErrs = parser.locateKeyErrors()
     self.__writeToNewLog("keyTPMErrors.log", '\n'.join(keyErrs))
     if len(keyErrs) > 0:
         return TxtLogObfuscator(keyErrs).fuzz()[0]
Esempio n. 20
0
 def _getSdk(self):
     self.removePackage()
     step("Getting SDK....")
     target = self.__get_sdk_location()
     sdkfile = xenrt.TEC().getFile(target)
     sftp = self._runner.sftpClient()
     targetLocation = os.path.join(self.TARGET_ROOT, self._packageName)
     sftp.copyTo(sdkfile, targetLocation)
     log("Target location: %s" % targetLocation)
     sftp.close()
     return targetLocation
Esempio n. 21
0
    def finalizeIteration(self):
        """Clean up the iteration. All VDIs will be detached and destroyed."""

        step("Destroying all test VDIs")
        if self.runOnGuest:
            for guest in self.guests:
                libsynexec.kill_slave(guest)
                guest.setState("DOWN")
                guest.destroyAdditionalDisks()
                guest.setState("UP")
        else:
            map(self.host.destroyVDI, self.vdis)
            self.vdis = []
Esempio n. 22
0
    def prepare(self, arglist):
        self.host = self.getDefaultHost()

        # install the xen-test-framework which is a prerequisite for running tests.
        step("install xen-test-framework RPM and copy other pre-requisites")

        moduleRpm = xenrt.TEC().getFile(
            "/usr/groups/build/trunk-ring0/latest/binary-packages/RPMS/domain0/RPMS/x86_64/xen-test-framework-*.rpm"
        )
        try:
            xenrt.checkFileExists(moduleRpm)
        except xenrt.XRTException, e:
            raise xenrt.XRTError(e.reason)
Esempio n. 23
0
 def run(self, arglist=None):
     
     step("Get the list of the Pv packages ")
     pvDriverList = xenrt.TEC().lookup("PV_DRIVERS_LIST").split(';')
     
     pkgList = random.sample(pvDriverList, 4)
     step("Install PV Drivers on the windows guest")
     self.guest.installPVPackage(packageName = pkgList )
     self.guest.reboot()
     
     self.guest.waitForDaemon(300, desc="Guest check after installation of PV Packages %s" %(pkgList))
     
     xenrt.TEC().logverbose("%s is reachable after installation of PV Packages %s" %(self.guest.getName(), pkgList))
Esempio n. 24
0
    def finalizeIteration(self):
        """Clean up the iteration. All VDIs will be detached and destroyed."""

        step("Destroying all test VDIs")
        if self.runOnGuest:
            for guest in self.guests:
                libsynexec.kill_slave(guest)
                guest.setState("DOWN")
                guest.destroyAdditionalDisks()
                guest.setState("UP")
        else:
            map(self.host.destroyVDI, self.vdis)
            self.vdis = []
Esempio n. 25
0
 def run(self, arglist=None):
     
     step("Install the PV Drivers on the Windows Guest")
     self.guest.installDrivers(source = self.tools)
     
     oldVersion = self.guest.getPVDriverVersion()
     
     step("Upgrade the tools using tools.iso")
     self.guest.installDrivers(pvPkgSrc = "ToolsISO")
     
     newVersion = self.guest.getPVDriverVersion()
     
     if not newVersion > oldVersion:
         raise xenrt.XRTFailure("PV Drivers Failed to upgrade OldVersion > NewVersion (%s > %s)" %(oldVersion, newVersion))
Esempio n. 26
0
 def run(self, arglist=None):
     
     step("Install PV Drivers on the windows guest")
     self.guest.installDrivers()
     
     oldVersion = self.guest.getPVDriverVersion()
     
     step("Try downgrading the tools with the older version of Tools ISO")
     self.guest.installDrivers(source = self.tools, pvPkgSrc = "ToolsISO")
     
     newVersion = self.guest.getPVDriverVersion()
     
     if newVersion > oldVersion:
         raise xenrt.XRTFailure("PV Drivers downgrade successful from %s to %s" %(oldVersion, newVersion))
Esempio n. 27
0
    def run(self, arglist):
        self.host = self.getDefaultHost()
        session = self.host.getAPISession()
        hostRef = session.xenapi.host.get_all()[0]

        end = time.time() + self.__DURATION
        log("This test will end in %s secs" % str(end))

        try:
            while time.time() < end:
                step("Fetch the attestation id....")
                log(xenrt.txt.TXTCommand().getAttestationId(hostRef, session))
                step("Reboot host....")
                self.host.reboot()
        except:
            raise xenrt.XRTFailure("Failure occurred whilst calling the attestation id api repeatedly")
Esempio n. 28
0
    def run(self,arglist):
        pool = self.getDefaultPool()
        master = pool.master
        slave = pool.getSlaves()[0]

        step("Execute host_rrd on slave")
        startTime = xenrt.util.timenow() 
        while xenrt.util.timenow() < startTime + 10: 
           slave.execdom0("wget http://root:%s@%s/host_rrd" %(slave.password, slave.getIP()))
        
        step("Searching for the HOST_IS_SLAVE exception in xensource.log")
        msg = "Got exception HOST_IS_SLAVE"
        grepReturnValue = slave.execdom0("grep '%s' /var/log/xensource.log" %(msg),retval = "code")
        if grepReturnValue == 0:
            raise xenrt.XRTFailure("host_rrd request for slave causes HOST_IS_SLAVE exception.")
        else:
            log("host_rrd request for slave doesn't cause any HOST_IS_SLAVE exception")
Esempio n. 29
0
    def run(self, arglist=None):
        
        step("Installing Linux Guest")
        self.testVM = self.host.createGenericLinuxGuest()
        
        step("Find out the eth0 PIFs on each host")
        for h in self.normalHosts:
            host = self.tec.gec.registry.hostGet(h)
            self.hosteth0pif[h] = host.execdom0("xe pif-list device=eth0 host-uuid=%s params=uuid --minimal" % host.uuid).strip()

        step("Create VLANs")
        self.createVLANs()

        step("Reboot hosts")
        self.rebootHosts()
        
        step("Destroy VLANs")
        self.destroyVLANs()
Esempio n. 30
0
 def run(self, arglist=None): 
      
     step("Install PV Drivers on the windows guest") 
     self.guest.installDrivers() 
      
     step("Take checkpoint of the VM") 
     checkpoint1 = self.guest.checkpoint() 
      
     step("Suspend windows guest") 
     self.guest.suspend() 
      
     step("Resuming windows guest") 
     self.guest.resume() 
     self.guest.check() 
      
     step("Removing checkpoint") 
     self.guest.removeSnapshot(checkpoint1) 
     self.guest.check() 
Esempio n. 31
0
    def prepare(self, arglist=[]):
        self.parseArgs(arglist)
        self.workloadFileName = None
        self.workload = None
        self.remoteWLDir = "/var/BW/WL"
        self.dutProtocolVServer = "HTTP"
        # Identifiers used by nscsconfig
        self.server_id = 0 # higher numbers don't seem to result in a running server
        self.client_id = 1

        step("prepare: setting up %s as blackwidow..." % (self.guest_bw))
        self.ns_bw = self.getVPX(self.guest_bw)
        self.ns_bw.removeExistingSNIP()
        self.setupBlackWidow(self.ns_bw)

        step("prepare: setting up %s as DUT..." % (self.guest_dut))
        self.ns_dut = self.getVPX(self.guest_dut)
        self.ns_dut.removeExistingSNIP()
        self.setupDUT(self.ns_dut)
Esempio n. 32
0
    def run(self, arglist=None):
        step('Sending ping from controller to guest')
        self.pingGuest(self.guestAddr)
        
        step('Sending ping from controller to guest1')
        self.pingGuest(self.guest2Addr)            

        step('Sending ping from guest to guest1')
        self.guest2guestPing(self.guest, self.guest2Addr)
        
        step('Sending ping from guest1 to guest')
        self.guest2guestPing(self.guest, self.guest2Addr)
Esempio n. 33
0
    def run(self, arglist=[]):
        if self.IS_VALID_CLIENTTHREADS or self.IS_VALID_CLIENTPARALLELCONN:
            for t,p in self.clientTnP:
                step("Test segment started")
                if self.IS_VALID_CLIENTTHREADS:
                    self.httpClientThreads=int(t)
                    log("Test Parameter: httpClientThreads = %d" % (self.httpClientThreads))
                if self.IS_VALID_CLIENTPARALLELCONN:
                    self.httpClientParallelconn=int(p)
                    log("Test Parameter: httpClientParallelconn = %d" % (self.httpClientParallelconn))

                self.startWorkload()
                self.runTest()
                self.stopWorkload()
                step("Test segment finished")
        else:
            self.startWorkload()
            self.runTest()
            self.stopWorkload()
Esempio n. 34
0
    def prepare(self, arglist=[]):
        self.parseArgs(arglist)
        self.workloadFileName = None
        self.workload = None
        self.remoteWLDir = "/var/BW/WL"
        self.dutProtocolVServer = "HTTP"
        # Identifiers used by nscsconfig
        self.server_id = 0  # higher numbers don't seem to result in a running server
        self.client_id = 1

        step("prepare: setting up %s as blackwidow..." % (self.guest_bw))
        self.ns_bw = self.getVPX(self.guest_bw)
        self.ns_bw.removeExistingSNIP()
        self.setupBlackWidow(self.ns_bw)

        step("prepare: setting up %s as DUT..." % (self.guest_dut))
        self.ns_dut = self.getVPX(self.guest_dut)
        self.ns_dut.removeExistingSNIP()
        self.setupDUT(self.ns_dut)
Esempio n. 35
0
    def run(self, arglist=None):
        host = self.getDefaultHost()
        sessions_open = {}
        max_iterations = 10
        count = 0
        values = [
        ]  #Stores the number of sessions found open at every iteration
        step("Checking the number of open sessions every 20 minutes")
        for i in range(max_iterations):  #Define the number of iterations
            xenrt.sleep(1200)  #20 minutes of sleep
            step("Iteration number: %d" % (i + 1))
            log("Checking which sessions get created in iteration %d" %
                (i + 1))
            sessions_started = host.execdom0(
                "grep 'Session.create.*uname=__dom0__vmpr' /var/log/xensource.log | true"
            )
            for entry in sessions_started.strip().splitlines():
                track = re.search("trackid=(?P<id>[a-z0-9]+)", entry)
                if not sessions_open.has_key(track.group('id')):
                    sessions_open[track.group('id')] = "open"
                    count = count + 1

            log("Checking which sessions are closed in iteration %d" % (i + 1))
            for session in sessions_open:
                if sessions_open[session] == "open" and not host.execdom0(
                        "grep 'Session.destroy trackid=%s' /var/log/xensource.log"
                        % session,
                        retval="code"):
                    #The session has been successfully closed
                    sessions_open[session] = "closed"
                    count = count - 1
            log("At the end of iteration %d, noticed that %d number of vmpr sessions are still open"
                % (i + 1, count))
            values.append(count)

        #If the number of open sessions grows over time then we can say there's a leak.
        leak = True
        for i in range(1, len(values)):
            leak = leak and values[i] > values[
                i - 1]  #Check if the list is strictly increasing
        if leak:
            raise xenrt.XRTFailure("VMPR sessions leaked")
Esempio n. 36
0
    def prepare(self, arglist):
        self.host = self.getDefaultHost()

        # Install test modules from build output
        step("Install test-ring0-modules RPM")

        modules_path = "/tmp/test-ring0-modules.rpm"
        modules_rpm = xenrt.TEC().getFile("binary-packages/RPMS/domain0/RPMS/x86_64/test-ring0-modules-*.rpm")
        try:
            xenrt.checkFileExists(modules_rpm)
        except:
            raise xenrt.XRTError("test-ring0-modules rpm file is not present in the build")

        sh = self.host.sftpClient()
        try:
            sh.copyTo(modules_rpm, modules_path)
        finally:
            sh.close()

        self.host.execdom0("rpm --force -Uvh %s" % (modules_path))
Esempio n. 37
0
 def run(self, arglist=None):
     
     step("Install PV Drivers on the windows guest")
     self.guest.installDrivers()
     
     step("Take snapshot of the VM")
     snapshot = self.guest.snapshot()
     
     step("Uninstall the PV Drivers on the Guest")
     self.guest.uninstallDrivers()
     
     step("Revert the VM to the State before tools were uninstalled")
     self.guest.revert(snapshot)
     self.guest.removeSnapshot(snapshot)
     
     self.guest.start()
     
     step("Verify tools are present after the VM is reverted to previous state")
     if self.guest.checkPVDevicesState() and not self.guest.checkPVDriversStatus(ignoreException = True):
         raise xenrt.XRTFailure("PV Tools not present after the Reverting VM to state where tools were installed ")
Esempio n. 38
0
 def checkExpectedState(self, expectedState, lowlevel=False, both=False):
     step("Checking state - expected=%s, low-level=%s, bothChecks=%s" % (expectedState, lowlevel, both))
     host = self.getDefaultHost()
     rcc = host.getReadCachingController()
     rcc.setVM(self.vm)
     if both:
         step("Checking xapi status....")
         assertions.assertEquals(expectedState, rcc.isEnabled(lowLevel=False), "RC is enabled status via. xapi")
         step("Checking tapctl status....")
         assertions.assertEquals(expectedState, rcc.isEnabled(lowLevel=True), "RC is enabled status via. tap-ctl")
     else:
         step("Checking status of a single state...")
         assertions.assertEquals(expectedState, rcc.isEnabled(lowLevel=lowlevel), "RC is enabled status")
Esempio n. 39
0
    def run(self, arglist=None):
        step("Start the guest")
        self.guest.lifecycleOperation("vm-start", timeout=30)

        self.checkHost()
        step("Print Serial Console Logs")
        serlog = string.join(self.host.machine.getConsoleLogHistory(), "\n")
        xenrt.TEC().logverbose(serlog)

        if "All done: No hypervisor stack leaked into guest" in serlog:
            xenrt.TEC().logverbose("Expected output: Found 'All done: No hypervisor stack leaked into guest' in serial log")
        elif "Test failed: Hypervisor stack leaked into guest" in serlog:
            raise xenrt.XRTFailure("XSA not fixed.Found 'Test failed: Hypervisor stack leaked into guest' in logs")
        else:
            #Workaround for CA-159772: Sometimes host serial log is not available for a machine
            #Raise an error in that case.
            if "not found" in serlog or "Enter `^Ec?' for help" in serlog:
                raise xenrt.XRTError("Host serial console is not functional")
            else:
                raise xenrt.XRTFailure("Unexpected output in serial logs")
Esempio n. 40
0
    def run(self, arglist=None):

        step("Installing Linux Guest")
        self.testVM = self.host.createGenericLinuxGuest()

        step("Find out the eth0 PIFs on each host")
        for h in self.normalHosts:
            host = self.tec.gec.registry.hostGet(h)
            self.hosteth0pif[h] = host.execdom0(
                "xe pif-list device=eth0 host-uuid=%s params=uuid --minimal" %
                host.uuid).strip()

        step("Create VLANs")
        self.createVLANs()

        step("Reboot hosts")
        self.rebootHosts()

        step("Destroy VLANs")
        self.destroyVLANs()
Esempio n. 41
0
    def run(self, arglist=None):
        xapiRdpObj = XapiRdp(self.guest)

        # Enable RDP on the guest
        if not xapiRdpObj.enableRdp():
            raise xenrt.XRTFailure(
                "XAPI failed to enable the RDP on the guest %s with tools installed"
                % (self.guest))
        xenrt.TEC().logverbose(
            "XAPI successfully enabled the RDP for the guest: %s " %
            (self.guest))

        # win_guest_agent takes at max 10 seconds to update RDP status change to XAPI
        xenrt.sleep(10)

        if not xapiRdpObj.isRdpEnabled():
            raise xenrt.XRTFailure(
                "Guest agent does not updated  data/ts about the RDP status change for the guest %s "
                % (self.guest))
        xenrt.TEC().logverbose(
            "Guest agent updated the RDP status in data/ts successfully for the guest %s"
            % (self.guest))

        # Disable the RDP on the guest
        step(
            "Test trying to disable RDP on the guest by setting  windows registry key fDenyTSConnections to 1"
        )
        self.guest.winRegAdd(
            'HKLM', 'System\\CurrentControlSet\\Control\\Terminal Server\\',
            'fDenyTSConnections', "DWORD", 1)
        xenrt.sleep(10)

        if xapiRdpObj.isRdpEnabled():
            raise xenrt.XRTFailure(
                "Guest agent does not updated data/ts about the RDP status change for the guest %s "
                % (self.guest))
        xenrt.TEC().logverbose(
            "Guest agent updated the RDP status in data/ts successfully for the guest %s"
            % (self.guest))

        self.guest.checkHealth()
Esempio n. 42
0
    def run(self, arglist=[]):
        if self.IS_VALID_CLIENTTHREADS or self.IS_VALID_CLIENTPARALLELCONN:
            for t, p in self.clientTnP:
                step("Test segment started")
                if self.IS_VALID_CLIENTTHREADS:
                    self.httpClientThreads = int(t)
                    log("Test Parameter: httpClientThreads = %d" %
                        (self.httpClientThreads))
                if self.IS_VALID_CLIENTPARALLELCONN:
                    self.httpClientParallelconn = int(p)
                    log("Test Parameter: httpClientParallelconn = %d" %
                        (self.httpClientParallelconn))

                self.startWorkload()
                self.runTest()
                self.stopWorkload()
                step("Test segment finished")
        else:
            self.startWorkload()
            self.runTest()
            self.stopWorkload()
Esempio n. 43
0
    def run(self, arglist=None):
        # Initialize Service settings on pool and Enrol pool for Service
        self.service.initializeService(self.pool)
        self.service.activateService(self.pool)

        step("Now Attach the host to XenCenter")
        self.guest.attachXenCenterToHost(self.pool.master)

        step("Enable Firewall so that the upload fails")
        self.blockService(self.guest)

        triggerTime=self.service.triggerService(self.pool,self.options)
        if self.service.verifyService(self.pool,triggerTime):
            raise xenrt.XRTFailure("Upload Successful inspite of blocking access to MockServer")
        else:
            xenrt.log("Upload would have failed as expected.Lets check the trace of Failed Upload")
            if self.service.verifyServiceFailure(self.pool,triggerTime):
                xenrt.log("Upload Failed at predictable timestamp as Expected")
            else:
                raise xenrt.XRTFailure("Couldnt find the trace of Failed Upload")

        step("So upload failed. Now disable firewall so the failed upload goes through")
        self.unblockService(self.guest)


        if self.service.verifyService(self.pool,triggerTime,timeout=2000):
            xenrt.log("Previous Upload attempt is finally successful")
        else :
            raise xenrt.XRTFailure("Previous Upload attempt is still pending")
Esempio n. 44
0
    def run(self, arglist=None):
        # Initialize Service settings on pool and Enrol pool for Service
        self.service.initializeService(self.pool)
        self.service.activateService(self.pool)

        step("Now Attach the host to XenCenter")
        self.guest.attachXenCenterToHost(self.pool.master)

        step("Enable Firewall so that the upload fails")
        self.blockService(self.guest)

        triggerTime = self.service.triggerService(self.pool, self.options)
        if self.service.verifyService(self.pool, triggerTime):
            raise xenrt.XRTFailure(
                "Upload Successful inspite of blocking access to MockServer")
        else:
            xenrt.log(
                "Upload would have failed as expected.Lets check the trace of Failed Upload"
            )
            if self.service.verifyServiceFailure(self.pool, triggerTime):
                xenrt.log("Upload Failed at predictable timestamp as Expected")
            else:
                raise xenrt.XRTFailure(
                    "Couldnt find the trace of Failed Upload")

        step(
            "So upload failed. Now disable firewall so the failed upload goes through"
        )
        self.unblockService(self.guest)

        if self.service.verifyService(self.pool, triggerTime, timeout=2000):
            xenrt.log("Previous Upload attempt is finally successful")
        else:
            raise xenrt.XRTFailure("Previous Upload attempt is still pending")
Esempio n. 45
0
    def __init__(self):
        super(PhoneHome, self).__init__("PhoneHome")
        self.pool = self.getDefaultPool()
        self.hosts = self.pool.getHosts()
        self.guests = []
        for h in self.hosts:
            for g in h.listGuests(running=True):
                self.guests.append(h.getGuest(g))
        self.guest = self.guests[0]

        self.options = {}
        self.mockServerObj = None
        step("The guest list is as follows %s" % self.guests)

        self.mockServer = xenrt.TEC().lookup('MOCKSERVER', "CIS")
        self.xcService = xenrt.TEC().lookup('SERVICE', "HealthCheck")
        if not xenrt.TEC().lookup('STATIC_MOCKSERVER', None):
            step("Get the MockServer Object")
            self.mockServerObj = self.getGuest("DynamicMockServer")

        self.mockServerFactory = mockserver.MockServerFactory()
        self.serviceFactory = xcservices.ServiceFactory()
Esempio n. 46
0
    def run(self, arglist):
        pool = self.getDefaultPool()
        master = pool.master
        slave = pool.getSlaves()[0]

        step("Execute host_rrd on slave")
        startTime = xenrt.util.timenow()
        while xenrt.util.timenow() < startTime + 10:
            slave.execdom0("wget http://root:%s@%s/host_rrd" %
                           (slave.password, slave.getIP()))

        step("Searching for the HOST_IS_SLAVE exception in xensource.log")
        msg = "Got exception HOST_IS_SLAVE"
        grepReturnValue = slave.execdom0("grep '%s' /var/log/xensource.log" %
                                         (msg),
                                         retval="code")
        if grepReturnValue == 0:
            raise xenrt.XRTFailure(
                "host_rrd request for slave causes HOST_IS_SLAVE exception.")
        else:
            log("host_rrd request for slave doesn't cause any HOST_IS_SLAVE exception"
                )
Esempio n. 47
0
 def run(self,arglist):
     step("Create the VDIs on both SRs")
     host = self.getDefaultHost()
     guest=self.guest
     vdi=[]
     vdi.append(host.createVDI(xenrt.GIGA, self.sr[0], name="VDI0"))
     vdi.append(host.createVDI(xenrt.GIGA, self.sr[1], name="VDI1"))
     
     step("Create and attach vbds on VM for both SRs")
     cli = host.getCLIInstance()
     vbduuid=[]
     vbduuid.append(cli.execute("vbd-create", "vdi-uuid=%s vm-uuid=%s device=1" % (vdi[0], self.guest.getUUID())).strip())
     vbduuid.append(cli.execute("vbd-create", "vdi-uuid=%s vm-uuid=%s device=2" % (vdi[1], self.guest.getUUID())).strip())
     cli.execute("vbd-plug", "uuid=%s" % vbduuid[0])
     cli.execute("vbd-plug", "uuid=%s" % vbduuid[1])
     
     step("Format and mount vbds")
     device=host.genParamGet("vbd", vbduuid[0], "device")
     guest.execguest("mkdir /vbd0")
     guest.execguest("mkfs.ext3 /dev/%s" % device)
     guest.execguest("mount /dev/%s /vbd0" % device)
     device=host.genParamGet("vbd", vbduuid[1], "device")
     guest.execguest("mkdir /vbd1")
     guest.execguest("mkfs.ext3 /dev/%s" % device)
     guest.execguest("mount /dev/%s /vbd1" % device)
     xenrt.sleep(60)
     
     step("Write files to vbd0 and check io_throughput_total  values for both SRs")
     self.guest.execguest("nohup cp -r /root /usr /var /vbd0>temp.txt &")
     xenrt.sleep(2)
     xenrt.TEC().logverbose("Check rrd2csv io_throughput data for both SRs")
     host.execdom0("nohup rrd2csv io_throughput_total_%s>sr0.txt &" % (self.sr[0].split('-')[0]))
     host.execdom0("nohup rrd2csv io_throughput_total_%s>sr1.txt &" % (self.sr[1].split('-')[0]))
     xenrt.sleep(15)
     host.execdom0("pkill rrd2csv")
     
     success = 0
     try:
         for i in range(int(host.execdom0("cat sr0.txt | wc -l"))-1):
             ioThroughput0 = float(host.execdom0("head -%s sr0.txt | tail -1" % (str(i+2))).split('Z, ')[1])
             ioThroughput1 = float(host.execdom0("head -%s sr1.txt | tail -1" % (str(i+2))).split('Z, ')[1])
             if ioThroughput0 > 0 and ioThroughput1 == 0:
                 success = 1
                 break
     except Exception, e:
         if "list index out of range" in str(e):
             raise xenrt.XRTFailure("io_throughput_total metric not found: %s" % (str(e)))
         else:
             raise xenrt.XRTFailure("Exception occured while fetching io_throughput_total metric %s" % (str(e)))
Esempio n. 48
0
    def run(self, arglist=None):
        xapiRdpObj = XapiRdp(self.guest)

        #install old tools
        self.guest.installDrivers(source=self.oldTools, expectUpToDate=False)

        if xapiRdpObj.enableRdp():
            raise xenrt.XRTFailure(
                "XAPI enabled the RDP on the guest %s with old tools installed"
                % (self.guest))
        xenrt.TEC().logverbose(
            "XAPI couldn't enabled the RDP for the guest %s with old tools installed "
            % (self.guest))

        #Upgrade the tools to latest
        step("Test trying to upgrade the tools")
        self.guest.installDrivers()

        step(
            "Test trying to enable RDP via XAPI on the guest with upgraded tools.."
        )
        if not xapiRdpObj.enableRdp():
            raise xenrt.XRTFailure(
                "XAPI failed to enable RDP for the guest %s with upgraded tools"
                % (self.guest))
        xenrt.TEC().logverbose(
            "XAPI enabled the RDP for the guest %s with upgraded tools " %
            (self.guest))
        xenrt.sleep(10)

        # Make sure RDP enabled field updated
        if not xapiRdpObj.isRdpEnabled():
            raise xenrt.XRTFailure(
                "data/ts not updated for the guest %s with upgraded tools " %
                (self.guest))
        xenrt.TEC().logverbose(
            "Guest agent updated the RDP status in data/ts successfully for the guest %s"
            % (self.guest))
Esempio n. 49
0
    def run(self, arglist=None):
        xapiRdpObj = XapiRdp(self.guest)

        # Check that RDP field is not exist in xenstore on the guest with no tools installed
        if xapiRdpObj.isRdpEnabled():
            raise xenrt.XRTFailure(
                "RDP is enabled on the guest: %s with no tools" % (self.guest))
        xenrt.TEC().logverbose("RDP is currently disabled on the guest %s" %
                               (self.guest))

        # Check that XAPI can not switch RDP with no tools installed
        if xapiRdpObj.enableRdp():
            raise xenrt.XRTFailure(
                "XAPI enabled the RDP for the guest %s with no tools." %
                (self.guest))
        xenrt.TEC().logverbose(
            "XAPI couldn't enabled RDP for the guest %s with no tools" %
            (self.guest))

        # Enable the RDP on the guest
        step(
            " Test is trying to enable the RDP on the guest by resetting fDenyTSConnections to 0"
        )
        self.guest.winRegAdd(
            'HKLM', 'System\\CurrentControlSet\\Control\\Terminal Server\\',
            'fDenyTSConnections', "DWORD", 0)
        xenrt.sleep(10)

        #Install tools
        self.guest.installDrivers()

        if not xapiRdpObj.isRdpEnabled():
            raise xenrt.XRTFailure(
                "After tools installation previous RDP settings lost on the guest %s "
                % (self.guest))
        xenrt.TEC().logverbose(
            "RDP settings made before new tools installation preserved on the guest %s"
            % (self.guest))
Esempio n. 50
0
    def prepare(self, arglist):
        self.host = self.getDefaultHost()

        # Install test modules from build output
        step("Install test-ring0-modules RPM")

        modules_path = "/tmp/test-ring0-modules.rpm"
        modules_rpm = xenrt.TEC().getFile(
            "binary-packages/RPMS/domain0/RPMS/x86_64/test-ring0-modules-*.rpm"
        )
        try:
            xenrt.checkFileExists(modules_rpm)
        except:
            raise xenrt.XRTError(
                "test-ring0-modules rpm file is not present in the build")

        sh = self.host.sftpClient()
        try:
            sh.copyTo(modules_rpm, modules_path)
        finally:
            sh.close()

        self.host.execdom0("rpm --force -Uvh %s" % (modules_path))
Esempio n. 51
0
    def run(self, arglist=None):
        args = self.parseArgsKeyValue(arglist)
        # numThreads specifies the number of tcp streams between the two end points. By Default it is set to 1
        numThreads = int(args.get("num_threads", "1"))
        distmasterBase = xenrt.TEC().lookup("TEST_TARBALL_BASE")
        endpoint0 = ixiachariot.createEndpoint(args['endpointSpec0'],
                                               distmasterBase, self)
        endpoint1 = ixiachariot.createEndpoint(args['endpointSpec1'],
                                               distmasterBase, self)

        endpoint0.install(self.distmasterDir)
        endpoint1.install(self.distmasterDir)

        ixiaTest = args['ixiaTestFile']
        jobId = xenrt.GEC().jobid()

        pairTest = ixiachariot.PairTest(endpoint0.ipAddress,
                                        endpoint1.ipAddress, ixiaTest, jobId)

        console = ixiachariot.Console(self.consoleAddress,
                                      self.executeOnChariotConsole,
                                      XenRTLock())

        step(
            "IXIA console is going to run %d TCP streams between the end points."
            % numThreads)
        for cmd in pairTest.getCommands(numThreads):
            console.run(cmd)

        logDir = xenrt.TEC().getLogdir()

        sftpclient = xenrt.ssh.SFTPSession(self.consoleAddress,
                                           username=self.consoleUser)

        sftpclient.copyTreeFrom(pairTest.workingDir, logDir + '/results')
        sftpclient.close()
Esempio n. 52
0
    def run(self, arglist=None):
        step("Start the guest")
        self.guest.lifecycleOperation("vm-start", timeout=30)

        self.checkHost()
        step("Print Serial Console Logs")
        serlog = string.join(self.host.machine.getConsoleLogHistory(), "\n")
        xenrt.TEC().logverbose(serlog)

        if "All done: No hypervisor stack leaked into guest" in serlog:
            xenrt.TEC().logverbose(
                "Expected output: Found 'All done: No hypervisor stack leaked into guest' in serial log"
            )
        elif "Test failed: Hypervisor stack leaked into guest" in serlog:
            raise xenrt.XRTFailure(
                "XSA not fixed.Found 'Test failed: Hypervisor stack leaked into guest' in logs"
            )
        else:
            #Workaround for CA-159772: Sometimes host serial log is not available for a machine
            #Raise an error in that case.
            if "not found" in serlog or "Enter `^Ec?' for help" in serlog:
                raise xenrt.XRTError("Host serial console is not functional")
            else:
                raise xenrt.XRTFailure("Unexpected output in serial logs")
Esempio n. 53
0
    def __runOperation(self, operation, distro, instance):
        name = type(operation).__name__
        step("%s Running operation: %s" % (distro, name))

        if not operation.supported(instance):
            step("Skipping test %s as it is not supported" % name)
            return

        step("Execute operation")
        operation.run(instance)
Esempio n. 54
0
    def run(self, arglist=None):
        step("Initialize and Enrol Phone Home for every pool")
        [s.initializeService(self.pool) for s in self.services]

        xenrt.pfarm([
            xenrt.PTask(self.services[0].activateService, p)
            for p in self.pools
        ],
                    wait=True,
                    exception=True)

        step("Attach all hosts via XenCenter in every guest")
        for p in self.pools:
            xenrt.pfarm([
                xenrt.PTask(self.attachXenCenterToMulHost, g, p.master)
                for g in self.guests
            ],
                        wait=True,
                        exception=True)
        self.pause("Mayur paused it")
        step("Set the same upload schedule for every pool")
        self.triggerTimes = xenrt.pfarm([
            xenrt.PTask(self.services[0].triggerService, p, self.options)
            for p in self.pools
        ],
                                        wait=True,
                                        exception=True)
        xenrt.log("Upload Schedule are as follows %s" % self.triggerTimes)

        step("Verify all the pool uploads")
        self.uploadResults = xenrt.pfarm([
            xenrt.PTask(self.services[0].verifyService, self.pools[i],
                        self.triggerTimes[i])
            for i in range(0, len(self.pools))
        ],
                                         wait=True,
                                         exception=True)
        xenrt.log("Upload Results are as follows %s" % self.uploadResults)

        if False in self.uploadResults:
            raise xenrt.XRTFailure(
                "Upload Failure observed for some pools %s" %
                self.uploadResults)
        else:
            xenrt.log("All scheduled uploads were successful")
Esempio n. 55
0
    def prepare(self, arglist=None):
        _TCXSA.prepare(self, arglist)
        step("Install HVM guest")
        self.guest = self.host.createGenericEmptyGuest()
        self.guest.insertToolsCD()
        step("Pin the guest to a specific pcpu")
        cpus = self.host.getCPUCores()
        self.guest.paramSet("VCPUs-params:mask", cpus - 1)

        step("Replace HVM Loader")
        self.replaceHvmloader(self.HVM_LOADER)
Esempio n. 56
0
    def startWorkload(self):
        step("startWorkload: create workload file")
        self.createWorkloadFile(self.ns_bw)

        step("startWorkload: create HTTP server(s?)")
        self.createHttpServers(self.ns_bw)

        step("startWorkload: create HTTP clients")
        self.createHttpClients(self.ns_bw)

        # Wait for the workload to get going
        xenrt.sleep(60)
Esempio n. 57
0
 def checkExpectedState(self, expectedState, lowlevel=False, both=False):
     step("Checking state - expected=%s, low-level=%s, bothChecks=%s" %
          (expectedState, lowlevel, both))
     host = self.getDefaultHost()
     rcc = host.getReadCachingController()
     rcc.setVM(self.vm)
     if both:
         step("Checking xapi status....")
         assertions.assertEquals(expectedState,
                                 rcc.isEnabled(lowLevel=False),
                                 "RC is enabled status via. xapi")
         step("Checking tapctl status....")
         assertions.assertEquals(expectedState,
                                 rcc.isEnabled(lowLevel=True),
                                 "RC is enabled status via. tap-ctl")
     else:
         step("Checking status of a single state...")
         assertions.assertEquals(expectedState,
                                 rcc.isEnabled(lowLevel=lowlevel),
                                 "RC is enabled status")