Shahar Havivi has uploaded a new change for review. Change subject: api: : RFE add custom UUID for VM ......................................................................
api: : RFE add custom UUID for VM Change-Id: Ia0f1f19f6e03489afa7551fd2a9cbef877f78e8d Signed-off-by: Shahar Havivi <shah...@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 3 files changed, 33 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/29132/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 adbe8fd..bd6154f 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 @@ -2638,6 +2638,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 name="custom_uuid" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:extension> </xs:complexContent> @@ -3076,6 +3077,7 @@ <xs:element ref="serial_number" minOccurs="0" maxOccurs="1" /> <xs:element name="next_run_configuration_exists" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element name="numa_tune_mode" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="custom_uuid" 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 39e4eec..6cf1377 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 @@ -102,6 +102,7 @@ vm.serial_number.value: xs:string vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string + vm.custom_uuid: 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: @@ -189,6 +190,7 @@ vm.serial_number.value: xs:string vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string + vm.custom_uuid: 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', @@ -243,6 +245,7 @@ vm.serial_number.value: xs:string vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string + vm.custom_uuid: 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'} @@ -299,6 +302,7 @@ vm.serial_number.value: xs:string vm.bios.boot_menu.enabled: xs:boolean vm.numa_tune_mode: xs:string + vm.custom_uuid: xs:string description: add a virtual machine to the system from a configuration - requires the configuration type and the configuration data urlparams: {} headers: @@ -3630,6 +3634,7 @@ template.version.version_name: xs:string template.serial_number.policy: xs:string template.serial_number.value: xs:string + template.custom_uuid: xs:string template.bios.boot_menu.enabled: xs:boolean description: update the specified template in the system urlparams: {} @@ -3692,6 +3697,7 @@ template.serial_number.policy: xs:string template.serial_number.value: xs:string template.bios.boot_menu.enabled: xs:boolean + template.custom_uuid: 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 fefa1a4..69f269b 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 @@ -1,23 +1,13 @@ package org.ovirt.engine.api.restapi.types; +import static org.ovirt.engine.api.restapi.types.IntegerMapper.mapMinusOneToNull; +import static org.ovirt.engine.api.restapi.types.IntegerMapper.mapNullToMinusOne; + import org.apache.commons.lang.StringUtils; import org.ovirt.engine.api.common.util.StatusUtils; import org.ovirt.engine.api.model.Architecture; -import org.ovirt.engine.api.model.Bios; -import org.ovirt.engine.api.model.Boot; -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.CpuTopology; -import org.ovirt.engine.api.model.Display; import org.ovirt.engine.api.model.DisplayType; -import org.ovirt.engine.api.model.Domain; -import org.ovirt.engine.api.model.HighAvailability; -import org.ovirt.engine.api.model.OperatingSystem; -import org.ovirt.engine.api.model.Template; import org.ovirt.engine.api.model.TemplateStatus; -import org.ovirt.engine.api.model.TemplateVersion; -import org.ovirt.engine.api.model.Usb; import org.ovirt.engine.api.model.UsbType; import org.ovirt.engine.api.model.VmType; import org.ovirt.engine.api.restapi.utils.GuidUtils; @@ -31,9 +21,6 @@ import org.ovirt.engine.core.common.osinfo.OsRepository; import org.ovirt.engine.core.common.utils.SimpleDependecyInjector; import org.ovirt.engine.core.compat.Guid; - -import static org.ovirt.engine.api.restapi.types.IntegerMapper.mapNullToMinusOne; -import static org.ovirt.engine.api.restapi.types.IntegerMapper.mapMinusOneToNull; public class TemplateMapper { @@ -193,6 +180,14 @@ SerialNumberMapper.copySerialNumber(model.getSerialNumber(), entity); } + if (model.isSetCustomUuid()) { + entity.setCustomUuid(Guid.createGuidFromString(model.getCustomUuid())); + } + + if (model.isSetCustomUuid()) { + entity.setCustomUuid(Guid.createGuidFromString(model.getCustomUuid())); + } + return entity; } @@ -322,6 +317,12 @@ if (model.isSetSerialNumber()) { SerialNumberMapper.copySerialNumber(model.getSerialNumber(), staticVm); } + if (model.isSetCustomUuid()) { + staticVm.setCustomUuid(Guid.createGuidFromString(model.getCustomUuid())); + } + if (model.isSetCustomUuid()) { + staticVm.setCustomUuid(Guid.createGuidFromString(model.getCustomUuid())); + } return staticVm; } @@ -432,6 +433,14 @@ model.setSerialNumber(SerialNumberMapper.map(entity, null)); } + if (entity.getCustomUuid() != null) { + model.setCustomUuid(entity.getCustomUuid().toString()); + } + + if (entity.getCustomUuid() != null) { + model.setCustomUuid(entity.getCustomUuid().toString()); + } + return model; } -- To view, visit http://gerrit.ovirt.org/29132 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia0f1f19f6e03489afa7551fd2a9cbef877f78e8d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shahar Havivi <shav...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches