Eli Mesika has uploaded a new change for review.

Change subject: [WIP] API: Adding monitored commands to ...
......................................................................

[WIP] API: Adding monitored commands to ...

API: Adding monitored commands to capabilities

Change-Id: Iaba15e72fa05cd5508139a5fe80567fd95dc7539
Signed-off-by: Eli Mesika <[email protected]>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=872719
---
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java
2 files changed, 22 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/16168/1

diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
index 54bdf32..733d4b6 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
@@ -613,6 +613,7 @@
           <!-- TODO: (deprecated) remove these elements post 4.0 -->
           <xs:element name="permits" type="Permits" minOccurs="0"/>
           <xs:element name="scheduling_policies" type="SchedulingPolicies" 
minOccurs="0"/>
+          <xs:element name="monitored_commands" type="MonitoredCommands" 
minOccurs="0"/>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>
@@ -626,6 +627,12 @@
     </xs:sequence>
   </xs:complexType>
 
+ <xs:complexType name="MonitoredCommands">
+    <xs:sequence>
+      <xs:element name="command" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
   <xs:element name="features" type="Features"/>
 
   <xs:complexType name="Features">
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java
index e53043a..e448d2e 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java
@@ -40,6 +40,7 @@
 import org.ovirt.engine.api.model.HostStatus;
 import org.ovirt.engine.api.model.IpVersions;
 import org.ovirt.engine.api.model.MigrateOnError;
+import org.ovirt.engine.api.model.MonitoredCommands;
 import org.ovirt.engine.api.model.NetworkStates;
 import org.ovirt.engine.api.model.NetworkStatus;
 import org.ovirt.engine.api.model.NfsVersion;
@@ -103,6 +104,9 @@
 import org.ovirt.engine.core.common.businessentities.ServerCpu;
 import org.ovirt.engine.core.common.businessentities.VmPauseStatus;
 import org.ovirt.engine.core.common.queries.ConfigurationValues;
+import org.ovirt.engine.core.common.queries.VdcQueryParametersBase;
+import org.ovirt.engine.core.common.queries.VdcQueryReturnValue;
+import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.core.compat.NGuid;
 
 public class BackendCapabilitiesResource extends BackendResource implements 
CapabilitiesResource {
@@ -149,7 +153,7 @@
 
         caps.setPermits(getPermits());
         caps.setSchedulingPolicies(getSchedulingPolicies());
-
+        caps.setMonitoredCommands(getMonitoredCommands());
         return  caps;
     }
 
@@ -493,6 +497,16 @@
         return policies;
     }
 
+    private MonitoredCommands getMonitoredCommands() {
+        MonitoredCommands commands = new MonitoredCommands();
+        VdcQueryReturnValue ret = runQuery(VdcQueryType.GetMonitoredCommands, 
new VdcQueryParametersBase());
+        List<String> list = (ArrayList<String>)ret.getReturnValue();
+        for (String command : list) {
+            commands.getCommand().add(command);
+        }
+        return commands;
+    }
+
     private void addMigrateOnErrorOptions(VersionCaps version, 
MigrateOnError[] values) {
         if (VersionUtils.greaterOrEqual(version, VERSION_3_0)) {
             version.setErrorHandling(new 
org.ovirt.engine.api.model.ErrorHandlingOptions());


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaba15e72fa05cd5508139a5fe80567fd95dc7539
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to