mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
72182b6bd9
commit
98d3231dbf
@ -23,38 +23,6 @@ from .configFileOps import configFileOps
|
|||||||
import os
|
import os
|
||||||
import shutil
|
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):
|
class serviceCfgBase(object):
|
||||||
def __init__(self, syscfg):
|
def __init__(self, syscfg):
|
||||||
self.status = None
|
self.status = None
|
||||||
@ -531,8 +499,6 @@ class libvirtConfigRedhat(serviceCfgBase):
|
|||||||
configureLibvirtConfig(self.syscfg.env.secure, self)
|
configureLibvirtConfig(self.syscfg.env.secure, self)
|
||||||
|
|
||||||
cfo = configFileOps("/etc/sysconfig/libvirtd", 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.addEntry("LIBVIRTD_ARGS", "-l")
|
||||||
cfo.save()
|
cfo.save()
|
||||||
if os.path.exists("/lib/systemd/system/libvirtd.socket"):
|
if os.path.exists("/lib/systemd/system/libvirtd.socket"):
|
||||||
|
|||||||
@ -110,11 +110,15 @@ class Distribution:
|
|||||||
self.distro = "Fedora"
|
self.distro = "Fedora"
|
||||||
elif os.path.exists("/etc/redhat-release"):
|
elif os.path.exists("/etc/redhat-release"):
|
||||||
version = open("/etc/redhat-release").readline()
|
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"
|
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"
|
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"
|
self.distro = "RHEL8"
|
||||||
elif version.find("CentOS") != -1:
|
elif version.find("CentOS") != -1:
|
||||||
self.distro = "CentOS"
|
self.distro = "CentOS"
|
||||||
|
|||||||
@ -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)
|
logging.debug("Ignoring failure to delete ebtable rules for vm: " + vm_name)
|
||||||
|
|
||||||
def get_bridge_physdev(brname):
|
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()
|
return physdev.strip()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -179,11 +179,11 @@ class TestDeployVMFromISOWithUefi(cloudstackTestCase):
|
|||||||
def checkBootTypeAndMode(self, root, bootmodesecure, isWindowsIso):
|
def checkBootTypeAndMode(self, root, bootmodesecure, isWindowsIso):
|
||||||
|
|
||||||
machine = root.find(".os/type").get("machine")
|
machine = root.find(".os/type").get("machine")
|
||||||
|
|
||||||
self.assertEqual(("q35" in machine), True, "The virtual machine is not with UEFI boot type")
|
self.assertEqual(("q35" in machine), True, "The virtual machine is not with UEFI boot type")
|
||||||
|
|
||||||
|
if root.find(".os/loader") is not None :
|
||||||
bootmode = root.find(".os/loader").get("secure")
|
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")
|
self.assertEqual((bootmode == bootmodesecure), True, "The VM is not in the right boot mode")
|
||||||
|
|
||||||
if isWindowsIso:
|
if isWindowsIso:
|
||||||
|
|||||||
@ -209,6 +209,18 @@ class TestHAKVM(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise self.skipTest("Failed to deploy VM, skipping kvm host-ha test case")
|
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")
|
@attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
|
||||||
def test_disable_oobm_ha_state_ineligible(self):
|
def test_disable_oobm_ha_state_ineligible(self):
|
||||||
"""
|
"""
|
||||||
@ -351,6 +363,7 @@ class TestHAKVM(cloudstackTestCase):
|
|||||||
Tests degraded HA state when agent is stopped/killed
|
Tests degraded HA state when agent is stopped/killed
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.skipIfMSIsUnsupported()
|
||||||
self.configureAndStartIpmiServer()
|
self.configureAndStartIpmiServer()
|
||||||
self.assertIssueCommandState('ON', 'On')
|
self.assertIssueCommandState('ON', 'On')
|
||||||
self.configureAndEnableHostHa()
|
self.configureAndEnableHostHa()
|
||||||
@ -387,6 +400,7 @@ class TestHAKVM(cloudstackTestCase):
|
|||||||
Tests recovery and fencing HA state transitions
|
Tests recovery and fencing HA state transitions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.skipIfMSIsUnsupported()
|
||||||
self.configureAndStartIpmiServer()
|
self.configureAndStartIpmiServer()
|
||||||
self.assertIssueCommandState('ON', 'On')
|
self.assertIssueCommandState('ON', 'On')
|
||||||
self.configureAndEnableHostHa()
|
self.configureAndEnableHostHa()
|
||||||
@ -426,7 +440,7 @@ class TestHAKVM(cloudstackTestCase):
|
|||||||
"""
|
"""
|
||||||
self.logger.debug("Starting test_ha_kvm_host_fencing")
|
self.logger.debug("Starting test_ha_kvm_host_fencing")
|
||||||
|
|
||||||
|
self.skipIfMSIsUnsupported()
|
||||||
self.configureAndStartIpmiServer()
|
self.configureAndStartIpmiServer()
|
||||||
self.assertIssueCommandState('ON', 'On')
|
self.assertIssueCommandState('ON', 'On')
|
||||||
self.configureAndEnableHostHa()
|
self.configureAndEnableHostHa()
|
||||||
|
|||||||
@ -42,10 +42,12 @@ class TestOutOfBandManagement(cloudstackTestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
testClient = super(TestOutOfBandManagement, cls).getClsTestClient()
|
testClient = super(TestOutOfBandManagement, cls).getClsTestClient()
|
||||||
cls.apiclient = testClient.getApiClient()
|
cls.apiclient = testClient.getApiClient()
|
||||||
|
cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
|
||||||
cls.services = testClient.getParsedTestDataConfig()
|
cls.services = testClient.getParsedTestDataConfig()
|
||||||
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
|
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
|
||||||
cls.host = None
|
cls.host = None
|
||||||
cls.cleanup = []
|
cls.cleanup = []
|
||||||
|
cls.skipIfMSIsUnsupported(cls)
|
||||||
|
|
||||||
# use random port for ipmisim
|
# use random port for ipmisim
|
||||||
s = socket.socket()
|
s = socket.socket()
|
||||||
@ -82,7 +84,6 @@ class TestOutOfBandManagement(cloudstackTestCase):
|
|||||||
self.fakeMsId = random.randint(10000, 99999) * random.randint(10, 20)
|
self.fakeMsId = random.randint(10000, 99999) * random.randint(10, 20)
|
||||||
self.cleanup = []
|
self.cleanup = []
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.dbclient.execute("delete from oobm where port=%d" % self.getIpmiServerPort())
|
self.dbclient.execute("delete from oobm where port=%d" % self.getIpmiServerPort())
|
||||||
@ -94,6 +95,17 @@ class TestOutOfBandManagement(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % 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):
|
def getFakeMsId(self):
|
||||||
return self.fakeMsId
|
return self.fakeMsId
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user