From: Alex Brett Date: Tue, 10 Nov 2015 12:45:18 +0000 (+0000) Subject: CA-188288 Tweaks to guest memory checks X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9ac920a99e49da28b64f7f644c455f46d80ecec2;p=xenrt-citrix%2Fxenrt.git CA-188288 Tweaks to guest memory checks --- diff --git a/exec/testcases/xenserver/tc/smoketest.py b/exec/testcases/xenserver/tc/smoketest.py index a3464a2d7..075f1a0cb 100755 --- a/exec/testcases/xenserver/tc/smoketest.py +++ b/exec/testcases/xenserver/tc/smoketest.py @@ -138,14 +138,19 @@ class _TCSmokeTest(xenrt.TestCase): self.guest.shutdown(force=True) def checkGuestMemory(self, expected): - """Validate the in-guest memory is what we expect (within 2%)""" + """Validate the in-guest memory is what we expect (within 4%)""" if expected is None: return guestMemory = self.guest.getGuestMemory() + # Take into account any kdump kernel + kdumpSize = self.guest.os.getKdumpSize() + if kdumpSize: + xenrt.TEC().logverbose("Taking into account %uMB of crash kernel" % (kdumpSize / xenrt.MEGA)) + guestMemory += (kdumpSize / xenrt.MEGA) difference = abs(expected - guestMemory) diffpct = (float(difference) / float(expected)) * 100 - if diffpct > 3: + if diffpct > 4: raise xenrt.XRTFailure("Guest reports %uMB memory, expecting %uMB" % (guestMemory, expected)) diff --git a/exec/xenrt/lib/opsys/linux.py b/exec/xenrt/lib/opsys/linux.py index ccd53e33a..d8ad73b74 100644 --- a/exec/xenrt/lib/opsys/linux.py +++ b/exec/xenrt/lib/opsys/linux.py @@ -184,3 +184,9 @@ class LinuxOS(OS): raise OSNotDetected("OS appears not to have SSH: %s" % str(e)) else: detectionState.password = obj.password + + def getKdumpSize(self): + """Returns the size (in bytes) of any crashdump kernel present on the OS""" + size = int(self.execSSH("[ -e /sys/kernel/kexec_crash_size ] && cat /sys/kernel/kexec_crash_size || echo 0").strip()) + return size or None +