Adding support for RHEL8 binary-compatible variants (#5158)

* Adding support for RHEL binary-compatible variants

* Skip ipmi related tests

* Fixing security_groups.py
This commit is contained in:
davidjumani 2021-08-18 13:33:03 +05:30 committed by GitHub
parent 72182b6bd9
commit 98d3231dbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 67 deletions

View File

@ -23,38 +23,6 @@ from .configFileOps import configFileOps
import os
import shutil
# exit() error constants
Unknown = 0
CentOS6 = 1
CentOS7 = 2
CentOS8 = 3
Ubuntu = 4
RHEL6 = 5
RHEL7 = 6
RHEL8 = 7
distro = None
#=================== DISTRIBUTION DETECTION =================
if os.path.exists("/etc/centos-release"):
version = open("/etc/centos-release").readline()
if version.find("CentOS release 6") != -1:
distro = CentOS6
elif version.find("CentOS Linux release 7") != -1:
distro = CentOS7
elif version.find("CentOS Linux release 8") != -1:
distro = CentOS8
elif os.path.exists("/etc/redhat-release"):
version = open("/etc/redhat-release").readline()
if version.find("Red Hat Enterprise Linux Server release 6") != -1:
distro = RHEL6
elif version.find("Red Hat Enterprise Linux Server 7") != -1:
distro = RHEL7
elif version.find("Red Hat Enterprise Linux Server 8") != -1:
distro = RHEL8
elif os.path.exists("/etc/lsb-release") and "Ubuntu" in open("/etc/lsb-release").read(-1): distro = Ubuntu
else: distro = Unknown
#=================== DISTRIBUTION DETECTION =================
class serviceCfgBase(object):
def __init__(self, syscfg):
self.status = None
@ -531,8 +499,6 @@ class libvirtConfigRedhat(serviceCfgBase):
configureLibvirtConfig(self.syscfg.env.secure, self)
cfo = configFileOps("/etc/sysconfig/libvirtd", self)
if distro in (CentOS6,RHEL6):
cfo.addEntry("export CGROUP_DAEMON", "'cpu:/virt'")
cfo.addEntry("LIBVIRTD_ARGS", "-l")
cfo.save()
if os.path.exists("/lib/systemd/system/libvirtd.socket"):

View File

@ -110,11 +110,15 @@ class Distribution:
self.distro = "Fedora"
elif os.path.exists("/etc/redhat-release"):
version = open("/etc/redhat-release").readline()
if version.find("Red Hat Enterprise Linux Server release 6") != -1 or version.find("Scientific Linux release 6") != -1 or version.find("CentOS Linux release 6") != -1 or version.find("CentOS release 6.") != -1:
if (version.find("Red Hat Enterprise Linux Server release 6") != -1 or version.find("Scientific Linux release 6") != -1 or
version.find("CentOS Linux release 6") != -1 or version.find("CentOS release 6.") != -1):
self.distro = "RHEL6"
elif version.find("Red Hat Enterprise Linux Server release 7") != -1 or version.find("Scientific Linux release 7") != -1 or version.find("CentOS Linux release 7") != -1 or version.find("CentOS release 7.") != -1:
elif (version.find("Red Hat Enterprise Linux Server release 7") != -1 or version.find("Scientific Linux release 7") != -1 or
version.find("CentOS Linux release 7") != -1 or version.find("CentOS release 7.") != -1):
self.distro = "RHEL7"
elif version.find("Red Hat Enterprise Linux Server release 8") != -1 or version.find("Scientific Linux release 8") != -1 or version.find("CentOS Linux release 8") != -1 or version.find("CentOS release 8.") != -1:
elif (version.find("Red Hat Enterprise Linux Server release 8") != -1 or version.find("Scientific Linux release 8") != -1 or
version.find("CentOS Linux release 8") != -1 or version.find("CentOS release 8.") != -1 or
version.find("Linux release 8") != -1):
self.distro = "RHEL8"
elif version.find("CentOS") != -1:
self.distro = "CentOS"

View File

@ -185,7 +185,7 @@ def destroy_network_rules_for_nic(vm_name, vm_ip, vm_mac, vif, sec_ips):
logging.debug("Ignoring failure to delete ebtable rules for vm: " + vm_name)
def get_bridge_physdev(brname):
physdev = execute("bridge -o link show | awk '/master %s / && !/^[0-9]+: vnet/ {print $2}' | head -1 | cut -d ':' -f1" % brname)
physdev = execute("bridge -o link show | awk '/master %s / && !/^[0-9]+: vnet/ {print $2}' | head -1 | cut -d ':' -f1 | cut -d '@' -f1" % brname)
return physdev.strip()

View File

@ -179,12 +179,12 @@ class TestDeployVMFromISOWithUefi(cloudstackTestCase):
def checkBootTypeAndMode(self, root, bootmodesecure, isWindowsIso):
machine = root.find(".os/type").get("machine")
self.assertEqual(("q35" in machine), True, "The virtual machine is not with UEFI boot type")
bootmode = root.find(".os/loader").get("secure")
self.assertEqual((bootmode == bootmodesecure), True, "The VM is not in the right boot mode")
if root.find(".os/loader") is not None :
bootmode = root.find(".os/loader").get("secure")
if bootmode is not None :
self.assertEqual((bootmode == bootmodesecure), True, "The VM is not in the right boot mode")
if isWindowsIso:
disks = root.findall("devices/disk")

View File

@ -209,6 +209,18 @@ class TestHAKVM(cloudstackTestCase):
except Exception as e:
raise self.skipTest("Failed to deploy VM, skipping kvm host-ha test case")
def skipIfMSIsUnsupported(self) :
os_details = SshClient(self.mgtSvrDetails["mgtSvrIp"], 22, self.mgtSvrDetails["user"], self.mgtSvrDetails["passwd"]).execute \
("/usr/share/cloudstack-common/scripts/vm/hypervisor/versions.sh | cut -d '=' -f2")
os = os_details[0].lower()
if 'ubuntu' in os or 'debian' in os :
return
# RHEL < 8 works fine
os_ver = os_details[1].split('.')[0]
if float(os_ver) < 8:
return
self.skipTest("Skipping since RHEL8 / SUSE have known IPMI issues")
@attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
def test_disable_oobm_ha_state_ineligible(self):
"""
@ -351,6 +363,7 @@ class TestHAKVM(cloudstackTestCase):
Tests degraded HA state when agent is stopped/killed
"""
self.skipIfMSIsUnsupported()
self.configureAndStartIpmiServer()
self.assertIssueCommandState('ON', 'On')
self.configureAndEnableHostHa()
@ -387,6 +400,7 @@ class TestHAKVM(cloudstackTestCase):
Tests recovery and fencing HA state transitions
"""
self.skipIfMSIsUnsupported()
self.configureAndStartIpmiServer()
self.assertIssueCommandState('ON', 'On')
self.configureAndEnableHostHa()
@ -426,7 +440,7 @@ class TestHAKVM(cloudstackTestCase):
"""
self.logger.debug("Starting test_ha_kvm_host_fencing")
self.skipIfMSIsUnsupported()
self.configureAndStartIpmiServer()
self.assertIssueCommandState('ON', 'On')
self.configureAndEnableHostHa()

View File

@ -42,10 +42,12 @@ class TestOutOfBandManagement(cloudstackTestCase):
def setUpClass(cls):
testClient = super(TestOutOfBandManagement, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.host = None
cls.cleanup = []
cls.skipIfMSIsUnsupported(cls)
# use random port for ipmisim
s = socket.socket()
@ -82,7 +84,6 @@ class TestOutOfBandManagement(cloudstackTestCase):
self.fakeMsId = random.randint(10000, 99999) * random.randint(10, 20)
self.cleanup = []
def tearDown(self):
try:
self.dbclient.execute("delete from oobm where port=%d" % self.getIpmiServerPort())
@ -94,6 +95,17 @@ class TestOutOfBandManagement(cloudstackTestCase):
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
def skipIfMSIsUnsupported(self) :
os_details = SshClient(self.mgtSvrDetails["mgtSvrIp"], 22, self.mgtSvrDetails["user"], self.mgtSvrDetails["passwd"]).execute \
("/usr/share/cloudstack-common/scripts/vm/hypervisor/versions.sh | cut -d '=' -f2")
os = os_details[0].lower()
if 'ubuntu' in os or 'debian' in os :
return
# RHEL < 8 works fine
os_ver = os_details[1].split('.')[0]
if float(os_ver) < 8:
return
self.skipTest(self, reason="Skipping since RHEL8 / SUSE have known IPMI issues")
def getFakeMsId(self):
return self.fakeMsId