Gilad Chaplik has uploaded a new change for review.

Change subject: restapi: adding cpu profile to VM and template
......................................................................

restapi: adding cpu profile to VM and template

Allowing setting optional value cpu_profile.id into
VM and Template elements.

Change-Id: Ifef1442476ecde490414ae625ced333d1e9e6259
Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
---
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/TemplateMapper.java
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
4 files changed, 37 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/31843/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 b8a37fc..e07001e 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
@@ -2646,6 +2646,7 @@
           <!-- also rel="cdroms/disks/nics/watchdogs" links, see Devices below 
-->
           <xs:element name="version" type="TemplateVersion" minOccurs="0" 
maxOccurs="1"/>
           <xs:element ref="serial_number" minOccurs="0" maxOccurs="1" />
+          <xs:element ref="cpu_profile" minOccurs="0" maxOccurs="1"/>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>
@@ -3062,6 +3063,7 @@
           <xs:element name="migration_downtime" type="xs:int" minOccurs="0" 
maxOccurs="1" />
           <xs:element ref="virtio_scsi" minOccurs="0" maxOccurs="1"/>
           <xs:element ref="permissions" minOccurs="0" maxOccurs="1"/>
+          <xs:element ref="cpu_profile" minOccurs="0" maxOccurs="1"/>
           <xs:element ref="vmpool" minOccurs="0" maxOccurs="1">
             <xs:annotation>
               <xs:appinfo>
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 b765942..ca2cc3d 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
@@ -103,6 +103,7 @@
           vm.serial_number.value: xs:string
           vm.bios.boot_menu.enabled: xs:boolean
           vm.numa_tune_mode: xs:string
+          vm.cpu_profile.id: xs:string
         description: update the virtual machine in the system for the given 
virtual machine id with the values specified in the request
     urlparams: {}
     headers:
@@ -190,6 +191,7 @@
           vm.serial_number.value: xs:string
           vm.bios.boot_menu.enabled: xs:boolean
           vm.numa_tune_mode: xs:string
+          vm.cpu_profile.id: xs:string
         description: add a virtual machine to the system from scratch
       # the following signature is for clone VM from a Snapshot - requires the 
Snapshot ID
       - mandatoryArguments: {vm.name: 'xs:string', vm.template.id|name: 
'xs:string', vm.cluster.id|name: 'xs:string',
@@ -244,6 +246,7 @@
           vm.serial_number.value: xs:string
           vm.bios.boot_menu.enabled: xs:boolean
           vm.numa_tune_mode: xs:string
+          vm.cpu_profile.id: xs:string
         description: add a virtual machine to the system by cloning from a 
snapshot
       # the following signature is for adding VM from a configuration - 
requires the configuration type and the configuration data
       - mandatoryArguments: {vm.initialization.configuration.type: 
'xs:string', vm.initialization.configuration.data: 'xs:string'}
@@ -300,6 +303,7 @@
                 vm.serial_number.value: xs:string
                 vm.bios.boot_menu.enabled: xs:boolean
                 vm.numa_tune_mode: xs:string
+                vm.cpu_profile.id: xs:string
         description: add a virtual machine to the system from a configuration 
- requires the configuration type and the configuration data
     urlparams: {}
     headers:
@@ -3735,6 +3739,7 @@
           template.serial_number.policy: xs:string
           template.serial_number.value: xs:string
           template.bios.boot_menu.enabled: xs:boolean
+          template.cpu_profile.id: xs:string
         description: update the specified template in the system
     urlparams: {}
     headers:
@@ -3798,6 +3803,7 @@
           template.bios.boot_menu.enabled: xs:boolean
           template.cluster.id: xs:string
           template.cluster.name: xs:string
+          template.cpu_profile.id: xs:string
         description: add a new template to the system
     urlparams: {}
     headers:
diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/TemplateMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/TemplateMapper.java
index 822cac8..9d28cfb 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/TemplateMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/TemplateMapper.java
@@ -8,6 +8,7 @@
 import org.ovirt.engine.api.model.BootMenu;
 import org.ovirt.engine.api.model.CPU;
 import org.ovirt.engine.api.model.Cluster;
+import org.ovirt.engine.api.model.CpuProfile;
 import org.ovirt.engine.api.model.CpuTopology;
 import org.ovirt.engine.api.model.Display;
 import org.ovirt.engine.api.model.DisplayType;
@@ -193,6 +194,10 @@
             SerialNumberMapper.copySerialNumber(model.getSerialNumber(), 
entity);
         }
 
+        if (model.isSetCpuProfile() && model.getCpuProfile().isSetId()) {
+            
entity.setCpuProfileId(GuidUtils.asGuid(model.getCpuProfile().getId()));
+        }
+
         return entity;
     }
 
@@ -322,6 +327,11 @@
         if (model.isSetSerialNumber()) {
             SerialNumberMapper.copySerialNumber(model.getSerialNumber(), 
staticVm);
         }
+
+        if (model.isSetCpuProfile() && model.getCpuProfile().isSetId()) {
+            
staticVm.setCpuProfileId(GuidUtils.asGuid(model.getCpuProfile().getId()));
+        }
+
         return staticVm;
     }
 
@@ -430,6 +440,12 @@
             model.setSerialNumber(SerialNumberMapper.map(entity, null));
         }
 
+        if (entity.getCpuProfileId() != null) {
+            CpuProfile cpuProfile = new CpuProfile();
+            cpuProfile.setId(entity.getCpuProfileId().toString());
+            model.setCpuProfile(cpuProfile);
+        }
+
         return model;
     }
 
diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
index 7725e1c..4b68e9b 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
@@ -9,6 +9,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.api.common.util.StatusUtils;
 import org.ovirt.engine.api.model.AuthorizedKey;
@@ -23,6 +24,7 @@
 import org.ovirt.engine.api.model.Configuration;
 import org.ovirt.engine.api.model.ConfigurationType;
 import org.ovirt.engine.api.model.CpuMode;
+import org.ovirt.engine.api.model.CpuProfile;
 import org.ovirt.engine.api.model.CpuTopology;
 import org.ovirt.engine.api.model.CpuTune;
 import org.ovirt.engine.api.model.CustomProperties;
@@ -129,6 +131,7 @@
         staticVm.setCustomSerialNumber(entity.getCustomSerialNumber());
         
staticVm.setSpiceFileTransferEnabled(entity.isSpiceFileTransferEnabled());
         staticVm.setSpiceCopyPasteEnabled(entity.isSpiceCopyPasteEnabled());
+        staticVm.setCpuProfileId(entity.getCpuProfileId());
         return staticVm;
     }
 
@@ -328,6 +331,10 @@
             if (mode != null) {
                 staticVm.setNumaTuneMode(map(mode, null));
             }
+        }
+
+        if (vm.isSetCpuProfile() && vm.getCpuProfile().isSetId()) {
+            
staticVm.setCpuProfileId(GuidUtils.asGuid(vm.getCpuProfile().getId()));
         }
 
         return staticVm;
@@ -575,6 +582,12 @@
         }
         
model.setNextRunConfigurationExists(entity.isNextRunConfigurationExists());
         model.setNumaTuneMode(map(entity.getNumaTuneMode(), null));
+
+        if (entity.getCpuProfileId() != null) {
+            CpuProfile cpuProfile = new CpuProfile();
+            cpuProfile.setId(entity.getCpuProfileId().toString());
+            model.setCpuProfile(cpuProfile);
+        }
         return model;
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifef1442476ecde490414ae625ced333d1e9e6259
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to