Eli Mesika has uploaded a new change for review.

Change subject: [WIP] core:[RFE]Improve power management proxy ...
......................................................................

[WIP] core:[RFE]Improve power management proxy ...

This patch implements the following RFE
http://wiki.ovirt.org/Features/Design/DetailedHostPMProxyPreferences

In general, adding support for proxy preferences per Host.
Each Host can define how to look for a proxy when the Host should be
fenced.
The default behaviour is to search first in cluster then in the
data-center. This default is available from the engine-config

Change-Id: Id308bc4136a3cc41f622237b05e49b00f11d9bb8
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M backend/manager/dbscripts/create_views.sql
A backend/manager/dbscripts/upgrade/03_02_0010_add_pm_proxy_preferences.sql
M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
M backend/manager/dbscripts/vds_sp.sql
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FencingExecutor.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M 
backend/manager/tools/engine-config/src/main/resources/engine-config.properties
13 files changed, 179 insertions(+), 74 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/9673/1

diff --git a/backend/manager/dbscripts/create_views.sql 
b/backend/manager/dbscripts/create_views.sql
index fd30dae..c43da27 100644
--- a/backend/manager/dbscripts/create_views.sql
+++ b/backend/manager/dbscripts/create_views.sql
@@ -620,7 +620,7 @@
                       vds_groups.selection_algorithm as selection_algorithm, 
vds_static.vds_id as vds_id, vds_static.vds_name as vds_name, vds_static.ip as 
ip, vds_static.vds_unique_id as vds_unique_id,
                       vds_static.host_name as host_name, vds_static.port as 
port, vds_static.vds_strength as vds_strength, vds_static.server_SSL_enabled as 
server_SSL_enabled, vds_static.vds_type as vds_type,
                       vds_static.pm_type as pm_type, vds_static.pm_user as 
pm_user, vds_static.pm_password as pm_password, vds_static.pm_port as pm_port,
-                      vds_static.pm_options as pm_options, 
vds_static.pm_enabled as pm_enabled, vds_static.vds_spm_priority as 
vds_spm_priority, vds_dynamic.hooks as hooks,vds_dynamic.status as status, 
vds_dynamic.cpu_cores as cpu_cores, vds_dynamic.cpu_model as cpu_model,
+                      vds_static.pm_options as pm_options, 
vds_static.pm_enabled as pm_enabled, vds_static.pm_proxy_preferences as 
pm_proxy_preferences, vds_static.vds_spm_priority as vds_spm_priority, 
vds_dynamic.hooks as hooks,vds_dynamic.status as status, vds_dynamic.cpu_cores 
as cpu_cores, vds_dynamic.cpu_model as cpu_model,
                       vds_dynamic.cpu_speed_mh as cpu_speed_mh, 
vds_dynamic.if_total_speed as if_total_speed, vds_dynamic.kvm_enabled as 
kvm_enabled, vds_dynamic.physical_mem_mb as physical_mem_mb,
                       vds_dynamic.pending_vcpus_count as pending_vcpus_count, 
vds_dynamic.pending_vmem_size as pending_vmem_size,vds_dynamic.mem_commited as 
mem_commited, vds_dynamic.vm_active as vm_active, vds_dynamic.vm_count as 
vm_count,
                       vds_dynamic.vm_migrating as vm_migrating, 
vds_dynamic.vms_cores_count as vms_cores_count, 
vds_dynamic.cpu_over_commit_time_stamp as cpu_over_commit_time_stamp,
@@ -652,7 +652,7 @@
                       vds_groups.selection_algorithm, vds_static.vds_id, 
vds_static.vds_name, vds_static.ip, vds_static.vds_unique_id,
                       vds_static.host_name, vds_static.port, 
vds_static.vds_strength, vds_static.server_SSL_enabled, vds_static.vds_type,
                       vds_static.pm_type, vds_static.pm_user, 
vds_static.pm_password, vds_static.pm_port,
-                      vds_static.pm_options, vds_static.pm_enabled, 
vds_dynamic.hooks, vds_dynamic.status, vds_dynamic.cpu_cores,
+                      vds_static.pm_options, vds_static.pm_enabled, 
vds_static.pm_proxy_preferences as pm_proxy_preferences, vds_dynamic.hooks, 
vds_dynamic.status, vds_dynamic.cpu_cores,
                       vds_dynamic.cpu_model, vds_dynamic.cpu_speed_mh, 
vds_dynamic.if_total_speed, vds_dynamic.kvm_enabled,
                       vds_dynamic.physical_mem_mb, 
vds_dynamic.pending_vcpus_count, vds_dynamic.pending_vmem_size,
                       vds_dynamic.mem_commited, vds_dynamic.vm_active, 
vds_dynamic.vm_count, vds_dynamic.vm_migrating,
diff --git 
a/backend/manager/dbscripts/upgrade/03_02_0010_add_pm_proxy_preferences.sql 
b/backend/manager/dbscripts/upgrade/03_02_0010_add_pm_proxy_preferences.sql
new file mode 100644
index 0000000..73a7800
--- /dev/null
+++ b/backend/manager/dbscripts/upgrade/03_02_0010_add_pm_proxy_preferences.sql
@@ -0,0 +1,2 @@
+select fn_db_add_column('vds_static', 'pm_proxy_preferences', 'varchar(255) 
default ''''');
+
diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 6d84a82..62ddbb7 100644
--- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -125,6 +125,7 @@
 select fn_db_add_config_value('FailedJobCleanupTimeInMinutes','60','general');
 select 
fn_db_add_config_value('FenceAgentDefaultParams','ilo3:lanplus,timeout=4','general');
 select fn_db_add_config_value('FenceAgentMapping','ilo3=ipmilan','general');
+select 
fn_db_add_config_value('FenceProxyDefaultPreferences','cluster,dc','general');
 select 
fn_db_add_config_value('FenceQuietTimeBetweenOperationsInSec','180','general');
 select 
fn_db_add_config_value('FenceStartStatusDelayBetweenRetriesInSec','60','general');
 select fn_db_add_config_value('FenceStartStatusRetries','3','general');
diff --git a/backend/manager/dbscripts/vds_sp.sql 
b/backend/manager/dbscripts/vds_sp.sql
index 92e7ff6..8409a6c 100644
--- a/backend/manager/dbscripts/vds_sp.sql
+++ b/backend/manager/dbscripts/vds_sp.sql
@@ -332,6 +332,7 @@
     v_pm_port INTEGER ,
     v_pm_options VARCHAR(4000) ,
     v_pm_enabled BOOLEAN,
+    v_pm_proxy_preferences VARCHAR(255),
     v_vds_spm_priority INTEGER,
     v_sshKeyFingerprint VARCHAR(128))
 RETURNS VOID
@@ -339,8 +340,8 @@
 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, ip, vds_unique_id, port, 
vds_group_id, vds_name, 
server_SSL_enabled,vds_type,vds_strength,pm_type,pm_user,pm_password,pm_port,pm_options,pm_enabled,
 vds_spm_priority, sshKeyFingerprint)
-                       VALUES(v_vds_id,v_host_name, v_ip, v_vds_unique_id, 
v_port, 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_vds_spm_priority, v_sshKeyFingerprint);
+         INSERT INTO vds_static(vds_id,host_name, ip, vds_unique_id, port, 
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, vds_spm_priority, sshKeyFingerprint)
+                       VALUES(v_vds_id,v_host_name, v_ip, v_vds_unique_id, 
v_port, 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_vds_spm_priority, v_sshKeyFingerprint);
       END;
    end if;
    RETURN;
@@ -367,6 +368,7 @@
     v_pm_port INTEGER ,
     v_pm_options VARCHAR(4000) ,
     v_pm_enabled BOOLEAN,
+    v_pm_proxy_preferences VARCHAR(255),
     v_otp_validity BIGINT,
     v_vds_spm_priority INTEGER,
     v_sshKeyFingerprint VARCHAR(128))
@@ -383,7 +385,7 @@
       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, 
otp_validity = v_otp_validity, vds_spm_priority = v_vds_spm_priority, 
sshKeyFingerprint = v_sshKeyFingerprint
+      pm_port = v_pm_port,pm_options = v_pm_options,pm_enabled = v_pm_enabled, 
pm_proxy_preferences = v_pm_proxy_preferences, otp_validity = v_otp_validity, 
vds_spm_priority = v_vds_spm_priority, sshKeyFingerprint = v_sshKeyFingerprint
       WHERE vds_id = v_vds_id;
    END;
 
@@ -653,14 +655,15 @@
  v_pm_port INTEGER ,
     v_pm_options VARCHAR(4000) ,
     v_pm_enabled BOOLEAN,
+    v_pm_proxy_preferences VARCHAR(255),
     v_vds_spm_priority INTEGER)
 RETURNS VOID
    AS $procedure$
 BEGIN
 
    BEGIN
-      INSERT INTO vds_static(vds_id,host_name, ip, vds_unique_id, port, 
vds_group_id, vds_name, 
server_SSL_enabled,vds_type,vds_strength,pm_type,pm_user,pm_password, pm_port, 
pm_options, pm_enabled, vds_spm_priority)
-       VALUES(v_vds_id,v_host_name, v_ip, v_vds_unique_id, v_port, 
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_vds_spm_priority);
+      INSERT INTO vds_static(vds_id,host_name, ip, vds_unique_id, port, 
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, vds_spm_priority)
+       VALUES(v_vds_id,v_host_name, v_ip, v_vds_unique_id, v_port, 
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_vds_spm_priority);
 
       INSERT INTO vds_dynamic(vds_id, status) VALUES(v_vds_id, 0);
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FencingExecutor.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FencingExecutor.java
index 487dcda..c06067c 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FencingExecutor.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FencingExecutor.java
@@ -27,8 +27,8 @@
 public class FencingExecutor {
     private final VDS _vds;
     private FenceActionType _action = FenceActionType.forValue(0);
-    private Guid _vdsToRunId;
-    private String _vdsToRunName;
+    private Guid proxyHostId;
+    private String proxyHostName;
 
     public FencingExecutor(VDS vds, FenceActionType actionType) {
         _vds = vds;
@@ -36,84 +36,89 @@
     }
 
     public boolean FindVdsToFence() {
+        PMProxyOptions proxyOption=null;
         final Guid NO_VDS = Guid.Empty;
         int count = 0;
         // make sure that loop is executed at least once , no matter what is 
the
         // value in config
         int retries = Math.max(Config.<Integer> 
GetValue(ConfigValues.FindFenceProxyRetries), 1);
         int delayInMs = 1000 * Config.<Integer> 
GetValue(ConfigValues.FindFenceProxyDelayBetweenRetriesInSec);
-        _vdsToRunId = NO_VDS;
-        VDS vdsToRun = null;
-        List<VDS> hosts = DbFacade.getInstance().getVdsDao().getAll();
-        // check if this is a new host, no need to retry , only status is
-        // available on new host.
-        if (_vds.getId().equals(NO_VDS)) {
-            // try first to find a Host in UP status
-            vdsToRun = LinqUtils.firstOrNull(hosts, new Predicate<VDS>() {
-                @Override
-                public boolean eval(VDS vds) {
-                    return vds.getstatus() == VDSStatus.Up
-                            && 
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id());
-                }
-            });
-            // trying other Hosts that are not in UP since they can be a proxy 
for fencing operations
-            if (vdsToRun == null) {
-                vdsToRun = LinqUtils.firstOrNull(hosts, new Predicate<VDS>() {
-                    @Override
-                    public boolean eval(VDS vds) {
-                        return !isHostNetworkUnreacable(vds) &&
-                                
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id());
-                    }
-                });
+        proxyHostId = NO_VDS;
+        VDS proxyHost = null;
+        boolean proxyFound = false;
+        // get PM Proxy preferences or use defaults if not defined
+        String pmProxyPreferences = 
(_vds.getPmProxyPreferences().trim().length() == 0)
+                ?
+                Config.<String> 
GetValue(ConfigValues.FenceProxyDefaultPreferences)
+                : _vds.getPmProxyPreferences();
+        String[] pmProxyOPtions = pmProxyPreferences.split(",");
+        for (String pmProxyOption : pmProxyOPtions) {
+            if (pmProxyOption.equalsIgnoreCase(PMProxyOptions.CLUSTER.name())) 
{
+                proxyOption = PMProxyOptions.CLUSTER;
             }
-            if (vdsToRun != null) {
-                _vdsToRunId = vdsToRun.getId();
-                _vdsToRunName = vdsToRun.getvds_name();
+            else if (pmProxyOption.equalsIgnoreCase(PMProxyOptions.DC.name())) 
{
+                proxyOption = PMProxyOptions.DC;
             }
-        } else {
-            // If can not find a proxy host retry and delay between retries
-            // as configured.
-            while (count < retries) {
-
-                vdsToRun = LinqUtils.firstOrNull(hosts, new Predicate<VDS>() {
-                    @Override
-                    public boolean eval(VDS vds) {
-                        return !vds.getId().equals(_vds.getId())
-                                && 
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id())
-                                && vds.getstatus() == VDSStatus.Up;
+            else {
+                log.errorFormat("Illegal value in PM Proxy Preferences string 
{0}, skipped.", pmProxyOption);
+                continue;
+            }
+            // check if this is a new host, no need to retry , only status is
+            // available on new host.
+            if (_vds.getId().equals(NO_VDS)) {
+                // try first to find a Host in UP status
+                proxyHost = getFenceProxy(true, false, proxyOption);
+                // trying other Hosts that are not in UP since they can be a 
proxy for fencing operations
+                if (proxyHost == null) {
+                    proxyHost = getFenceProxy(false, false, proxyOption);
+                }
+                if (proxyHost != null) {
+                    proxyHostId = proxyHost.getId();
+                    proxyHostName = proxyHost.getvds_name();
+                    proxyFound=true;
+                }
+            } else {
+                // If can not find a proxy host retry and delay between retries
+                // as configured.
+                while (count < retries) {
+                    proxyHost = getFenceProxy(true, true, proxyOption);
+                    if (proxyHost == null) {
+                        proxyHost = getFenceProxy(false, true, proxyOption);
                     }
-                });
-                if (vdsToRun == null) {
-                    vdsToRun = LinqUtils.firstOrNull(hosts, new 
Predicate<VDS>() {
-                        @Override
-                        public boolean eval(VDS vds) {
-                            return !isHostNetworkUnreacable(vds) &&
-                                    !vds.getId().equals(_vds.getId()) && 
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id());
-                        }
-                    });
+                    if (proxyHost != null) {
+                        proxyHostId = proxyHost.getId();
+                        proxyHostName = proxyHost.getvds_name();
+                        proxyFound=true;
+                        break;
+                    }
+                    // do not retry getting proxy for Status operation.
+                    if (_action == FenceActionType.Status)
+                        break;
+                    log.infoFormat("Atempt {0} to find fencing proxy host 
failed...", ++count);
+                    try {
+                        Thread.sleep(delayInMs);
+                    } catch (Exception e) {
+                        log.error(e.getMessage());
+                        break;
+                    }
                 }
-                if (vdsToRun != null) {
-                    _vdsToRunId = vdsToRun.getId();
-                    _vdsToRunName = vdsToRun.getvds_name();
-                    break;
-                }
-                // do not retry getting proxy for Status operation.
-                if (_action == FenceActionType.Status)
-                    break;
-                log.infoFormat("Atempt {0} to find fencing proxy host 
failed...", ++count);
-                try {
-                    Thread.sleep(delayInMs);
-                } catch (Exception e) {
-                    log.error(e.getMessage());
-                    break;
-                }
+            }
+            if (proxyFound) {
+                break;
             }
         }
-        if (NO_VDS.equals(_vdsToRunId)) {
+        if (NO_VDS.equals(proxyHostId)) {
             log.errorFormat("Failed to run Power Management command on Host 
{0}, no running proxy Host was found.",
                     _vds.getvds_name());
         }
-        return !NO_VDS.equals(_vdsToRunId);
+        else {
+            log.infoFormat("Using Host{0} from {1} as proxy to {2} Host {3}" ,
+                    proxyHost.getvds_name(),
+                    proxyOption.name(),
+                    _action.name(),
+                    _vds.getvds_name());
+        }
+        return !NO_VDS.equals(proxyHostId);
     }
 
     public VDSReturnValue Fence() {
@@ -165,14 +170,14 @@
         String agent = VdsFencingOptions.getRealAgent(_vds.getpm_type());
         String managementOptions = 
VdsFencingOptions.getDefaultAgentOptions(_vds.getpm_type(),_vds.getpm_options());
         log.infoFormat("Executing <{0}> Power Management command, Proxy 
Host:{1}, "
-                + "Agent:{2}, Target Host:{3}, Management IP:{4}, User:{5}, 
Options:{6}", actionType, _vdsToRunName,
+                + "Agent:{2}, Target Host:{3}, Management IP:{4}, User:{5}, 
Options:{6}", actionType, proxyHostName,
                 agent, _vds.getvds_name(), _vds.getManagmentIp(), 
_vds.getpm_user(), managementOptions);
         return Backend
                     .getInstance()
                     .getResourceManager()
                     .RunVdsCommand(
                             VDSCommandType.FenceVds,
-                        new FenceVdsVDSCommandParameters(_vdsToRunId, 
_vds.getId(), _vds.getManagmentIp(),
+                        new FenceVdsVDSCommandParameters(proxyHostId, 
_vds.getId(), _vds.getManagmentIp(),
                                     managementPort, agent, _vds.getpm_user(), 
_vds.getpm_password(),
                                     managementOptions, actionType));
     }
@@ -183,5 +188,65 @@
             vdsDynamic.getNonOperationalReason() == 
NonOperationalReason.NETWORK_UNREACHABLE);
     }
 
+    private VDS getFenceProxy(final boolean onlyUpHost, final boolean 
filterSelf, final PMProxyOptions proxyOptions) {
+        List<VDS> hosts = DbFacade.getInstance().getVdsDao().getAll();
+        VDS proxyHost = LinqUtils.firstOrNull(hosts, new Predicate<VDS>() {
+            @Override
+            public boolean eval(VDS vds) {
+                boolean result=false;
+                if (proxyOptions == PMProxyOptions.CLUSTER) {
+                    if (onlyUpHost) {
+                        if (filterSelf) {
+                            result= !vds.getId().equals(_vds.getId())
+                                    && 
vds.getvds_group_id().equals(_vds.getvds_group_id())
+                                    && vds.getstatus() == VDSStatus.Up;
+                        }
+                        else {
+                            result= vds.getstatus() == VDSStatus.Up
+                                    && 
vds.getvds_group_id().equals(_vds.getvds_group_id());
+                        }
+                    }
+                    else {
+                        if (filterSelf) {
+                            result= !isHostNetworkUnreacable(vds) &&
+                                    !vds.getId().equals(_vds.getId()) && 
vds.getvds_group_id().equals(_vds.getvds_group_id());
+                        }
+                        else {
+                            result= !isHostNetworkUnreacable(vds) &&
+                                    
vds.getvds_group_id().equals(_vds.getvds_group_id());
+
+                        }
+                    }
+                }
+                else if (proxyOptions == PMProxyOptions.DC) {
+                    if (onlyUpHost) {
+                        if (filterSelf) {
+                            result= !vds.getId().equals(_vds.getId())
+                                    && 
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id())
+                                    && vds.getstatus() == VDSStatus.Up;
+                        }
+                        else {
+                            result= vds.getstatus() == VDSStatus.Up
+                                    && 
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id());
+                        }
+                    }
+                    else {
+                        if (filterSelf) {
+                            result= !isHostNetworkUnreacable(vds) &&
+                                    !vds.getId().equals(_vds.getId()) && 
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id());
+                        }
+                        else {
+                            result= !isHostNetworkUnreacable(vds) &&
+                                    
vds.getstorage_pool_id().equals(_vds.getstorage_pool_id());
+
+                        }
+                    }
+                }
+                return result;
+            }
+        });
+        return proxyHost;
+    }
     private static Log log = LogFactory.getLog(FencingExecutor.class);
+    private enum PMProxyOptions {CLUSTER,DC;};
 }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
index e202e5d..f44db18 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java
@@ -48,6 +48,7 @@
         mUpdateVdsStatic.AddPermittedField("pm_port");
         mUpdateVdsStatic.AddPermittedField("pm_options");
         mUpdateVdsStatic.AddPermittedField("pm_enabled");
+        mUpdateVdsStatic.AddPermittedField("pmProxyPreferences");
         mUpdateVdsStatic.AddPermittedField("PmOptionsMap");
         mUpdateVdsStatic.AddPermittedField("vdsSpmPriority");
         mUpdateVdsStatic.AddPermittedField("otpValidity");
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
index 9c5e281..0af7ddd 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
@@ -930,6 +930,14 @@
         mVdsStatic.setpm_enabled(value);
     }
 
+    public String getPmProxyPreferences() {
+        return mVdsStatic.getPmProxyPreferences();
+    }
+
+    public void setPmProxyPreferences(String pmProxyPreferences) {
+        mVdsStatic.setPmProxyPreferences(pmProxyPreferences);
+    }
+
     public String gethost_os() {
         return this.mVdsDynamic.gethost_os();
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
index ba8902b..fa09d5a 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java
@@ -118,6 +118,9 @@
     @Column(name = "pm_enabled")
     private boolean pmEnabled;
 
+    @Column(name = "pm_proxy_preferences")
+    private String pmProxyPreferences;
+
     @Transient
     private ValueObjectMap pmOptionsMap;
 
@@ -309,6 +312,14 @@
         pmEnabled = value;
     }
 
+    public String getPmProxyPreferences() {
+        return pmProxyPreferences;
+    }
+
+    public void setPmProxyPreferences(String pmProxyPreferences) {
+        this.pmProxyPreferences = pmProxyPreferences;
+    }
+
     public long getOtpValidity() {
         return otpValidity;
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index 99bcb813..03a27ce 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -114,6 +114,10 @@
     FenceQuietTimeBetweenOperationsInSec(30),
     @Reloadable
     @TypeConverterAttribute(String.class)
+    @DefaultValueAttribute("cluster,dc")
+    FenceProxyDefaultPreferences(31),
+    @Reloadable
+    @TypeConverterAttribute(String.class)
     @DefaultValueAttribute("/data/updates/ovirt-node-image.iso")
     oVirtUploadPath(32),
     @Reloadable
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 06cf9ad..184f4ba 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
@@ -282,6 +282,7 @@
             entity.setpm_port((Integer) rs.getObject("pm_port"));
             entity.setpm_options(rs.getString("pm_options"));
             entity.setpm_enabled(rs.getBoolean("pm_enabled"));
+            entity.setPmProxyPreferences(rs.getString("pm_proxy_preferences"));
             entity.setspm_status(VdsSpmStatus.forValue(rs
                     .getInt("spm_status")));
             entity.setswap_free(rs.getLong("swap_free"));
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
index 822e097..6de4ef4 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java
@@ -92,6 +92,7 @@
                 .addValue("pm_port", vds.getpm_port())
                 .addValue("pm_options", vds.getpm_options())
                 .addValue("pm_enabled", vds.getpm_enabled())
+                .addValue("pm_proxy_preferences", vds.getPmProxyPreferences())
                 .addValue("otp_validity", vds.getOtpValidity())
                 .addValue("vds_spm_priority", vds.getVdsSpmPriority())
                 .addValue("sshKeyFingerprint", vds.getSSHKeyFingerprint());
@@ -134,6 +135,7 @@
             entity.setpm_port((Integer) rs.getObject("pm_port"));
             entity.setpm_options(rs.getString("pm_options"));
             entity.setpm_enabled(rs.getBoolean("pm_enabled"));
+            entity.setPmProxyPreferences(rs.getString("pm_proxy_preferences"));
             entity.setOtpValidity(rs.getLong("otp_validity"));
             entity.setSSHKeyFingerprint(rs.getString("sshKeyFingerprint"));
 
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 37c3347..bf9194d 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -757,6 +757,7 @@
         <column>pm_port</column>
         <column>pm_options</column>
         <column>pm_enabled</column>
+        <column>pm_proxy_preferences</column>
         <column>_create_date</column>
         <column>_update_date</column>
         <column>vds_spm_priority</column>
@@ -778,6 +779,7 @@
             <null />
             <value></value>
             <value>0</value>
+            <value>cluster,dc</value>
             <value>2010-11-17 17:25:39</value>
             <value>2010-12-01 09:52:57</value>
             <value>8</value>
@@ -800,6 +802,7 @@
             <null />
             <value></value>
             <value>0</value>
+            <value>cluster,dc</value>
             <value>2010-11-17 17:25:39</value>
             <value>2010-12-01 09:52:57</value>
             <value>6</value>
@@ -822,6 +825,7 @@
             <null />
             <value></value>
             <value>0</value>
+            <value>cluster,dc</value>
             <value>2010-11-17 17:25:39</value>
             <value>2010-12-01 09:52:57</value>
             <value>4</value>
@@ -843,6 +847,7 @@
             <null />
             <value></value>
             <value>0</value>
+            <value>cluster,dc</value>
             <value>2010-11-17 17:25:39</value>
             <value>2010-12-01 09:52:57</value>
             <value>4</value>
diff --git 
a/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
 
b/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
index ce3e380..4d7d69c 100644
--- 
a/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
+++ 
b/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
@@ -181,6 +181,8 @@
 FenceQuietTimeBetweenOperationsInSec.type=Integer
 FenceQuietTimeBetweenOperationsInSec.validValues=60..600
 FenceQuietTimeBetweenOperationsInSec.alternateKey=Fence_Quiet_Time
+FenceProxyDefaultPreferences.description="Fence proxy default preferences used 
to define how to search for a proxy Host in Fence operations."
+FenceProxyDefaultPreferences.type=String
 MaxAuditLogMessageLength.type=Integer
 MaxAuditLogMessageLength.alternateKey=Audit_Max_Msg
 MaxAuditLogMessageLength.description="Maximum length of an Audit Log message."


--
To view, visit http://gerrit.ovirt.org/9673
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id308bc4136a3cc41f622237b05e49b00f11d9bb8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to