Tomas Jelinek has uploaded a new change for review. Change subject: core: disable the mixing of RHEL6 and RHEL7 in one cluster ......................................................................
core: disable the mixing of RHEL6 and RHEL7 in one cluster This patch handles the special case, that the RHEL6 and RHEL7 can not be mixed in one cluster even the emulated machines are the same. If the newly added host is not compatible with the rest of the hosts, it is turned to be non operational. Change-Id: Ieb6d41b1921a6caf946cba44a6c92ef86fef6bc8 Bug-Url: https://bugzilla.redhat.com/1150191 Signed-off-by: Tomas Jelinek <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAO.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsDAOTest.java M backend/manager/modules/dal/src/test/resources/fixtures.xml M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/MonitoringStrategyFactory.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java M backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/MultipleServicesMonitoringStrategyTest.java M backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategyTest.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java M frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties M packaging/dbscripts/vds_sp.sql 14 files changed, 160 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/34653/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java index 45b2007..b07096a 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java @@ -936,6 +936,12 @@ EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER(9604, AuditLogSeverity.WARNING, AuditLogTimeInterval.MINUTE.getValue()), + EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER_LEVEL(9609, AuditLogSeverity.WARNING, + AuditLogTimeInterval.MINUTE.getValue()), + + MIXING_RHEL_VERSIONS_IN_CLUSTER(9610, AuditLogSeverity.WARNING, + AuditLogTimeInterval.MINUTE.getValue()), + /** Highly available virtual machine went down. */ HA_VM_FAILED(9602, AuditLogSeverity.ERROR), /** Restart of a highly available virtual machine failed. */ diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java index 609b7c2..c2f1cb1 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java @@ -23,7 +23,9 @@ GLUSTER_HOST_UUID_ALREADY_EXISTS(15), ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER(16), NETWORK_INTERFACE_IS_DOWN(17), - RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER(18); + RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER(18), + EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER_LEVEL(19), + MIXING_RHEL_VERSIONS_IN_CLUSTER(20); private final int value; diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAO.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAO.java index 0098504..12bf647 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAO.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAO.java @@ -209,4 +209,12 @@ * @return the list of VDS instances */ List<VDS> getHostsForStorageOperation(Guid storagePoolId, boolean localFsOnly); + + /** + * Finds the first VDS which is based on RHEL and the status is UP. + * Based on RHEL can be RHEL, CentOS, RHEV-H or ovirt-node + * @param vdsGroupId cluster id + * @return first host or null if there are none such hosts + */ + VDS getFirstUpRhelForVdsGroup(Guid vdsGroupId); } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java index d47b759..b06eb2c 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java @@ -148,6 +148,16 @@ } @Override + public VDS getFirstUpRhelForVdsGroup(Guid vdsGroupId) { + List<VDS> vds = getCallsHandler().executeReadList("getFirstUpRhelForVdsGroupId", + VdsRowMapper.instance, + getCustomMapSqlParameterSource() + .addValue("vds_group_id", vdsGroupId)); + + return vds.size() != 0 ? vds.iterator().next() : null; + } + + @Override public List<VDS> getAllForStoragePool(Guid storagePool) { return getAllForStoragePool(storagePool, null, false); } diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties index 342c92a..6f3cbc2 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -686,6 +686,7 @@ ADD_VM_FROM_SNAPSHOT_INVALID_INTERFACES=While adding vm ${EntityName} from snapshot, the Network/s ${Networks} were found to be Non-VM Networks or do not exist in Cluster. Network Name was not set in the Interface/s ${Interfaces}. VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS=Host ${VdsName} does not comply with the cluster ${VdsGroupName} networks, the following VM networks are non-VM networks: '${Networks}' EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER=Host ${VdsName} does not comply with the cluster ${VdsGroupName} emulated machines. The Hosts emulated machines are ${hostSupportedEmulatedMachines} and the cluster is ${clusterEmulatedMachines}} +MIXING_RHEL_VERSIONS_IN_CLUSTER=It is not possible to mix RHEL 6x with RHEL 7x in one cluster. Host ${VdsName} has version ${addingRhel} while there are hosts with version ${previousRhel}. RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER=Host ${VdsName} does not comply with the cluster ${VdsGroupName} Random Number Generator sources. The Hosts supported sources are: ${hostSupportedRngSources}; and the cluster requirements are: ${clusterRequiredRngSources}. # NUMA Messages NUMA_ADD_VM_NUMA_NODE_SUCCESS=Add VM NUMA node successfully. diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsDAOTest.java index fd1b85b..b7e6530 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsDAOTest.java @@ -20,6 +20,10 @@ private static final Guid EXISTING_VDS_ID = new Guid("afce7a39-8e8c-4819-ba9c-796d316592e7"); private static final Guid EXISTING_VDS_ID_2 = new Guid("afce7a39-8e8c-4819-ba9c-796d316592e6"); + private static final Guid VDS_GROUP_WITH_FEDORA = new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1"); + + private static final Guid VDS_GROUP_WITH_RHELS = new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d2"); + private static final String IP_ADDRESS = "192.168.122.17"; private VdsDAO dao; private VDS existingVds; @@ -463,6 +467,16 @@ assertEquals(FixturesTool.VDS_GROUP_RHEL6_LOCALFS, result.get(0).getVdsGroupId()); } + public void testGetFirstUpRhelForVdsGroupFromClusterWithRhels() { + VDS vds = dao.getFirstUpRhelForVdsGroup(VDS_GROUP_WITH_RHELS); + assertNotNull(vds); + } + + public void testGetFirstUpRhelForVdsGroupFromClusterWithFedoras() { + VDS vds = dao.getFirstUpRhelForVdsGroup(VDS_GROUP_WITH_FEDORA); + assertNull(vds); + } + private void assertGetAllForStoragePoolCorrectResult(List<VDS> result) { assertNotNull(result); assertFalse(result.isEmpty()); diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index 16cf011..0914284 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -3011,7 +3011,7 @@ <value>0</value> <value>2.3</value> <value>2.3</value> - <value>RHEL - 6Server - 6.0.0.37.el6</value> + <value>Fedora - 20 - 3</value> <null /> <null /> <value>2.3</value> diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/MonitoringStrategyFactory.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/MonitoringStrategyFactory.java index 8cdb76b..73a5a8b 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/MonitoringStrategyFactory.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/MonitoringStrategyFactory.java @@ -10,7 +10,7 @@ * This class is responsible for returning the correct service strategy, according to the service the cluster supports */ public class MonitoringStrategyFactory { - private static MonitoringStrategy virtMonitoringStrategy = new VirtMonitoringStrategy(DbFacade.getInstance().getVdsGroupDao()); + private static MonitoringStrategy virtMonitoringStrategy = new VirtMonitoringStrategy(DbFacade.getInstance().getVdsGroupDao(), DbFacade.getInstance().getVdsDao()); private static MonitoringStrategy glusterMonitoringStrategy = new GlusterMonitoringStrategy(); private static MultipleServicesMonitoringStrategy multipleMonitoringStrategy = new MultipleServicesMonitoringStrategy(); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java index 9cf267a..8bb710c 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java @@ -16,6 +16,7 @@ import org.ovirt.engine.core.common.utils.ListUtils; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; +import org.ovirt.engine.core.dao.VdsDAO; import org.ovirt.engine.core.dao.VdsGroupDAO; /** @@ -25,8 +26,11 @@ private final VdsGroupDAO vdsGroupDao; - protected VirtMonitoringStrategy(VdsGroupDAO vdsGroupDao) { + private final VdsDAO vdsDao; + + protected VirtMonitoringStrategy(VdsGroupDAO vdsGroupDao, VdsDAO vdsDao) { this.vdsGroupDao = vdsGroupDao; + this.vdsDao = vdsDao; } @Override @@ -64,6 +68,10 @@ vds.setStatus(VDSStatus.NonOperational); } + if (vds.getStatus() != VDSStatus.NonOperational) { + checkIfNotMixingRhels(vds, vdsGroup); + } + if (!hostCompliesWithRngDeviceSources(vds, vdsGroup) && vds.getStatus() != VDSStatus.NonOperational) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("hostSupportedRngSources", VmRngDevice.sourcesToCsv(vds.getSupportedRngSources())); @@ -74,6 +82,56 @@ } } + /** + * Sets the new host to non-operational if adding a RHEL6 machine to a cluster with RHEL7s or RHEL7 to cluster with RHEL6s + * + * It tries to be as non-invasive as possible and only if the above is the case, turns the host into non-operational. + */ + private void checkIfNotMixingRhels(VDS vds, VDSGroup vdsGroup) { + if (vds.getHostOs() == null) { + return; + } + + String[] hostOsInfo = vds.getHostOs().split("-"); + + if (hostOsInfo.length != 3) { + return; + } + + String newOsName = hostOsInfo[0].trim(); + String newRelease = hostOsInfo[2].trim(); + // both the CentOS and RHEL has osName RHEL + if (newOsName.equals("RHEL") || newOsName.equals("oVirt Node") || newOsName.equals("RHEV Hypervisor")) { + VDS beforeRhel = vdsDao.getFirstUpRhelForVdsGroup(vdsGroup.getId()); + boolean firstHostInCluster = beforeRhel == null; + if (firstHostInCluster) { + // no need to do any checks + return; + } + + // if not first host in cluster, need to check if the version is the same + if (beforeRhel.getHostOs() == null) { + return; + } + + String[] prevOsInfo = beforeRhel.getHostOs().split("-"); + if (prevOsInfo.length != 3) { + return; + } + + String prevRelease = prevOsInfo[2].trim(); + boolean addingRhel6toRhel7 = newRelease.contains("el6") && prevRelease.contains("el7"); + boolean addingRhel7toRhel6 = newRelease.contains("el7") && prevRelease.contains("el6"); + if (addingRhel7toRhel6 || addingRhel6toRhel7) { + Map<String, String> customLogValues = new HashMap<>(); + customLogValues.put("previousRhel", beforeRhel.getHostOs()); + customLogValues.put("addingRhel", vds.getHostOs()); + vdsNonOperational(vds, NonOperationalReason.MIXING_RHEL_VERSIONS_IN_CLUSTER, customLogValues); + vds.setStatus(VDSStatus.NonOperational); + } + } + } + private boolean hostCompliesWithRngDeviceSources(VDS vds, VDSGroup vdsGroup) { return vds.getSupportedRngSources().containsAll(vdsGroup.getRequiredRngSources()); } diff --git a/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/MultipleServicesMonitoringStrategyTest.java b/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/MultipleServicesMonitoringStrategyTest.java index 8421f82..e2a2fa9 100644 --- a/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/MultipleServicesMonitoringStrategyTest.java +++ b/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/MultipleServicesMonitoringStrategyTest.java @@ -16,6 +16,7 @@ import org.ovirt.engine.core.common.businessentities.NonOperationalReason; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSStatus; +import org.ovirt.engine.core.dao.VdsDAO; import org.ovirt.engine.core.dao.VdsGroupDAO; public class MultipleServicesMonitoringStrategyTest { @@ -27,7 +28,7 @@ public ExpectedException exception = ExpectedException.none(); public MultipleServicesMonitoringStrategyTest() { - virtStrategy = spy(new VirtMonitoringStrategy(mock(VdsGroupDAO.class))); + virtStrategy = spy(new VirtMonitoringStrategy(mock(VdsGroupDAO.class), mock(VdsDAO.class))); glusterStrategy = spy(new GlusterMonitoringStrategy()); doNothing().when(virtStrategy).vdsNonOperational(any(VDS.class), any(NonOperationalReason.class), any(Map.class)); strategy = spy(new MultipleServicesMonitoringStrategy()); diff --git a/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategyTest.java b/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategyTest.java index 2beeecf..3367725 100644 --- a/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategyTest.java +++ b/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategyTest.java @@ -6,6 +6,7 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; import java.util.Map; @@ -16,12 +17,15 @@ import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VmRngDevice; import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.dao.VdsDAO; import org.ovirt.engine.core.dao.VdsGroupDAO; public class VirtMonitoringStrategyTest { + private VDS vdsFromDb = new VDS(); + public VirtMonitoringStrategyTest() { - virtStrategy = spy(new VirtMonitoringStrategy(mockVdsGroup())); + virtStrategy = spy(new VirtMonitoringStrategy(mockVdsGroup(), mockVdsDao())); doNothing().when(virtStrategy).vdsNonOperational(any(VDS.class), any(NonOperationalReason.class), any(Map.class)); } @@ -51,10 +55,8 @@ @Test public void testProcessSpecialSoftwareCapabilities() { - VDS vds = new VDS(); - vds.setSupportedEmulatedMachines("pc-1.0"); - vds.getSupportedRngSources().add(VmRngDevice.Source.RANDOM); - vds.setStatus(VDSStatus.Up); + VDS vds = createBaseVds(); + vds.setHostOs("Fedora - 20 - 3"); virtStrategy.processSoftwareCapabilities(vds); assertTrue(vds.getStatus().equals(VDSStatus.Up)); vds.setKvmEnabled(Boolean.TRUE); @@ -70,6 +72,32 @@ vds.getSupportedRngSources().clear(); virtStrategy.processSoftwareCapabilities(vds); assertTrue(vds.getStatus().equals(VDSStatus.NonOperational)); + } + + @Test + public void testProtectRhel7InRhel6() { + VDS vds = createBaseVds(); + vdsFromDb.setHostOs("RHEL - 6Server - 6.5.0.1.el6"); + vds.setHostOs("RHEL - 7Server - 1.el7"); + virtStrategy.processSoftwareCapabilities(vds); + assertTrue(vds.getStatus().equals(VDSStatus.NonOperational)); + } + + @Test + public void testProtectRhel6InRhel7() { + VDS vds = createBaseVds(); + vdsFromDb.setHostOs("RHEL - 7Server - 1.el7"); + vds.setHostOs("RHEL - 6Server - 6.5.0.1.el6"); + virtStrategy.processSoftwareCapabilities(vds); + assertTrue(vds.getStatus().equals(VDSStatus.NonOperational)); + } + + private VDS createBaseVds() { + VDS vds = new VDS(); + vds.setSupportedEmulatedMachines("pc-1.0"); + vds.getSupportedRngSources().add(VmRngDevice.Source.RANDOM); + vds.setStatus(VDSStatus.Up); + return vds; } @Test @@ -101,4 +129,10 @@ org.mockito.Mockito.when(mock.get(any(Guid.class))).thenReturn(value); return mock; } + + private VdsDAO mockVdsDao() { + VdsDAO mock = mock(VdsDAO.class); + when(mock.getFirstUpRhelForVdsGroup(any(Guid.class))).thenReturn(vdsFromDb); + return mock; + } } diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java index 5a68a5c..a948793 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java @@ -38,6 +38,8 @@ String NonOperationalReason___EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER(); + String NonOperationalReason___MIXING_RHEL_VERSIONS_IN_CLUSTER(); + String NonOperationalReason___ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER(); String NonOperationalReason___NETWORK_INTERFACE_IS_DOWN(); diff --git a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties index f63f1d3..19e6151 100644 --- a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties +++ b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties @@ -12,6 +12,7 @@ NonOperationalReason___GLUSTER_HOST_UUID_NOT_FOUND=Could not find Gluster UUID of the server. NonOperationalReason___GLUSTER_HOST_UUID_ALREADY_EXISTS=Gluster UUID already exists. NonOperationalReason___EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER=The Host emulated machine flags doesn't match one of the cluster emulated machines. +NonOperationalReason___MIXING_RHEL_VERSIONS_IN_CLUSTER=Not possible to mix RHEL 6x and 7x hosts in one cluster. NonOperationalReason___RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER=The Host supported Random Number Generator sources doesn't comply with sources required by Cluster. NonOperationalReason___UNTRUSTED=Host is untrusted. NonOperationalReason___UNINITIALIZED=Host is uninitialized as it is not attested yet. diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql index 15f5442..b5a4ac3 100644 --- a/packaging/dbscripts/vds_sp.sql +++ b/packaging/dbscripts/vds_sp.sql @@ -1120,3 +1120,16 @@ RETURN; END; $procedure$ LANGUAGE plpgsql; + + +Create or replace FUNCTION getFirstUpRhelForVdsGroupId(v_vds_group_id UUID) RETURNS SETOF vds STABLE + AS $procedure$ +BEGIN + BEGIN + -- both centos and RHEL return RHEL as host_os + RETURN QUERY select * from vds where (host_os like 'RHEL%' or host_os like 'oVirt Node%' or host_os like 'RHEV Hypervisor%') and status = 3 and vds_group_id = v_vds_group_id LIMIT 1; + END; + + RETURN; +END; $procedure$ +LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/34653 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ieb6d41b1921a6caf946cba44a6c92ef86fef6bc8 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Tomas Jelinek <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
