Hello Jiří Moskovčák,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/23425

to review the following change.

Change subject: restapi: added support for ksm control
......................................................................

restapi: added support for ksm control

Change-Id: I44b992bd2bb69ff0d7996b029249a787dc266617
Bug-Url: https://bugzilla.redhat.com/1026980
Signed-off-by: Jiri Moskovcak <[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/test/java/org/ovirt/engine/api/restapi/types/ClusterMapperTest.java
4 files changed, 17 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/25/23425/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 5cfdf2d..1be0f93 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
@@ -1285,6 +1285,7 @@
           <xs:element name="ha_reservation" type="xs:boolean" minOccurs="0" 
maxOccurs="1"/>
           <xs:element name="ballooning_enabled" type="xs:boolean" 
minOccurs="0" maxOccurs="1"/>
           <xs:element ref="display" minOccurs="0" maxOccurs="1"/>
+          <xs:element ref="ksm" minOccurs="0" maxOccurs="1"/>
           <!-- Also a rel="networks" link -->
         </xs:sequence>
       </xs:extension>
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 25ef2f3..eee3ca5 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
@@ -604,7 +604,7 @@
           disk.storage_domains.storage_domain--COLLECTION: 
{storage_domain.id|name: 'xs:string'}
         description: add a new direct lun disk to the virtual machine, this 
operation does not require size but needs lun connection details
       - mandatoryArguments: {disk.id: 'xs:string'}
-        optionalArguments: 
+        optionalArguments:
           disk.active: xs:boolean
           disk.read_only: xs:boolean
         description: attach a disk to the virtual machine
@@ -1275,7 +1275,7 @@
         description: add a new storage domain to the system using a direct lun
       - mandatoryArguments: {storagedomain.host.id|name: 'xs:string',
           storagedomain.type: 'xs:string', storagedomain.storage.type: 
'xs:string',
-          storagedomain.format: 'xs:boolean',storagedomain.storage.address: 
'xs:string', 
+          storagedomain.format: 'xs:boolean',storagedomain.storage.address: 
'xs:string',
           storagedomain.storage.path: 'xs:string'}
         optionalArguments: {storagedomain.name: 'xs:string', 
storagedomain.comment: 'xs:string', storagedomain.storage_format: 'xs:string'}
         description: add a new storage domain to the system using the storage 
on the given host and path
@@ -1575,7 +1575,7 @@
         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.cpu.architecture: 'xs:string', cluster.display.proxy: 
'xs:string'}
+        cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 
'xs:string', cluster.ksm.enabled: 'xs:boolean'}
         description: update the specified cluster in the system. The 
capabilities like virt service, cluster service, tarnsparent huge pages etc can 
be changed.
     urlparams: {}
     headers:
@@ -1591,7 +1591,8 @@
         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.ha_reservation: 'xs:boolean', 
cluster.ballooning_enabled: 'xs:boolean', cluster.cpu.architecture: 
'xs:string', cluster.display.proxy: 'xs:string'}
+        cluster.tunnel_migration: 'xs:boolean', cluster.trusted_service: 
'xs:boolean',  cluster.ha_reservation: 'xs:boolean', 
cluster.ballooning_enabled: 'xs:boolean', cluster.cpu.architecture: 
'xs:string', cluster.display.proxy: 'xs:string',
+        cluster.ksm.enabled: 'xs:boolean'}
         description: add a new cluster to the system
     urlparams: {}
     headers:
@@ -1920,7 +1921,7 @@
         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.ha_reservation: 'xs:boolean', cluster.ballooning_enabled: 
'xs:boolean',
-        cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 
'xs:string'}
+        cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 
'xs:string', cluster.ksm.enabled: 'xs:boolean',}
         description: update specified cluster in the data center
     urlparams: {}
     headers:
@@ -1936,7 +1937,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.cpu.architecture: 'xs:string', cluster.display.proxy: 
'xs:string'}
+        cluster.tunnel_migration: 'xs:boolean', cluster.ballooning_enabled: 
'xs:boolean', cluster.cpu.architecture: 'xs:string', cluster.display.proxy: 
'xs:string', cluster.ksm.enabled: 'xs:boolean',}
         description: add a new cluster to the data center
     urlparams: {}
     headers:
@@ -3940,7 +3941,7 @@
           gluster_volume.stripe_count: 'xs:unsignedShort'
           gluster_volume.options.option--COLLECTION: {option.name: 
'xs:string', option.value: 'xs:string'}
         description: add a new gluster volume to the cluster with bricks
-    urlparams: 
+    urlparams:
       force: {context: matrix, type: 'xs:boolean', value: true|false, 
required: false}
     headers:
       Content-Type: {value: application/xml|json, required: true}
@@ -4055,7 +4056,7 @@
           brick--COLLECTION: {brick.server_id: 'xs:string', brick.brick_dir: 
'xs:string'}
         optionalArguments: {replica_count: 'xs:unsignedShort', stripe_count: 
'xs:unsignedShort'}
         description: add a new brick to the gluster volume attached to the 
cluster
-    urlparams: 
+    urlparams:
       force: {context: matrix, type: 'xs:boolean', value: true|false, 
required: false}
     headers:
       Content-Type: {value: application/xml|json, required: true}
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 756b751..7361340 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
@@ -11,6 +11,7 @@
 import org.ovirt.engine.api.model.DataCenter;
 import org.ovirt.engine.api.model.Display;
 import org.ovirt.engine.api.model.ErrorHandling;
+import org.ovirt.engine.api.model.KSM;
 import org.ovirt.engine.api.model.MemoryOverCommit;
 import org.ovirt.engine.api.model.MemoryPolicy;
 import org.ovirt.engine.api.model.MigrateOnError;
@@ -95,6 +96,9 @@
         if (model.isSetBallooningEnabled()) {
             entity.setEnableBallooning(model.isBallooningEnabled());
         }
+        if (model.isSetKsm() && model.getKsm().isSetEnabled()) {
+            entity.setEnableKsm(model.getKsm().isEnabled());
+        }
         if (model.isSetDisplay() && model.getDisplay().isSetProxy()) {
             entity.setSpiceProxy("".equals(model.getDisplay().getProxy()) ? 
null : model.getDisplay().getProxy());
         }
@@ -137,6 +141,8 @@
         model.setTrustedService(entity.supportsTrustedService());
         model.setHaReservation(entity.supportsHaReservation());
         model.setBallooningEnabled(entity.isEnableBallooning());
+        model.setKsm(new KSM());
+        model.getKsm().setEnabled(entity.isEnableKsm());
         if (StringUtils.isNotBlank(entity.getSpiceProxy())) {
             Display display = new Display();
             display.setProxy(entity.getSpiceProxy());
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 3a69c11..6aa12c5 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.getKsm().isEnabled(), 
transform.getKsm().isEnabled());
         assertEquals(model.getDisplay().getProxy(), 
transform.getDisplay().getProxy());
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I44b992bd2bb69ff0d7996b029249a787dc266617
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Jiří Moskovčák <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to