Tomas Jelinek has uploaded a new change for review.

Change subject: restapi: added spice_proxy property to vmpool and cluster
......................................................................

restapi: added spice_proxy property to vmpool and cluster

This is a SPICE only setting (thus the name spice_proxy). Originally it was
only possible to set the SPICE proxy up in system level (SpiceProxyDefault from
vdc_options). This adds the way to override it on cluster or vmpool level.

Change-Id: I3ba32d8bdc9fc790dc9ca4853a01a1d9f2d08661
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=974076
Signed-off-by: Tomas Jelinek <[email protected]>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmPoolMapper.java
M 
backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/ClusterMapperTest.java
M 
backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmPoolMapperTest.java
6 files changed, 20 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/21631/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 365e36f..5c36b38 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
@@ -1256,6 +1256,7 @@
           <xs:element name="tunnel_migration" type="xs:boolean" minOccurs="0" 
maxOccurs="1"/>
           <xs:element name="trusted_service" type="xs:boolean" minOccurs="0" 
maxOccurs="1"/>
           <xs:element name="ballooning_enabled" type="xs:boolean" 
minOccurs="0" maxOccurs="1"/>
+          <xs:element name="spice_proxy" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
           <!-- Also a rel="networks" link -->
         </xs:sequence>
       </xs:extension>
@@ -2665,6 +2666,7 @@
           <xs:element ref="template" minOccurs="0" maxOccurs="1"/>
           <xs:element name="prestarted_vms" type="xs:int" minOccurs="0"/>
           <xs:element name="max_user_vms" type="xs:int" minOccurs="0"/>
+          <xs:element name="spice_proxy" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
index 3b953b1..06c883e 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
@@ -1420,7 +1420,8 @@
         optionalArguments: {cluster.name: 'xs:string', cluster.description: 
'xs:string', cluster.comment: 'xs:string', cluster.data_center.id: 'xs:string', 
cluster.cpu.id: 'xs:string', cluster.version.major: 'xs:int', 
cluster.version.minor: 'xs:int',
         cluster.memory_policy.overcommit.percent: 'xs:double', 
cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean', 
cluster.scheduling_policy.policy: 'xs:string',
         cluster.scheduling_policy.thresholds.low: 'xs:int', 
cluster.scheduling_policy.thresholds.high: 'xs:int', 
cluster.scheduling_policy.thresholds.duration: 'xs:int',
-        cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 
'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 
'xs:boolean', cluster.tunnel_migration: 'xs:boolean', 
cluster.ballooning_enabled: 'xs:boolean'}
+        cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 
'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 
'xs:boolean', cluster.tunnel_migration: 'xs:boolean', 
cluster.ballooning_enabled: 'xs:boolean'
+        cluster.spice_proxy: 'xs:string'}
         description: update the specified cluster in the system. The 
capabilities like virt servicem luster service, tarnsparent huge pages etc can 
be changed.
     urlparams: {}
     headers:
@@ -1436,7 +1437,7 @@
         optionalArguments: {cluster.description: 'xs:string', cluster.comment: 
'xs:string', cluster.memory_policy.overcommit.percent: 'xs:double', 
cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean',
         cluster.scheduling_policy.policy: 'xs:string', 
cluster.scheduling_policy.thresholds.low: 'xs:int', 
cluster.scheduling_policy.thresholds.high: 'xs:int',
         cluster.scheduling_policy.thresholds.duration: 'xs:int', 
cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 
'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 
'xs:boolean',
-        cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 
'xs:boolean', cluster.ballooning_enabled: 'xs:boolean'}
+        cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 
'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', cluster.spice_proxy: 
'xs:string'}
         description: add a new cluster to the system
     urlparams: {}
     headers:
@@ -1758,7 +1759,7 @@
         optionalArguments: {cluster.name: 'xs:string', cluster.description: 
'xs:string', cluster.cpu.id: 'xs:string', cluster.version.major: 'xs:int', 
cluster.version.minor: 'xs:int',
         cluster.memory_policy.overcommit.percent: 'xs:double', 
cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean', 
cluster.scheduling_policy.policy: 'xs:string',
         cluster.scheduling_policy.thresholds.low: 'xs:int', 
cluster.scheduling_policy.thresholds.high: 'xs:int', 
cluster.scheduling_policy.thresholds.duration: 'xs:int',
-        cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 
'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 
'xs:boolean', cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 
'xs:boolean', cluster.ballooning_enabled: 'xs:boolean'}
+        cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 
'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 
'xs:boolean', cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 
'xs:boolean', cluster.ballooning_enabled: 'xs:boolean', cluster.spice_proxy: 
'xs:string'}
         description: update specified cluster in the data center
     urlparams: {}
     headers:
@@ -1774,7 +1775,7 @@
         optionalArguments: {cluster.description: 'xs:string', 
cluster.memory_policy.overcommit.percent: 'xs:double', 
cluster.memory_policy.transparent_hugepages.enabled: 'xs:boolean',
         cluster.scheduling_policy.policy: 'xs:string', 
cluster.scheduling_policy.thresholds.low: 'xs:int', 
cluster.scheduling_policy.thresholds.high: 'xs:int',
         cluster.scheduling_policy.thresholds.duration: 'xs:int', 
cluster.error_handling.on_error: 'xs:string', cluster.virt_service: 
'xs:boolean', cluster.gluster_service: 'xs:boolean', cluster.threads_as_cores: 
'xs:boolean',
-        cluster.tunnel_migration: 'xs:boolean', cluster.ballooning_enabled: 
'xs:boolean'}
+        cluster.tunnel_migration: 'xs:boolean', cluster.ballooning_enabled: 
'xs:boolean', cluster.spice_proxy: 'xs:string'}
         description: add a new cluster to the data center
     urlparams: {}
     headers:
@@ -3623,7 +3624,7 @@
       signatures:
       - mandatoryArguments: {}
         optionalArguments: {vmpool.cluster.id|name: 'xs:string', 
vmpool.template.id|name: 'xs:string',
-          vmpool.name: 'xs:string', vmpool.comment: 'xs:string', vmpool.size: 
'xs:int', vmpool.max_user_vms: 'xs:int'}
+          vmpool.name: 'xs:string', vmpool.comment: 'xs:string', vmpool.size: 
'xs:int', vmpool.max_user_vms: 'xs:int', vmpool.spice_proxy: 'xs:string'}
         description: update the specified virtual machine pool in the system
     urlparams: {}
     headers:
@@ -3649,7 +3650,7 @@
       signatures:
       - mandatoryArguments: {vmpool.cluster.id|name: 'xs:string', 
vmpool.template.id|name: 'xs:string',
           vmpool.name: 'xs:string'}
-        optionalArguments: {vmpool.comment: 'xs:string', vmpool.size: 
'xs:int', vmpool.max_user_vms: 'xs:int'}
+        optionalArguments: {vmpool.comment: 'xs:string', vmpool.size: 
'xs:int', vmpool.max_user_vms: 'xs:int', vmpool.spice_proxy: 'xs:string'}
         description: add a new vm pool to the system
     urlparams: {}
     headers:
diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
index 9fe373a..9c6bf87 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
@@ -82,6 +82,10 @@
         if (model.isSetBallooningEnabled()) {
             entity.setEnableBallooning(model.isBallooningEnabled());
         }
+        if (model.isSetSpiceProxy()) {
+            entity.setSpiceProxy("".equals(model.getSpiceProxy()) ? null : 
model.getSpiceProxy());
+        }
+
         return entity;
     }
 
@@ -116,6 +120,7 @@
         model.setTunnelMigration(entity.isTunnelMigration());
         model.setTrustedService(entity.supportsTrustedService());
         model.setBallooningEnabled(entity.isEnableBallooning());
+        model.setSpiceProxy(entity.getSpiceProxy());
 
         return model;
     }
diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmPoolMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmPoolMapper.java
index 9320acc..2b5efc9 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmPoolMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmPoolMapper.java
@@ -40,6 +40,9 @@
         if (model.isSetMaxUserVms()) {
             entity.setMaxAssignedVmsPerUser(model.getMaxUserVms());
         }
+        if (model.isSetSpiceProxy()) {
+            entity.setSpiceProxy("".equals(model.getSpiceProxy()) ? null : 
model.getSpiceProxy());
+        }
         return entity;
     }
 
@@ -74,6 +77,7 @@
             model.getCluster().setId(entity.getVdsGroupId().toString());
         }
         model.setMaxUserVms(entity.getMaxAssignedVmsPerUser());
+        model.setSpiceProxy(entity.getSpiceProxy());
         return model;
     }
 }
diff --git 
a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/ClusterMapperTest.java
 
b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/ClusterMapperTest.java
index aaab260..94c50be 100644
--- 
a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/ClusterMapperTest.java
+++ 
b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/ClusterMapperTest.java
@@ -53,6 +53,7 @@
         assertEquals(model.isTunnelMigration(), transform.isTunnelMigration());
         assertEquals(model.isTrustedService(), transform.isTrustedService());
         assertEquals(model.isBallooningEnabled(), 
transform.isBallooningEnabled());
+        assertEquals(model.getSpiceProxy(), transform.getSpiceProxy());
     }
 
     private Mapper<Cluster, VDSGroup> getMapper() {
diff --git 
a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmPoolMapperTest.java
 
b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmPoolMapperTest.java
index f02fd33..ccece43 100644
--- 
a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmPoolMapperTest.java
+++ 
b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmPoolMapperTest.java
@@ -21,5 +21,6 @@
         assertNotNull(transform.getCluster());
         assertEquals(model.getCluster().getId(), 
transform.getCluster().getId());
         assertEquals(model.getMaxUserVms(), transform.getMaxUserVms());
+        assertEquals(model.getSpiceProxy(), transform.getSpiceProxy());
     }
 }


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

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

Reply via email to