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/31/31731/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 afb6391..fb8e64d 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 @@ -2701,6 +2701,7 @@ <xs:element name="version" type="TemplateVersion" minOccurs="0" maxOccurs="1"/> <xs:element ref="serial_number" minOccurs="0" maxOccurs="1" /> <xs:element name="start_paused" type="xs:boolean" minOccurs="0" maxOccurs="1" /> + <xs:element ref="cpu_profile" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:extension> </xs:complexContent> @@ -3117,6 +3118,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 9a81fee..411c0cb 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 @@ -104,6 +104,7 @@ vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string vm.start_paused: xs:boolean + 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: @@ -192,6 +193,7 @@ vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string vm.start_paused: xs:boolean + 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', @@ -247,6 +249,7 @@ vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string vm.start_paused: xs:boolean + 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'} @@ -304,6 +307,7 @@ vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string vm.start_paused: xs:boolean + 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: @@ -3810,6 +3814,7 @@ template.serial_number.value: xs:string template.bios.boot_menu.enabled: xs:boolean template.start_paused: xs:boolean + template.cpu_profile.id: xs:string description: update the specified template in the system urlparams: {} headers: @@ -3874,6 +3879,7 @@ template.cluster.id: xs:string template.cluster.name: xs:string template.start_paused: xs:boolean + 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 d5ea4d3..636630f 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; @@ -196,6 +197,10 @@ entity.setRunAndPause(model.isStartPaused()); } + if (model.isSetCpuProfile() && model.getCpuProfile().isSetId()) { + entity.setCpuProfileId(GuidUtils.asGuid(model.getCpuProfile().getId())); + } + return entity; } @@ -328,6 +333,11 @@ if (model.isSetStartPaused()) { staticVm.setRunAndPause(model.isStartPaused()); } + + if (model.isSetCpuProfile() && model.getCpuProfile().isSetId()) { + staticVm.setCpuProfileId(GuidUtils.asGuid(model.getCpuProfile().getId())); + } + return staticVm; } @@ -438,6 +448,12 @@ model.setStartPaused(entity.isRunAndPause()); + 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 144ac45..f410c46 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; @@ -130,6 +132,7 @@ staticVm.setSpiceFileTransferEnabled(entity.isSpiceFileTransferEnabled()); staticVm.setSpiceCopyPasteEnabled(entity.isSpiceCopyPasteEnabled()); staticVm.setRunAndPause(entity.isRunAndPause()); + staticVm.setCpuProfileId(entity.getCpuProfileId()); return staticVm; } @@ -333,6 +336,10 @@ if (vm.isSetStartPaused()) { staticVm.setRunAndPause(vm.isStartPaused()); + } + + if (vm.isSetCpuProfile() && vm.getCpuProfile().isSetId()) { + staticVm.setCpuProfileId(GuidUtils.asGuid(vm.getCpuProfile().getId())); } return staticVm; @@ -581,6 +588,12 @@ model.setNextRunConfigurationExists(entity.isNextRunConfigurationExists()); model.setNumaTuneMode(map(entity.getNumaTuneMode(), null)); model.setStartPaused(entity.isRunAndPause()); + + 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/31731 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifef1442476ecde490414ae625ced333d1e9e6259 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches