예제 #1
0
    def run(self, arglist=None):
        logname = "durations"

        # Get uuid of a/the slave
        slaveuuid = None
        for h in map(self.tec.gec.registry.hostGet, self.normalHosts):
            if h != self.host:
                slaveuuid = h.uuid
                break
        if slaveuuid is None:
            raise Exception("Couldn't find a slave host in %s" %
                            self.normalHosts)

        # Create lots of SRs on the slave
        cmd = "time for ((i=1; i<=%d; i++)); do xe sr-create host-uuid=%s type=dummy name-label=dummy$i; done" % (
            self.numsrs, slaveuuid)
        output = self.host.execdom0(cmd, timeout=1800)
        xenrt.TEC().logverbose("output: %s" % output)
        dur = libperf.parseTimeOutput(output)

        line = "create	%f" % dur
        self.log(logname, line)

        # Stop xapi on the slave
        xenrt.TEC().logverbose("stopping xapi on slave(s)...")
        for h in map(self.tec.gec.registry.hostGet, self.normalHosts):
            if h != self.host:
                xenrt.TEC().logverbose("stopping xapi on host %s" %
                                       h.getName())
                h.execdom0("service xapi stop")

        # Wait 5 minutes
        sleep = 5 * 60
        xenrt.TEC().logverbose("sleeping %d seconds..." % sleep)
        time.sleep(sleep)

        # Stop xapi on the master (so that it doesn't run the post-host-dead-hook before xapi startup)
        xenrt.TEC().logverbose("stopping xapi on master...")
        cmd = "service xapi stop"
        self.host.execdom0(cmd)

        # Wait a bit more than another 5 minutes (totalling 10 = Xapi_globs.host_assumed_dead_interval)
        sleep = 5 * 60 + 30
        xenrt.TEC().logverbose("sleeping %d seconds..." % sleep)
        time.sleep(sleep)

        # Now see how long it takes to restart xapi on the master -- this should cause it to run the host-post-declare-dead hook
        xenrt.TEC().logverbose(
            "now timing duration of xapi start on master...")
        cmd = "time service xapi start"
        output = self.host.execdom0(cmd, timeout=1800)
        xenrt.TEC().logverbose("output: %s" % output)
        dur = libperf.parseTimeOutput(output)

        line = "restart	%f" % dur
        self.log(logname, line)
예제 #2
0
    def run(self, arglist=None):
        logname = "durations"

        # Get uuid of a/the slave
        slaveuuid = None
        for h in map(self.tec.gec.registry.hostGet, self.normalHosts):
            if h != self.host:
                slaveuuid = h.uuid
                break
        if slaveuuid is None:
            raise Exception("Couldn't find a slave host in %s" % self.normalHosts)

        # Create lots of SRs on the slave
        cmd = "time for ((i=1; i<=%d; i++)); do xe sr-create host-uuid=%s type=dummy name-label=dummy$i; done" % (
            self.numsrs,
            slaveuuid,
        )
        output = self.host.execdom0(cmd, timeout=1800)
        xenrt.TEC().logverbose("output: %s" % output)
        dur = libperf.parseTimeOutput(output)

        line = "create	%f" % dur
        self.log(logname, line)

        # Stop xapi on the slave
        xenrt.TEC().logverbose("stopping xapi on slave(s)...")
        for h in map(self.tec.gec.registry.hostGet, self.normalHosts):
            if h != self.host:
                xenrt.TEC().logverbose("stopping xapi on host %s" % h.getName())
                h.execdom0("service xapi stop")

        # Wait 5 minutes
        sleep = 5 * 60
        xenrt.TEC().logverbose("sleeping %d seconds..." % sleep)
        time.sleep(sleep)

        # Stop xapi on the master (so that it doesn't run the post-host-dead-hook before xapi startup)
        xenrt.TEC().logverbose("stopping xapi on master...")
        cmd = "service xapi stop"
        self.host.execdom0(cmd)

        # Wait a bit more than another 5 minutes (totalling 10 = Xapi_globs.host_assumed_dead_interval)
        sleep = 5 * 60 + 30
        xenrt.TEC().logverbose("sleeping %d seconds..." % sleep)
        time.sleep(sleep)

        # Now see how long it takes to restart xapi on the master -- this should cause it to run the host-post-declare-dead hook
        xenrt.TEC().logverbose("now timing duration of xapi start on master...")
        cmd = "time service xapi start"
        output = self.host.execdom0(cmd, timeout=1800)
        xenrt.TEC().logverbose("output: %s" % output)
        dur = libperf.parseTimeOutput(output)

        line = "restart	%f" % dur
        self.log(logname, line)
예제 #3
0
    def run(self, arglist=None):
        output = self.host.execdom0("n=%d; time for ((i=0; i<=$n; i++)); do logger \"test message $i of $n\"; done" % self.messages)
        xenrt.TEC().logverbose("output: %s" % output)
        dur = libperf.parseTimeOutput(output)

        line = "%d  %f" % (self.messages, dur)
        self.log("syslog", line)
예제 #4
0
    def timeMigrate(self):
        # Watch for the downtime by repeated pinging
        t1 = DowntimeWatcherPing(self, self.host, self.vm)
        t2 = DowntimeWatcherNull(self, self.host, self.vm)
        watcherThreads = [t1, t2]

        for t in watcherThreads:
            t.start()

        # Do a localhost migrate
        output = self.host.execdom0(
            "time xe vm-migrate uuid=%s host-uuid=%s live=%s" %
            (self.vm.getUUID(), self.host.getMyHostUUID(), "true"))
        xenrt.TEC().logverbose(
            "output: %s" % output
        )  # e.g. '\nreal\t0m10.156s\nuser\t0m0.000s\nsys\t0m0.000s\n'
        totaltimesecs = libperf.parseTimeOutput(output)

        # Wait for the downtime monitors to return
        for t in watcherThreads:
            t.join()

        # Get the downtime from each thread
        times = [t.getTime() for t in watcherThreads]
        # Convert None into "" in case the thread doesn't set a valid time
        times = ["" if (t is None) else t for t in times]
        # Also include the total time
        times.append(str(totaltimesecs))
        xenrt.TEC().logverbose("times from threads were %s" % times)

        return '	'.join(times)
예제 #5
0
    def run(self, arglist=None):
        # Start and boot the gold VM
        xenrt.TEC().logverbose("Booting the gold VM...")
        bootwatcherLogfile = libperf.createLogName("bootwatcher")
        starterLogfile = libperf.createLogName("starter")
        self.timeStartVMs(1, [self.goldvm], starterLogfile, bootwatcherLogfile)

        # Snapshot the gold VM
        xenrt.TEC().logverbose("Snapshotting the gold VM...")
        output = self.host.execdom0("time xe vm-snapshot uuid=%s new-name-label=snapshot" % self.goldvm.uuid)
        snaptime = libperf.parseTimeOutput(output)
        line = "%f" % snaptime
        self.log("vmsnapshot", line)

        # Install n VMs from the snapshot
        xenrt.TEC().logverbose("Installing from the snapshot...")
        output = self.host.execdom0("for ((i=0; i<=%d; i++)); do time xe vm-install new-name-label=vm$i template-name-label=snapshot; done" % self.numvms)
        xenrt.TEC().logverbose("output: %s" % output)
        self.outputTimings(output, "vminstall")
예제 #6
0
    def run(self, arglist=None):
        # Start and boot the gold VM
        xenrt.TEC().logverbose("Booting the gold VM...")
        bootwatcherLogfile = libperf.createLogName("bootwatcher")
        starterLogfile = libperf.createLogName("starter")
        self.timeStartVMs(1, [self.goldvm], starterLogfile, bootwatcherLogfile)

        # Snapshot the gold VM
        xenrt.TEC().logverbose("Snapshotting the gold VM...")
        output = self.host.execdom0(
            "time xe vm-snapshot uuid=%s new-name-label=snapshot" %
            self.goldvm.uuid)
        snaptime = libperf.parseTimeOutput(output)
        line = "%f" % snaptime
        self.log("vmsnapshot", line)

        # Install n VMs from the snapshot
        xenrt.TEC().logverbose("Installing from the snapshot...")
        output = self.host.execdom0(
            "for ((i=0; i<=%d; i++)); do time xe vm-install new-name-label=vm$i template-name-label=snapshot; done"
            % self.numvms)
        xenrt.TEC().logverbose("output: %s" % output)
        self.outputTimings(output, "vminstall")
예제 #7
0
 def execCommandMeasureTime(self, durs, cmd):
     output = self.host.execdom0("time %s" % cmd)
     val = "\n".join(output.split('\n')[0:-4])
     durs.append(libperf.parseTimeOutput(output))
     return val
예제 #8
0
 def measurecommand(self, cmd, i, logfile):
     output = self.host.execdom0("time %s" % cmd)
     dur = libperf.parseTimeOutput(output)
     line = "%d	%f" % (i, dur)
     self.log(logfile, line)
예제 #9
0
 def execCommandMeasureTime(self, durs, cmd):
     output = self.host.execdom0("time %s" % cmd)
     val = "\n".join(output.split('\n')[0:-4])
     durs.append(libperf.parseTimeOutput(output))
     return val
예제 #10
0
 def measurecommand(self, cmd, i, logfile):
     output = self.host.execdom0("time %s" % cmd)
     dur = libperf.parseTimeOutput(output)
     line = "%d	%f" % (i, dur)
     self.log(logfile, line)