示例#1
0
    def processVm(self, session, vm, snapshot):
        xenrt.TEC().logverbose("shutdownwatcher processing VM %s" % vm)
        xenrt.TEC().logverbose(
            "vm %s has power_state=%s and seenrunning=%s and seenshutdown=%s" %
            (vm, snapshot['power_state'], vm in self.seenrunning, vm
             in self.seenshutdown))

        if snapshot['power_state'] == "Running":
            self.seenrunning[vm] = True
            self.seenshutdown[vm] = False
            xenrt.TEC().logverbose("vm %s is running" % vm)
        elif snapshot[
                'power_state'] == "Halted" and vm in self.seenrunning and not self.seenshutdown[
                    vm]:
            xenrt.TEC().logverbose(
                "vm %s is halted and was previously running and not previously shut down"
                % vm)
            t = libperf.formattime(libperf.timenow())
            name = snapshot['name_label']
            line = "%s %s" % (name, t)
            xenrt.TEC().logverbose("SHUTDOWN %s" % line)
            libperf.outputToResultsFile(self.logFile, line)
            self.previousShutdownTime = time.time()
            self.seenshutdown[vm] = True

            self.num_seen_shutdowns = self.num_seen_shutdowns + 1
            if self.num_seen_shutdowns == self.num_expected_shutdowns:
                self.complete = True
            xenrt.TEC().logverbose(
                "seen %d shutdowns of %d expected, hence complete=%s" %
                (self.num_seen_shutdowns, self.num_expected_shutdowns,
                 self.complete))
示例#2
0
    def run(self):
        xenrt.TEC().logverbose("shutdownwatcher running")
        n = libperf.formattime(libperf.timenow())
        zero = "zero"
        line = "%s %s %s" % (zero, n, n)
        xenrt.TEC().logverbose("SHUTDOWN %s" % line)
        libperf.outputToResultsFile(self.logFile, line)

        session = self.host.getAPISession(secure=False)

        try:
            self.watchEventsOnVm(session)
        finally:
            self.host.logoutAPISession(session)
示例#3
0
    def run(self):
        xenrt.TEC().logverbose("shutdownwatcher running")
        n = libperf.formattime(libperf.timenow())
        zero = "zero"
        line = "%s %s %s" % (zero, n, n)
        xenrt.TEC().logverbose("SHUTDOWN %s" % line)
        libperf.outputToResultsFile(self.logFile, line)

        session = self.host.getAPISession(secure=False)

        try:
            self.watchEventsOnVm(session)
        finally:
            self.host.logoutAPISession(session)
示例#4
0
    def processVm(self, session, vm, snapshot):
        xenrt.TEC().logverbose("shutdownwatcher processing VM %s" % vm)
        xenrt.TEC().logverbose("vm %s has power_state=%s and seenrunning=%s and seenshutdown=%s" % (vm, snapshot['power_state'], vm in self.seenrunning, vm in self.seenshutdown))

        if snapshot['power_state'] == "Running":
            self.seenrunning[vm] = True
            self.seenshutdown[vm] = False
            xenrt.TEC().logverbose("vm %s is running" % vm)
        elif snapshot['power_state'] == "Halted" and vm in self.seenrunning and not self.seenshutdown[vm]:
            xenrt.TEC().logverbose("vm %s is halted and was previously running and not previously shut down" % vm)
            t = libperf.formattime(libperf.timenow())
            name = snapshot['name_label']
            line = "%s %s" % (name, t)
            xenrt.TEC().logverbose("SHUTDOWN %s" % line)
            libperf.outputToResultsFile(self.logFile, line)
            self.previousShutdownTime = time.time()
            self.seenshutdown[vm] = True

            self.num_seen_shutdowns = self.num_seen_shutdowns + 1
            if self.num_seen_shutdowns == self.num_expected_shutdowns:
                self.complete = True
            xenrt.TEC().logverbose("seen %d shutdowns of %d expected, hence complete=%s" % (self.num_seen_shutdowns, self.num_expected_shutdowns, self.complete))