GeezerVison is showing github.com — Adding support for RHEL8 binary-compatible variants (#5158) · NetApp/cloudstack@98d3231
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: python/lib/cloudutils/serviceConfig.py -34Lines changed: 0 additions & 34 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 23 | 23 | import os | 24 | 24 | import shutil | 25 | 25 |
| 26 | | -# exit() error constants | 27 | | -Unknown = 0 | 28 | | -CentOS6 = 1 | 29 | | -CentOS7 = 2 | 30 | | -CentOS8 = 3 | 31 | | -Ubuntu = 4 | 32 | | -RHEL6 = 5 | 33 | | -RHEL7 = 6 | 34 | | -RHEL8 = 7 | 35 | | -distro = None | 36 | | - | 37 | | -#=================== DISTRIBUTION DETECTION ================= | 38 | | -if os.path.exists("/etc/centos-release"): | 39 | | - version = open("/etc/centos-release").readline() | 40 | | - if version.find("CentOS release 6") != -1: | 41 | | - distro = CentOS6 | 42 | | - elif version.find("CentOS Linux release 7") != -1: | 43 | | - distro = CentOS7 | 44 | | - elif version.find("CentOS Linux release 8") != -1: | 45 | | - distro = CentOS8 | 46 | | -elif os.path.exists("/etc/redhat-release"): | 47 | | - version = open("/etc/redhat-release").readline() | 48 | | - if version.find("Red Hat Enterprise Linux Server release 6") != -1: | 49 | | - distro = RHEL6 | 50 | | - elif version.find("Red Hat Enterprise Linux Server 7") != -1: | 51 | | - distro = RHEL7 | 52 | | - elif version.find("Red Hat Enterprise Linux Server 8") != -1: | 53 | | - distro = RHEL8 | 54 | | -elif os.path.exists("/etc/lsb-release") and "Ubuntu" in open("/etc/lsb-release").read(-1): distro = Ubuntu | 55 | | -else: distro = Unknown | 56 | | -#=================== DISTRIBUTION DETECTION ================= | 57 | | - | 58 | 26 | class serviceCfgBase(object): | 59 | 27 | def __init__(self, syscfg): | 60 | 28 | self.status = None | @@ -531,8 +499,6 @@ def config(self): | 531 | 499 | configureLibvirtConfig(self.syscfg.env.secure, self) | 532 | 500 |
| 533 | 501 | cfo = configFileOps("/etc/sysconfig/libvirtd", self) | 534 | | - if distro in (CentOS6,RHEL6): | 535 | | - cfo.addEntry("export CGROUP_DAEMON", "'cpu:/virt'") | 536 | 502 | cfo.addEntry("LIBVIRTD_ARGS", "-l") | 537 | 503 | cfo.save() | 538 | 504 | if os.path.exists("/lib/systemd/system/libvirtd.socket"): | |
Collapse file Copy file name to clipboardExpand all lines: python/lib/cloudutils/utilities.py +27-23Lines changed: 27 additions & 23 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | # to you under the Apache License, Version 2.0 (the | 6 | 6 | # "License"); you may not use this file except in compliance | 7 | 7 | # with the License. You may obtain a copy of the License at | 8 | | -# | | 8 | +# | 9 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 | 10 | | -# | | 10 | +# | 11 | 11 | # Unless required by applicable law or agreed to in writing, | 12 | 12 | # software distributed under the License is distributed on an | 13 | 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | @@ -53,25 +53,25 @@ def alarm_handler(signum, frame): | 53 | 53 | except: | 54 | 54 | raise CloudRuntimeException(formatExceptionInfo()) | 55 | 55 |
| 56 | | - if not self.success: | | 56 | + if not self.success: | 57 | 57 | logging.debug("Failed to execute:" + self.getErrMsg()) | 58 | 58 |
| 59 | 59 | def isSuccess(self): | 60 | 60 | return self.success | 61 | | - | | 61 | + | 62 | 62 | def getStdout(self): | 63 | 63 | return self.stdout.decode('utf-8').strip('\n') | 64 | | - | | 64 | + | 65 | 65 | def getLines(self): | 66 | 66 | return self.stdout.decode('utf-8').strip('\n') | 67 | 67 |
| 68 | 68 | def getStderr(self): | 69 | 69 | return self.stderr.decode('utf-8').strip('\n') | 70 | | - | | 70 | + | 71 | 71 | def getErrMsg(self): | 72 | 72 | if self.isSuccess(): | 73 | 73 | return "" | 74 | | - | | 74 | + | 75 | 75 | if self.getStderr() is None or self.getStderr() == "": | 76 | 76 | return self.getStdout() | 77 | 77 | else: | @@ -80,11 +80,11 @@ def getErrMsg(self): | 80 | 80 | def initLoging(logFile=None): | 81 | 81 | try: | 82 | 82 | if logFile is None: | 83 | | - logging.basicConfig(level=logging.DEBUG) | 84 | | - else: | 85 | | - logging.basicConfig(filename=logFile, level=logging.DEBUG) | | 83 | + logging.basicConfig(level=logging.DEBUG) | | 84 | + else: | | 85 | + logging.basicConfig(filename=logFile, level=logging.DEBUG) | 86 | 86 | except: | 87 | | - logging.basicConfig(level=logging.DEBUG) | | 87 | + logging.basicConfig(level=logging.DEBUG) | 88 | 88 |
| 89 | 89 | def writeProgressBar(msg, result): | 90 | 90 | output = "[%-6s]\n"%"Failed" | @@ -100,7 +100,7 @@ def writeProgressBar(msg, result): | 100 | 100 | class UnknownSystemException(Exception): | 101 | 101 | "This Excption is raised if the current operating enviornment is unknown" | 102 | 102 | pass | 103 | | - | | 103 | + | 104 | 104 | class Distribution: | 105 | 105 | def __init__(self): | 106 | 106 | self.distro = "Unknown" | @@ -110,11 +110,15 @@ def __init__(self): | 110 | 110 | self.distro = "Fedora" | 111 | 111 | elif os.path.exists("/etc/redhat-release"): | 112 | 112 | version = open("/etc/redhat-release").readline() | 113 | | - 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: | | 113 | + if (version.find("Red Hat Enterprise Linux Server release 6") != -1 or version.find("Scientific Linux release 6") != -1 or | | 114 | + version.find("CentOS Linux release 6") != -1 or version.find("CentOS release 6.") != -1): | 114 | 115 | self.distro = "RHEL6" | 115 | | - 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: | | 116 | + elif (version.find("Red Hat Enterprise Linux Server release 7") != -1 or version.find("Scientific Linux release 7") != -1 or | | 117 | + version.find("CentOS Linux release 7") != -1 or version.find("CentOS release 7.") != -1): | 116 | 118 | self.distro = "RHEL7" | 117 | | - 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: | | 119 | + elif (version.find("Red Hat Enterprise Linux Server release 8") != -1 or version.find("Scientific Linux release 8") != -1 or | | 120 | + version.find("CentOS Linux release 8") != -1 or version.find("CentOS release 8.") != -1 or | | 121 | + version.find("Linux release 8") != -1): | 118 | 122 | self.distro = "RHEL8" | 119 | 123 | elif version.find("CentOS") != -1: | 120 | 124 | self.distro = "CentOS" | @@ -134,17 +138,17 @@ def __init__(self): | 134 | 138 | self.distro = "Ubuntu" | 135 | 139 | else: | 136 | 140 | raise UnknownSystemException(distributor) | 137 | | - else: | | 141 | + else: | 138 | 142 | raise UnknownSystemException | 139 | 143 |
| 140 | 144 | def getVersion(self): | 141 | | - return self.distro | | 145 | + return self.distro | 142 | 146 | def getRelease(self): | 143 | 147 | return self.release | 144 | 148 | def getArch(self): | 145 | 149 | return self.arch | 146 | | - | 147 | | - | | 150 | + | | 151 | + | 148 | 152 | class serviceOps: | 149 | 153 | pass | 150 | 154 | class serviceOpsRedhat(serviceOps): | @@ -161,7 +165,7 @@ def isServiceRunning(self, servicename): | 161 | 165 | def stopService(self, servicename,force=False): | 162 | 166 | if self.isServiceRunning(servicename) or force: | 163 | 167 | return bash("service " + servicename +" stop").isSuccess() | 164 | | - | | 168 | + | 165 | 169 | return True | 166 | 170 | def disableService(self, servicename): | 167 | 171 | result = self.stopService(servicename) | @@ -176,13 +180,13 @@ def startService(self, servicename,force=False): | 176 | 180 | def enableService(self, servicename,forcestart=False): | 177 | 181 | bash("chkconfig --level 2345 " + servicename + " on") | 178 | 182 | return self.startService(servicename,force=forcestart) | 179 | | - | | 183 | + | 180 | 184 | def isKVMEnabled(self): | 181 | 185 | if os.path.exists("/dev/kvm"): | 182 | 186 | return True | 183 | 187 | else: | 184 | 188 | return False | 185 | | - | | 189 | + | 186 | 190 | class serviceOpsUbuntu(serviceOps): | 187 | 191 | def isServiceRunning(self, servicename): | 188 | 192 | try: | @@ -202,7 +206,7 @@ def disableService(self, servicename): | 202 | 206 | result = self.stopService(servicename) | 203 | 207 | bash("sudo update-rc.d -f " + servicename + " remove") | 204 | 208 | return result | 205 | | - | | 209 | + | 206 | 210 | def startService(self, servicename,force=True): | 207 | 211 | if not self.isServiceRunning(servicename) or force: | 208 | 212 | return bash("sudo /usr/sbin/service " + servicename + " start").isSuccess() | |
Collapse file Copy file name to clipboardExpand all lines: scripts/vm/network/security_group.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -185,7 +185,7 @@ def destroy_network_rules_for_nic(vm_name, vm_ip, vm_mac, vif, sec_ips): | 185 | 185 | logging.debug("Ignoring failure to delete ebtable rules for vm: " + vm_name) | 186 | 186 |
| 187 | 187 | def get_bridge_physdev(brname): | 188 | | - physdev = execute("bridge -o link show | awk '/master %s / && !/^[0-9]+: vnet/ {print $2}' | head -1 | cut -d ':' -f1" % brname) | | 188 | + physdev = execute("bridge -o link show | awk '/master %s / && !/^[0-9]+: vnet/ {print $2}' | head -1 | cut -d ':' -f1 | cut -d '@' -f1" % brname) | 189 | 189 | return physdev.strip() | 190 | 190 |
| 191 | 191 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/integration/smoke/test_deploy_vm_iso_uefi.py +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,7 +58,7 @@ def setUpClass(cls): | 58 | 58 |
| 59 | 59 | if not cls.isUefiEnabledOnAtLeastOnHost(hosts): | 60 | 60 | raise unittest.SkipTest("At least one host should support UEFI") | 61 | | - | | 61 | + | 62 | 62 | cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__ | 63 | 63 |
| 64 | 64 | # Create service, disk offerings etc | @@ -179,12 +179,12 @@ def getVirshXML(self, host, instancename): | 179 | 179 | def checkBootTypeAndMode(self, root, bootmodesecure, isWindowsIso): | 180 | 180 |
| 181 | 181 | machine = root.find(".os/type").get("machine") | 182 | | - | 183 | 182 | self.assertEqual(("q35" in machine), True, "The virtual machine is not with UEFI boot type") | 184 | 183 |
| 185 | | - bootmode = root.find(".os/loader").get("secure") | 186 | | - | 187 | | - self.assertEqual((bootmode == bootmodesecure), True, "The VM is not in the right boot mode") | | 184 | + if root.find(".os/loader") is not None : | | 185 | + bootmode = root.find(".os/loader").get("secure") | | 186 | + if bootmode is not None : | | 187 | + self.assertEqual((bootmode == bootmodesecure), True, "The VM is not in the right boot mode") | 188 | 188 |
| 189 | 189 | if isWindowsIso: | 190 | 190 | disks = root.findall("devices/disk") | |
Collapse file Copy file name to clipboardExpand all lines: test/integration/smoke/test_hostha_kvm.py +17-3Lines changed: 17 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -209,6 +209,18 @@ def deployVM(self): | 209 | 209 | except Exception as e: | 210 | 210 | raise self.skipTest("Failed to deploy VM, skipping kvm host-ha test case") | 211 | 211 |
| | 212 | + def skipIfMSIsUnsupported(self) : | | 213 | + os_details = SshClient(self.mgtSvrDetails["mgtSvrIp"], 22, self.mgtSvrDetails["user"], self.mgtSvrDetails["passwd"]).execute \ | | 214 | + ("/usr/share/cloudstack-common/scripts/vm/hypervisor/versions.sh | cut -d '=' -f2") | | 215 | + os = os_details[0].lower() | | 216 | + if 'ubuntu' in os or 'debian' in os : | | 217 | + return | | 218 | + # RHEL < 8 works fine | | 219 | + os_ver = os_details[1].split('.')[0] | | 220 | + if float(os_ver) < 8: | | 221 | + return | | 222 | + self.skipTest("Skipping since RHEL8 / SUSE have known IPMI issues") | | 223 | + | 212 | 224 | @attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true") | 213 | 225 | def test_disable_oobm_ha_state_ineligible(self): | 214 | 226 | """ | @@ -276,10 +288,10 @@ def test_hostha_enable_ha_when_host_in_maintenance(self): | 276 | 288 | self.logger.debug("Starting test_hostha_enable_ha_when_host_in_maintenance") | 277 | 289 | self.logger.debug("Pausing to wait for VMs to have finished starting") | 278 | 290 | time.sleep(300) | 279 | | - | | 291 | + | 280 | 292 | # Enable HA | 281 | 293 | self.configureAndEnableHostHa() | 282 | | - | | 294 | + | 283 | 295 |
| 284 | 296 | # Prepare for maintenance Host | 285 | 297 | self.setHostToMaintanance(self.host.id) | @@ -351,6 +363,7 @@ def test_hostha_kvm_host_degraded(self): | 351 | 363 | Tests degraded HA state when agent is stopped/killed | 352 | 364 | """ | 353 | 365 |
| | 366 | + self.skipIfMSIsUnsupported() | 354 | 367 | self.configureAndStartIpmiServer() | 355 | 368 | self.assertIssueCommandState('ON', 'On') | 356 | 369 | self.configureAndEnableHostHa() | @@ -387,6 +400,7 @@ def test_hostha_kvm_host_recovering(self): | 387 | 400 | Tests recovery and fencing HA state transitions | 388 | 401 | """ | 389 | 402 |
| | 403 | + self.skipIfMSIsUnsupported() | 390 | 404 | self.configureAndStartIpmiServer() | 391 | 405 | self.assertIssueCommandState('ON', 'On') | 392 | 406 | self.configureAndEnableHostHa() | @@ -426,7 +440,7 @@ def test_hostha_kvm_host_fencing(self): | 426 | 440 | """ | 427 | 441 | self.logger.debug("Starting test_ha_kvm_host_fencing") | 428 | 442 |
| 429 | | - | | 443 | + self.skipIfMSIsUnsupported() | 430 | 444 | self.configureAndStartIpmiServer() | 431 | 445 | self.assertIssueCommandState('ON', 'On') | 432 | 446 | self.configureAndEnableHostHa() | |
Collapse file Copy file name to clipboardExpand all lines: test/integration/smoke/test_outofbandmanagement.py +13-1Lines changed: 13 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -42,10 +42,12 @@ class TestOutOfBandManagement(cloudstackTestCase): | 42 | 42 | def setUpClass(cls): | 43 | 43 | testClient = super(TestOutOfBandManagement, cls).getClsTestClient() | 44 | 44 | cls.apiclient = testClient.getApiClient() | | 45 | + cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__ | 45 | 46 | cls.services = testClient.getParsedTestDataConfig() | 46 | 47 | cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) | 47 | 48 | cls.host = None | 48 | 49 | cls.cleanup = [] | | 50 | + cls.skipIfMSIsUnsupported(cls) | 49 | 51 |
| 50 | 52 | # use random port for ipmisim | 51 | 53 | s = socket.socket() | @@ -82,7 +84,6 @@ def setUp(self): | 82 | 84 | self.fakeMsId = random.randint(10000, 99999) * random.randint(10, 20) | 83 | 85 | self.cleanup = [] | 84 | 86 |
| 85 | | - | 86 | 87 | def tearDown(self): | 87 | 88 | try: | 88 | 89 | self.dbclient.execute("delete from oobm where port=%d" % self.getIpmiServerPort()) | @@ -94,6 +95,17 @@ def tearDown(self): | 94 | 95 | except Exception as e: | 95 | 96 | raise Exception("Warning: Exception during cleanup : %s" % e) | 96 | 97 |
| | 98 | + def skipIfMSIsUnsupported(self) : | | 99 | + os_details = SshClient(self.mgtSvrDetails["mgtSvrIp"], 22, self.mgtSvrDetails["user"], self.mgtSvrDetails["passwd"]).execute \ | | 100 | + ("/usr/share/cloudstack-common/scripts/vm/hypervisor/versions.sh | cut -d '=' -f2") | | 101 | + os = os_details[0].lower() | | 102 | + if 'ubuntu' in os or 'debian' in os : | | 103 | + return | | 104 | + # RHEL < 8 works fine | | 105 | + os_ver = os_details[1].split('.')[0] | | 106 | + if float(os_ver) < 8: | | 107 | + return | | 108 | + self.skipTest(self, reason="Skipping since RHEL8 / SUSE have known IPMI issues") | 97 | 109 |
| 98 | 110 | def getFakeMsId(self): | 99 | 111 | return self.fakeMsId | |
|