def __init__(self, conn, uuid): self.conn = conn self.libvirtconn = conn self.uuid = uuid self.domainObj = None self.old_stats = None self.new_stats = None self.temp_stats = Stats() self.utils = XMLUtils()
def createfake_newStats_forhost(self, status=True): stats = Stats() stats.freeMemory = 99982L stats.totalMemory = 2097152L stats.timestamp = time.time() stats.ncpus = 1 if status: stats.status = 0 else: stats.status = -1 return stats
def createfake_oldStats(self): stats = Stats() stats.freeMemory = 0L stats.totalMemory = 2097152L stats.timestamp = 1331372444.5931201 stats.ncpus = 1 stats.diskReadBytes = 226644480L stats.diskWriteBytes = 33723392L stats.netReceivedBytes = 357325L stats.netTransmittedBytes = 8302L stats.cpuStats = CPUStats() stats.cpuStats.cycles['user'] = 696880000000 stats.cpuPerfTime = 1331372444.3490119 stats.diskPerfTime = 1331372444.472137 stats.netPerfTime = 1331372444.5922019 return stats
def createfake_newStats_nochange(self, poweroff, stats_decrement): stats = Stats() stats.freeMemory = 0L stats.totalMemory = 2097152L stats.timestamp = 1331372444.5931201 stats.ncpus = 1 if poweroff: stats.diskReadBytes = 0 elif stats_decrement: stats.diskReadBytes = 226643380L else: stats.diskReadBytes = 226644480L stats.diskWriteBytes = 33723392L stats.netReceivedBytes = 357325L stats.netTransmittedBytes = 8302L stats.cpuStats = CPUStats() stats.cpuStats.cycles['user'] = 696880000000 stats.cpuPerfTime = 1331372444.3490119 stats.diskPerfTime = 1331372444.472137 stats.netPerfTime = 1331372444.5922019 return stats
def createfake_newStats(self, now, status): stats = Stats() stats.freeMemory = 0L stats.totalMemory = 2097152L if now: stats.timestamp = time.time() else: stats.timestamp = 1331372625.171705 stats.ncpus = 1 stats.diskReadBytes = 226644480L stats.diskWriteBytes = 34006016L stats.netReceivedBytes = 362137L stats.netTransmittedBytes = 8302L stats.cpuStats = CPUStats() stats.cpuStats.cycles['user'] = 697480000000 stats.cpuPerfTime = 1331372624.9259009 stats.diskPerfTime = 1331372625.050205 stats.netPerfTime = 1331372625.1707871 if status: stats.status = 0 else: stats.status = -1 return stats