return SciLinux("sl66", parent) @property def isoName(self): if not SciLinux.knownDistro(self.distro): return None return self._defaultIsoName @classmethod def detect(cls, parent, detectionState): obj = cls("testscilinux", parent, detectionState.password) if obj.execSSH("test -e /etc/sl-release", retval="code") != 0: raise OSNotDetected("OS is not Scientific Linux") distro = obj.execSSH("cat /etc/sl-release | " "sed 's/Scientific Linux release /scilinux/' | " "awk '{print $1}'").strip() dd = distro.split(".") distro = dd[0] if dd[1] != "0": distro += dd[1] if re.match("^scilinux(\d+)$", distro): return cls("%s_%s" % (distro, obj.getArch()), parent, obj.password) else: raise OSNotDetected("Could not determine Scientific Linux version") registerOS(RHELLinux) registerOS(CentOSLinux) registerOS(OELLinux) registerOS(SciLinux)
return distro.startswith("sles") @staticmethod def testInit(parent): return SLESLinux("sles10", parent) @property def isoName(self): if not SLESLinux.knownDistro(self.distro): return None return self._defaultIsoName @classmethod def detect(cls, parent, detectionState): obj=cls("testsuse", parent, detectionState.password) release = obj.execSSH("cat /etc/SuSE-release") releaseMatch = re.search("VERSION = (\d+)", release) patchMatch = re.search("PATCHLEVEL = (\d+)", release) if releaseMatch: ret = "sles" ret += releaseMatch.group(1) if patchMatch and patchMatch.group(1) != "0": ret += patchMatch.group(1) return cls("%s_%s" % (ret, obj.getArch()), parent, obj.password) raise OSNotDetected("Could not determine SLES version") registerOS(SLESLinux)
@property def isoName(self): if not SciLinux.knownDistro(self.distro): return None return self._defaultIsoName @classmethod def detect(cls, parent, detectionState): obj=cls("testscilinux", parent, detectionState.password) if obj.execSSH("test -e /etc/sl-release", retval="code") != 0: raise OSNotDetected("OS is not Scientific Linux") distro = obj.execSSH("cat /etc/sl-release | " "sed 's/Scientific Linux release /scilinux/' | " "awk '{print $1}'").strip() dd = distro.split(".") distro = dd[0] if dd[1] != "0": distro += dd[1] if re.match("^scilinux(\d+)$", distro): return cls("%s_%s" % (distro, obj.getArch()), parent, obj.password) else: raise OSNotDetected("Could not determine Scientific Linux version") registerOS(RHELLinux) registerOS(CentOSLinux) registerOS(OELLinux) registerOS(SciLinux)
@staticmethod def testInit(parent): return XSDom0("XSDom0", parent) @property def canonicalDistroName(self): return "XSDom0" def preCloneTailor(self): pass def waitForBoot(self, timeout): # We consider boot of XenServer complete once it responds to SSH startTime = xenrt.util.timenow() self.getIP(trafficType="SSH", timeout=timeout) # Reduce the timeout by however long it took to get the IP timeout -= (xenrt.util.timenow() - startTime) # Now wait for an SSH response in the remaining time self.waitForSSH(timeout) @classmethod def detect(cls, parent, detectionState): obj = cls("XSDom0", parent, detectionState.password) if obj.execSSH("test -e /etc/xensource-inventory", retval="code") == 0: return cls("XSDom0", parent, obj.password) raise OSNotDetected("OS is not XenServer") registerOS(XSDom0)
@property def defaultMemory(self): return 1024 def waitForBoot(self, timeout): # We consider boot of a CoreOS guest complete once it responds to SSH startTime = xenrt.util.timenow() self.getIP(trafficType="SSH", timeout=timeout) # Reduce the timeout by however long it took to get the IP timeout -= (xenrt.util.timenow() - startTime) # Now wait for an SSH response in the remaining time self.waitForSSH(timeout) @staticmethod def knownDistro(distro): return distro.startswith("coreos") @staticmethod def testInit(parent): return CoreOSLinux("coreos", parent) @classmethod def detect(cls, parent, detectionState): obj=cls("testcoreos", parent, detectionState.password) if obj.execSSH("grep NAME=CoreOS /etc/os-release", retval="code") == 0: return cls("coreos_x86-64", parent, obj.password) else: raise OSNotDetected("OS it not CoreOS") registerOS(CoreOSLinux)
"ubuntu1204": "precise", "ubuntu1404": "trusty"} @staticmethod def knownDistro(distro): return distro.startswith("ubuntu") @staticmethod def testInit(parent): return UbuntuLinux("ubuntu1204", parent) @property def isoName(self): return "%s_%s_xenrtinst.iso" % (self.distro, self.arch) @classmethod def detect(cls, parent, detectionState): obj=cls("testdeb", parent, detectionState.password) isUbuntu = obj.execSSH("grep Ubuntu /etc/lsb-release", retval="code") == 0 if not isUbuntu: raise OSNotDetected("OS is not Ubuntu") else: release = obj.execSSH("cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d = -f 2 | tr -d .") if re.match("^\d+$", release): return cls("ubuntu%s0_%s" % (release, obj.getArch()), parent, obj.password) else: raise OSNotDetected("Could not determine Ubuntu version") registerOS(DebianLinux) registerOS(UbuntuLinux)
return distro == "XSDom0" @staticmethod def testInit(parent): return XSDom0("XSDom0", parent) @property def canonicalDistroName(self): return "XSDom0" def preCloneTailor(self): pass def waitForBoot(self, timeout): # We consider boot of XenServer complete once it responds to SSH startTime = xenrt.util.timenow() self.getIP(trafficType="SSH", timeout=timeout) # Reduce the timeout by however long it took to get the IP timeout -= (xenrt.util.timenow() - startTime) # Now wait for an SSH response in the remaining time self.waitForSSH(timeout) @classmethod def detect(cls, parent, detectionState): obj=cls("XSDom0", parent, detectionState.password) if obj.execSSH("test -e /etc/xensource-inventory", retval="code") == 0: return cls("XSDom0", parent, obj.password) raise OSNotDetected("OS is not XenServer") registerOS(XSDom0)
return distro.startswith("ubuntu") @staticmethod def testInit(parent): return UbuntuLinux("ubuntu1204", parent) @property def isoName(self): return "%s_%s_xenrtinst.iso" % (self.distro, self.arch) @classmethod def detect(cls, parent, detectionState): obj = cls("testdeb", parent, detectionState.password) isUbuntu = obj.execSSH("grep Ubuntu /etc/lsb-release", retval="code") == 0 if not isUbuntu: raise OSNotDetected("OS is not Ubuntu") else: release = obj.execSSH( "cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d = -f 2 | tr -d ." ) if re.match("^\d+$", release): return cls("ubuntu%s0_%s" % (release, obj.getArch()), parent, obj.password) else: raise OSNotDetected("Could not determine Ubuntu version") registerOS(DebianLinux) registerOS(UbuntuLinux)