Ori Liel has uploaded a new change for review.

Change subject: restapi: 'concurrent' Not Displayed For Primary PM Agent
......................................................................

restapi: 'concurrent' Not Displayed For Primary PM Agent

When there's more than one Power-Management agents, the field
'concurrent' becomes relevant. Prior to this fix, this field
would only exist in the secondary agent. After this fix, this
field will also exist in the first agent

Change-Id: If0882d1db6c13b24c767e0cb40b9b797e8b61860
Bug-Url: http://bugzilla.redhat.com/977674
Signed-off-by: Ori Liel <ol...@redhat.com>
---
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostMapper.java
M 
backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/HostMapperTest.java
2 files changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/21781/1

diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostMapper.java
index ab9080e..fee7a80 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostMapper.java
@@ -486,6 +486,10 @@
             }
             // Set Secondary Agent
             if (!StringUtils.isEmpty(entity.getPmSecondaryIp())) {
+                boolean concurrent = entity.isPmSecondaryConcurrent();
+                // When a second agent exists, 'concurrent' field is relevant 
for both agents, so here we
+                // set it retroactively in the first agent.
+                model.getAgents().getAgents().get(0).setConcurrent(concurrent);
                 agent = new Agent();
                 agent.setType(entity.getPmSecondaryType());
                 agent.setAddress(entity.getPmSecondaryIp());
@@ -494,7 +498,7 @@
                     agent.setOptions(map(entity.getPmSecondaryOptionsMap(), 
null));
                 }
                 agent.setOrder(2);
-                agent.setConcurrent(entity.isPmSecondaryConcurrent());
+                agent.setConcurrent(concurrent);
                 model.getAgents().getAgents().add(agent);
             }
         }
diff --git 
a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/HostMapperTest.java
 
b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/HostMapperTest.java
index 9e3372b..d35bf5c 100644
--- 
a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/HostMapperTest.java
+++ 
b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/HostMapperTest.java
@@ -182,6 +182,7 @@
             assertEquals(agent.getAddress(), ip[i]);
             assertEquals(agent.getType(), "apc");
             assertEquals(agent.getUsername(), "user");
+            assertTrue(agent.isConcurrent());
             assertEquals(agent.getOptions().getOptions().get(0).getName(), 
"secure");
             assertEquals(agent.getOptions().getOptions().get(0).getValue(), 
"true");
             if (i > 0) {


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

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

Reply via email to