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))
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
+