Liron Aravot has uploaded a new change for review. Change subject: core: hosts from gluser clusters shouldn't be considered ......................................................................
core: hosts from gluser clusters shouldn't be considered When moving a domain to maintenance or when handling problematic domain, hosts from gluster clusters were considered although we don't use any monitoring from those hosts which prevents hosts from moving to maintenance or from properly handle a problematic domain. This patch fixes it by loading only the hosts from virt service (which we collect domain monitoring information from) instead of loading all the hosts. Change-Id: I2b89785529ec00114065e350138e05d6c966df44 Bug-Url: https://bugzilla.redhat.com/1182616 Signed-off-by: Liron Aravot <lara...@redhat.com> --- M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAO.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java M packaging/dbscripts/vds_sp.sql 4 files changed, 101 insertions(+), 29 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/37328/1 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 e32511f..fdc606b 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 @@ -149,9 +149,9 @@ /** * Retrieves all VDS instances by storage pool ID and status. - * + * NOTE- only hosts from VIRT service supporting cluster are returned * @param storagePool The storage pool's ID - * @param status The status of vds + * @param status The status of vds, null for all statuses * @return the list of VDS instances */ List<VDS> getAllForStoragePoolAndStatus(Guid storagePool, VDSStatus status); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java index 3cd1dd5..9a5ae6d 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsBrokerCommand.java @@ -57,6 +57,9 @@ */ public static void updateVdsDomainsData(VDS vds, Guid storagePoolId, ArrayList<VDSDomainsData> vdsDomainData) { + // NOTE - if this condition is ever updated, every place that acts upon the reporting + // should be updated as well, only hosts the we collect the report from should be affected + // from it. if (vds.getStatus() == reportingVdsStatus && vds.getVdsGroupSupportsVirtService()) { IrsProxyData proxy = _irsProxyData.get(storagePoolId); if (proxy != null) { diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java index 3ddb271..e68118e 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java @@ -202,7 +202,10 @@ private static Set<Guid> getVdsConnectedToPool(Guid storagePoolId) { Set<Guid> vdsNotInMaintenance = new HashSet<>(); - for (VDS vds : DbFacade.getInstance().getVdsDao().getAllForStoragePool(storagePoolId)) { + // Note - this method is used as it returns only hosts from VIRT supported clusters + // (we use the domain monitoring results only from those clusters hosts). + // every change to it should be inspected carefully. + for (VDS vds : DbFacade.getInstance().getVdsDao().getAllForStoragePoolAndStatus(storagePoolId, null)) { if (vds.getStatus() == VDSStatus.Up || vds.getStatus() == VDSStatus.NonResponsive || vds.getStatus() == VDSStatus.PreparingForMaintenance @@ -1512,7 +1515,10 @@ // build a list of all the hosts in status UP in // Pool. List<Guid> vdssInPool = new ArrayList<Guid>(); - List<VDS> allVds = DbFacade.getInstance().getVdsDao().getAllForStoragePool(_storagePoolId); + // Note - this method is used as it returns only hosts from VIRT supported clusters + // (we use the domain monitoring results only from those clusters hosts). + // every change to it should be inspected carefully. + List<VDS> allVds = DbFacade.getInstance().getVdsDao().getAllForStoragePoolAndStatus(_storagePoolId, null); Map<Guid, VDS> vdsMap = new HashMap<Guid, VDS>(); for (VDS tempVDS : allVds) { vdsMap.put(tempVDS.getId(), tempVDS); diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql index 5aaf8ef..a4e4575 100644 --- a/packaging/dbscripts/vds_sp.sql +++ b/packaging/dbscripts/vds_sp.sql @@ -400,6 +400,7 @@ v_free_text_comment text, v_vds_id UUID, v_host_name VARCHAR(255), + v_ip VARCHAR(255) , v_vds_unique_id VARCHAR(128) , v_port INTEGER, v_protocol SMALLINT, @@ -408,8 +409,20 @@ v_server_SSL_enabled BOOLEAN , v_vds_type INTEGER, v_vds_strength INTEGER, + v_pm_type VARCHAR(20) , + v_pm_user VARCHAR(50) , + v_pm_password VARCHAR(50) , + v_pm_port INTEGER , + v_pm_options VARCHAR(4000) , v_pm_enabled BOOLEAN, v_pm_proxy_preferences VARCHAR(255), + v_pm_secondary_ip VARCHAR(255), + v_pm_secondary_type VARCHAR(20), + v_pm_secondary_user VARCHAR(50), + v_pm_secondary_password text, + v_pm_secondary_port INTEGER, + v_pm_secondary_options VARCHAR(4000), + v_pm_secondary_concurrent BOOLEAN, v_pm_detect_kdump BOOLEAN, v_vds_spm_priority INTEGER, v_sshKeyFingerprint VARCHAR(128), @@ -424,12 +437,16 @@ BEGIN IF v_vds_unique_id IS NULL OR NOT EXISTS(SELECT vds_name FROM vds_static WHERE vds_unique_id = v_vds_unique_id) then BEGIN - INSERT INTO vds_static(vds_id,host_name, free_text_comment, vds_unique_id, port, protocol, vds_group_id, vds_name, server_SSL_enabled, - vds_type,vds_strength,pm_enabled, pm_proxy_preferences, pm_detect_kdump, vds_spm_priority, sshKeyFingerprint, console_address, - ssh_port, ssh_username, disable_auto_pm, host_provider_id) - VALUES(v_vds_id,v_host_name, v_free_text_comment, v_vds_unique_id, v_port, v_protocol, v_vds_group_id, v_vds_name, v_server_SSL_enabled, - v_vds_type,v_vds_strength,v_pm_enabled, v_pm_proxy_preferences, v_pm_detect_kdump, v_vds_spm_priority, v_sshKeyFingerprint, - v_console_address, v_ssh_port, v_ssh_username, v_disable_auto_pm, v_host_provider_id); + INSERT INTO vds_static(vds_id,host_name, free_text_comment, ip, vds_unique_id, port, protocol, vds_group_id, vds_name, server_SSL_enabled, + vds_type,vds_strength,pm_type,pm_user,pm_password,pm_port,pm_options,pm_enabled, + pm_proxy_preferences, pm_secondary_ip, pm_secondary_type, pm_secondary_user, + pm_secondary_password, pm_secondary_port, pm_secondary_options, pm_secondary_concurrent, pm_detect_kdump, + vds_spm_priority, sshKeyFingerprint, console_address, ssh_port, ssh_username, disable_auto_pm, host_provider_id) + VALUES(v_vds_id,v_host_name, v_free_text_comment, v_ip, v_vds_unique_id, v_port, v_protocol, v_vds_group_id, v_vds_name, v_server_SSL_enabled, + v_vds_type,v_vds_strength,v_pm_type,v_pm_user,v_pm_password,v_pm_port,v_pm_options,v_pm_enabled, + v_pm_proxy_preferences, v_pm_secondary_ip, v_pm_secondary_type, v_pm_secondary_user, + v_pm_secondary_password, v_pm_secondary_port, v_pm_secondary_options, v_pm_secondary_concurrent, v_pm_detect_kdump, + v_vds_spm_priority, v_sshKeyFingerprint, v_console_address, v_ssh_port, v_ssh_username, v_disable_auto_pm, v_host_provider_id); END; end if; RETURN; @@ -442,6 +459,7 @@ Create or replace FUNCTION UpdateVdsStatic(v_host_name VARCHAR(255), v_free_text_comment text, + v_ip VARCHAR(255) , v_vds_unique_id VARCHAR(128), v_port INTEGER, v_protocol SMALLINT, @@ -451,8 +469,20 @@ v_server_SSL_enabled BOOLEAN , v_vds_type INTEGER, v_vds_strength INTEGER, + v_pm_type VARCHAR(20) , + v_pm_user VARCHAR(50) , + v_pm_password VARCHAR(50) , + v_pm_port INTEGER , + v_pm_options VARCHAR(4000) , v_pm_enabled BOOLEAN, v_pm_proxy_preferences VARCHAR(255), + v_pm_secondary_ip VARCHAR(255), + v_pm_secondary_type VARCHAR(20), + v_pm_secondary_user VARCHAR(50), + v_pm_secondary_password text, + v_pm_secondary_port INTEGER, + v_pm_secondary_options VARCHAR(4000), + v_pm_secondary_concurrent BOOLEAN, v_pm_detect_kdump BOOLEAN, v_otp_validity BIGINT, v_vds_spm_priority INTEGER, @@ -470,10 +500,16 @@ BEGIN UPDATE vds_static - SET host_name = v_host_name, free_text_comment = v_free_text_comment,vds_unique_id = v_vds_unique_id, + SET host_name = v_host_name, free_text_comment = v_free_text_comment, ip = v_ip,vds_unique_id = v_vds_unique_id, port = v_port, protocol = v_protocol, vds_group_id = v_vds_group_id,vds_name = v_vds_name,server_SSL_enabled = v_server_SSL_enabled, - vds_type = v_vds_type, _update_date = LOCALTIMESTAMP,vds_strength = v_vds_strength, - pm_enabled = v_pm_enabled, pm_proxy_preferences = v_pm_proxy_preferences, pm_detect_kdump = v_pm_detect_kdump, + vds_type = v_vds_type, + _update_date = LOCALTIMESTAMP,vds_strength = v_vds_strength, + pm_type = v_pm_type,pm_user = v_pm_user,pm_password = v_pm_password, + pm_port = v_pm_port,pm_options = v_pm_options,pm_enabled = v_pm_enabled, pm_proxy_preferences = v_pm_proxy_preferences, + pm_secondary_ip = v_pm_secondary_ip, pm_secondary_type = v_pm_secondary_type, + pm_secondary_user = v_pm_secondary_user, pm_secondary_password = v_pm_secondary_password, + pm_secondary_port = v_pm_secondary_port, pm_secondary_options = v_pm_secondary_options, + pm_secondary_concurrent = v_pm_secondary_concurrent, pm_detect_kdump = v_pm_detect_kdump, otp_validity = v_otp_validity, vds_spm_priority = v_vds_spm_priority, sshKeyFingerprint = v_sshKeyFingerprint, host_provider_id = v_host_provider_id, console_address = v_console_address, ssh_port = v_ssh_port, ssh_username = v_ssh_username, disable_auto_pm = v_disable_auto_pm WHERE vds_id = v_vds_id; @@ -526,18 +562,20 @@ -Create or replace FUNCTION GetVdsStaticByIp(v_ip VARCHAR(40)) RETURNS SETOF vds_static STABLE + +Create or replace FUNCTION GetVdsStaticByVdsId(v_vds_id UUID) RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_static.* - FROM vds_static vds_static, fence_agents fence_agents - WHERE fence_agents.ip = v_ip AND fence_agents.vds_id = vds_static.vds_id; + FROM vds_static + WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; + Create or replace FUNCTION GetVdsStaticByHostName(v_host_name VARCHAR(255)) RETURNS SETOF vds_static STABLE @@ -551,18 +589,6 @@ END; $procedure$ LANGUAGE plpgsql; -Create or replace FUNCTION GetVdsStaticByVdsId(v_vds_id UUID) RETURNS SETOF vds_static STABLE - AS $procedure$ -BEGIN -RETURN QUERY SELECT vds_static.* - FROM vds_static - WHERE vds_id = v_vds_id; - - RETURN; -END; $procedure$ -LANGUAGE plpgsql; - - Create or replace FUNCTION GetVdsStaticByVdsName(v_host_name VARCHAR(255)) RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN @@ -573,6 +599,26 @@ RETURN; END; $procedure$ LANGUAGE plpgsql; + + + + +Create or replace FUNCTION GetVdsStaticByIp(v_ip VARCHAR(40)) RETURNS SETOF vds_static STABLE + AS $procedure$ +BEGIN +BEGIN + RETURN QUERY SELECT vds_static.* + FROM vds_static + WHERE ip = v_ip; + END; + + RETURN; +END; $procedure$ +LANGUAGE plpgsql; + + + + Create or replace FUNCTION GetVdsByUniqueID(v_vds_unique_id VARCHAR(128)) RETURNS SETOF vds STABLE AS $procedure$ @@ -774,6 +820,23 @@ +Create or replace FUNCTION GetVdsByIp(v_ip VARCHAR(40)) RETURNS SETOF vds STABLE + AS $procedure$ +BEGIN +BEGIN + RETURN QUERY SELECT DISTINCT vds.* + FROM vds + WHERE ip = v_ip; + END; + + RETURN; +END; $procedure$ +LANGUAGE plpgsql; + + + + + Create or replace FUNCTION GetVdsByVdsGroupId(v_vds_group_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vds STABLE AS $procedure$ BEGIN @@ -835,7 +898,7 @@ RETURN QUERY SELECT vds.* FROM vds INNER JOIN vds_groups vdsgroup ON vds.vds_group_id = vdsgroup.vds_group_id - WHERE (vds.status = v_status) AND (vds.storage_pool_id = v_storage_pool_id) + WHERE (v_status IS NULL OR vds.status = v_status) AND (vds.storage_pool_id = v_storage_pool_id) AND vdsgroup.virt_service = true; END; RETURN; -- To view, visit http://gerrit.ovirt.org/37328 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2b89785529ec00114065e350138e05d6c966df44 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Aravot <lara...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches