Shahar Havivi has uploaded a new change for review. Change subject: API: Vm Init - new Feature ......................................................................
API: Vm Init - new Feature Summry: This Feature will allow persistent of Windows Sysprep and Cloud-Init data to the Database. By persisting the data Admin can create a template with VM-Init data that which will enable initialize VMs with relevant Data. Feature page: http://www.ovirt.org/Features/vm-init-persistent Change-Id: I817de4fd7c7efcc3740583ede7a96bd522015660 Signed-off-by: Shahar Havivi <shav...@redhat.com> --- M backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostNicMapper.java 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 M backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/TemplateMapperTest.java M backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmMapperTest.java 7 files changed, 220 insertions(+), 82 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/23021/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 3f000b4..69839a2 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 @@ -2526,6 +2526,7 @@ <xs:element name="tunnel_migration" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element ref="virtio_scsi" minOccurs="0" maxOccurs="1"/> <xs:element ref="permissions" minOccurs="0" maxOccurs="1"/> + <xs:element ref="vminit" minOccurs="0" maxOccurs="1"/> <xs:element ref="vmpool" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:appinfo> @@ -2655,6 +2656,41 @@ </xs:element> </xs:sequence> </xs:complexType> + + <!-- VmInit --> + <xs:element name="vminit_network" type="VmInitNetwork"/> + + <xs:complexType name="VmInitNetwork"> + <xs:sequence> + <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="start_on_boot" type="xs:boolean" minOccurs="0" maxOccurs="1"/> + <xs:element name="boot_protocol" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="ip" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="netmask" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="gateway" type="xs:string" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + </xs:complexType> + + + <xs:element name="vminit" type="VmInit"/> + + <xs:complexType name="VmInit"> + <xs:sequence> + <xs:element name="hostname" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="domain" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="timeZone" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="authorized_keys" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="regenerate_keys" type="xs:boolean" minOccurs="0" maxOccurs="1"/> + <xs:element name="dns_servers" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="dns_search" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element ref="vminit_network" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="winkey" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="root_password" type="xs:string" minOccurs="0" maxOccurs="1"/> + <xs:element name="custom_script" type="xs:string" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + </xs:complexType> + + <!-- Virtual Machine Pools --> <xs:element name="vmpool" type="VmPool"/> diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java index a159936..0ae8af1 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java @@ -42,7 +42,6 @@ import org.ovirt.engine.api.restapi.types.VmMapper; import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.ChangeVMClusterParameters; -import org.ovirt.engine.core.common.action.CloudInitParameters; import org.ovirt.engine.core.common.action.MigrateVmParameters; import org.ovirt.engine.core.common.action.MigrateVmToServerParameters; import org.ovirt.engine.core.common.action.MoveVmParameters; @@ -60,6 +59,7 @@ import org.ovirt.engine.core.common.businessentities.InitializationType; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; +import org.ovirt.engine.core.common.businessentities.VmInit; import org.ovirt.engine.core.common.businessentities.VmStatic; import org.ovirt.engine.core.common.interfaces.SearchType; import org.ovirt.engine.core.common.queries.GetPermissionsForObjectParameters; @@ -253,8 +253,8 @@ } } params.setInitializationType(InitializationType.CloudInit); - ((RunVmOnceParams) params).setCloudInitParameters( - getMapper(CloudInit.class, CloudInitParameters.class) + ((RunVmOnceParams) params).setVmInit( + getMapper(CloudInit.class, VmInit.class) .map(cloudInit, null)); } } else { diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostNicMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostNicMapper.java index bc837b5..64bcf74 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostNicMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostNicMapper.java @@ -75,7 +75,7 @@ } } if(model.isSetBootProtocol()){ - NetworkBootProtocol networkBootProtocol = map(BootProtocol.fromValue(model.getBootProtocol()), null); + NetworkBootProtocol networkBootProtocol = map(BootProtocol.fromValue(model.getBootProtocol()), NetworkBootProtocol.NONE); if(networkBootProtocol != null){ entity.setBootProtocol(networkBootProtocol); } 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 0a3c8d5..20e8ba2 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,7 +8,6 @@ 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; @@ -136,9 +135,6 @@ entity.setVncKeyboardLayout(layout); } } - if (model.isSetDomain() && model.getDomain().isSetName()) { - entity.setDomain(model.getDomain().getName()); - } if (model.isSetTimezone()) { String timezone = model.getTimezone(); if (timezone.isEmpty()) { @@ -251,9 +247,6 @@ staticVm.setVncKeyboardLayout(layout); } } - if (model.isSetDomain() && model.getDomain().isSetName()) { - staticVm.setDomain(model.getDomain().getName()); - } if (model.isSetTimezone()) { staticVm.setTimeZone(model.getTimezone()); } @@ -328,11 +321,6 @@ } if (entity.getCreationDate() != null) { model.setCreationTime(DateMapper.map(entity.getCreationDate(), null)); - } - if (entity.getDomain()!=null && !entity.getDomain().isEmpty()) { - Domain domain = new Domain(); - domain.setName(entity.getDomain()); - model.setDomain(domain); } if (entity.getUsbPolicy()!=null) { Usb usb = new Usb(); 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 ccd5f5b..39e5e9d 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 @@ -3,7 +3,6 @@ import static org.ovirt.engine.core.compat.Guid.createGuidFromString; import java.util.ArrayList; -import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -26,7 +25,6 @@ import org.ovirt.engine.api.model.CustomProperty; 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.File; import org.ovirt.engine.api.model.Files; import org.ovirt.engine.api.model.GuestInfo; @@ -39,7 +37,6 @@ import org.ovirt.engine.api.model.OperatingSystem; import org.ovirt.engine.api.model.OsType; import org.ovirt.engine.api.model.Payload; -import org.ovirt.engine.api.model.PayloadEncoding; import org.ovirt.engine.api.model.Quota; import org.ovirt.engine.api.model.Template; import org.ovirt.engine.api.model.Usb; @@ -55,8 +52,6 @@ import org.ovirt.engine.api.restapi.utils.CustomPropertiesParser; import org.ovirt.engine.api.restapi.utils.GuidUtils; import org.ovirt.engine.api.restapi.utils.UsbMapperUtils; -import org.ovirt.engine.core.common.action.CloudInitParameters; -import org.ovirt.engine.core.common.action.CloudInitParameters.Attachment; import org.ovirt.engine.core.common.action.RunVmOnceParams; import org.ovirt.engine.core.common.businessentities.BootSequence; import org.ovirt.engine.core.common.businessentities.MigrationSupport; @@ -64,11 +59,12 @@ import org.ovirt.engine.core.common.businessentities.UsbPolicy; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VMStatus; +import org.ovirt.engine.core.common.businessentities.VmInit; +import org.ovirt.engine.core.common.businessentities.VmInitNetwork; import org.ovirt.engine.core.common.businessentities.VmPayload; import org.ovirt.engine.core.common.businessentities.VmStatic; import org.ovirt.engine.core.common.businessentities.VmTemplate; import org.ovirt.engine.core.common.businessentities.network.NetworkBootProtocol; -import org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface; import org.ovirt.engine.core.common.osinfo.OsRepository; import org.ovirt.engine.core.common.utils.SimpleDependecyInjector; import org.ovirt.engine.core.common.utils.VmDeviceType; @@ -87,7 +83,6 @@ VmStatic staticVm = template != null ? template : new VmStatic(); staticVm.setId(Guid.Empty); staticVm.setVmtGuid(entity.getId()); - staticVm.setDomain(entity.getDomain()); staticVm.setVdsGroupId(entity.getVdsGroupId()); staticVm.setMemSizeMb(entity.getMemSizeMb()); staticVm.setOsId(entity.getOsId()); @@ -116,6 +111,7 @@ staticVm.setUsbPolicy(entity.getUsbPolicy()); staticVm.setTunnelMigration(entity.getTunnelMigration()); staticVm.setVncKeyboardLayout(entity.getVncKeyboardLayout()); + staticVm.setVmInit(entity.getVmInit()); return staticVm; } @@ -242,9 +238,6 @@ if (vm.isSetPlacementPolicy() && vm.getPlacementPolicy().isSetHost()) { staticVm.setDedicatedVmForVds(createGuidFromString(vm.getPlacementPolicy().getHost().getId())); } - if (vm.isSetDomain() && vm.getDomain().isSetName()) { - staticVm.setDomain(vm.getDomain().getName()); - } if (vm.isSetMemoryPolicy() && vm.getMemoryPolicy().isSetGuaranteed()) { Long memGuaranteed = vm.getMemoryPolicy().getGuaranteed() / BYTES_PER_MB; staticVm.setMinAllocatedMem(memGuaranteed.intValue()); @@ -264,6 +257,20 @@ } if (vm.isSetTunnelMigration()) { staticVm.setTunnelMigration(vm.isTunnelMigration()); + } + if (vm.isSetVminit()) { + staticVm.setVmInit(map(vm.getVminit(), new VmInit())); + } + // The Domain is now set to VmInit + // we only set it for backward compatibility, + // if the Domain set via VmInit we ignore it + if (vm.isSetDomain() && vm.getDomain().isSetName()) { + if (staticVm.getVmInit() == null) { + staticVm.setVmInit(new VmInit()); + } + if (staticVm.getVmInit().getDomain() == null) { + staticVm.getVmInit().setDomain(vm.getDomain().getName()); + } } return staticVm; } @@ -450,11 +457,6 @@ if(vmAffinity !=null){ model.getPlacementPolicy().setAffinity(vmAffinity.value()); } - if (entity.getVmDomain()!=null && !entity.getVmDomain().isEmpty()) { - Domain domain = new Domain(); - domain.setName(entity.getVmDomain()); - model.setDomain(domain); - } MemoryPolicy policy = new MemoryPolicy(); policy.setGuaranteed((long)entity.getMinAllocatedMem() * (long)BYTES_PER_MB); model.setMemoryPolicy(policy); @@ -479,6 +481,10 @@ model.setQuota(quota); } model.setTunnelMigration(entity.getTunnelMigration()); + + if (entity.getVmInit() != null) { + model.setVminit(map(entity.getVmInit(), null)); + } return model; } @@ -916,27 +922,153 @@ return entity; } - @Mapping(from = Attachment.AttachmentType.class, to = PayloadEncoding.class) - public static PayloadEncoding map(Attachment.AttachmentType attachmentType, PayloadEncoding template) { - switch (attachmentType) { - case BASE64: return PayloadEncoding.BASE64; - case PLAINTEXT: return PayloadEncoding.PLAINTEXT; - default: return null; + @Mapping(from = org.ovirt.engine.api.model.VmInit.class, to = VmInit.class) + public static VmInit map(org.ovirt.engine.api.model.VmInit model, VmInit template) { + VmInit entity = template != null ? template : new VmInit(); + + if (model.isSetHostname()) { + entity.setHostname(model.getHostname()); } + + if (model.isSetDomain()) { + entity.setDomain(model.getDomain()); + } + + if (model.isSetTimeZone()) { + entity.setTimeZone(model.getTimeZone()); + } + + if (model.isSetAuthorizedKeys()) { + entity.setAuthorizedKeys(model.getAuthorizedKeys()); + } + + if (model.isSetRegenerateKeys()) { + entity.setRegenerateKeys(model.isRegenerateKeys()); + } + + if (model.isSetDnsServers()) { + entity.setDnsServers(model.getDnsServers()); + } + + if (model.isSetDnsSearch()) { + entity.setDnsSearch(model.getDnsSearch()); + } + + if (model.isSetWinkey()) { + entity.setWinKey(model.getWinkey()); + } + + if (model.isSetRootPassword()) { + entity.setRootPassword(model.getRootPassword()); + } + + if (model.isSetCustomScript()) { + entity.setCustromScript(model.getCustomScript()); + } + + if (model.isSetVminitNetwork()) { + List<VmInitNetwork> networks = new ArrayList<VmInitNetwork>(); + for(org.ovirt.engine.api.model.VmInitNetwork net: model.getVminitNetwork()) { + networks.add(map(net, null)); + } + entity.setNetworks(networks); + } + return entity; } - @Mapping(from = PayloadEncoding.class, to = Attachment.AttachmentType.class) - public static Attachment.AttachmentType map(PayloadEncoding attachmentType, Attachment.AttachmentType template) { - switch (attachmentType) { - case BASE64: return Attachment.AttachmentType.BASE64; - case PLAINTEXT: return Attachment.AttachmentType.PLAINTEXT; - default: return null; + @Mapping(from = VmInit.class, to = org.ovirt.engine.api.model.VmInit.class) + public static org.ovirt.engine.api.model.VmInit map(VmInit model, org.ovirt.engine.api.model.VmInit template) { + org.ovirt.engine.api.model.VmInit entity = template != null ? template : + new org.ovirt.engine.api.model.VmInit(); + + if (model.getHostname() != null) { + entity.setHostname(model.getHostname()); } + if (model.getDomain() != null) { + entity.setDomain(model.getDomain()); + } + if (model.getTimeZone() != null) { + entity.setTimeZone(model.getTimeZone()); + } + if (model.getAuthorizedKeys() != null) { + entity.setAuthorizedKeys(model.getAuthorizedKeys()); + } + if (model.getRegenerateKeys() != null) { + entity.setRegenerateKeys(model.getRegenerateKeys()); + } + if (model.getDnsServers() != null) { + entity.setDnsServers(model.getDnsServers()); + } + if (model.getDnsSearch() != null) { + entity.setDnsSearch(model.getDnsSearch()); + } + if (model.getWinKey() != null) { + entity.setWinkey(model.getWinKey()); + } + if (model.getRootPassword() != null) { + entity.setRootPassword(model.getRootPassword()); + } + if (model.getCustromScript() != null) { + entity.setCustomScript(model.getCustromScript()); + } + if (model.getNetworks() != null) { + for (VmInitNetwork network : model.getNetworks()) { + entity.getVminitNetwork().add(map(network, null)); + } + } + return entity; } - @Mapping(from = CloudInit.class, to = CloudInitParameters.class) - public static CloudInitParameters map(CloudInit model, CloudInitParameters template) { - CloudInitParameters entity = template != null ? template : new CloudInitParameters(); + @Mapping(from = org.ovirt.engine.api.model.VmInitNetwork.class, to = VmInitNetwork.class) + public static VmInitNetwork map(org.ovirt.engine.api.model.VmInitNetwork model, VmInitNetwork template) { + VmInitNetwork entity = template != null ? template : new VmInitNetwork(); + + if (model.isSetName()) { + entity.setName(model.getName()); + } + + if (model.isSetStartOnBoot()) { + entity.setStartOnBoot(model.isStartOnBoot()); + } + + if (model.isSetBootProtocol()) { + entity.setBootProtocol(NetworkBootProtocol.valueOf(model.getBootProtocol())); + } + + if (model.isSetIp()) { + entity.setIp(model.getIp()); + } + + if (model.isSetNetmask()) { + entity.setNetmask(model.getNetmask()); + } + + if (model.isSetGateway()) { + entity.setGateway(model.getGateway()); + } + + return entity; + } + + @Mapping(from = VmInitNetwork.class, to = org.ovirt.engine.api.model.VmInitNetwork.class) + public static org.ovirt.engine.api.model.VmInitNetwork map(VmInitNetwork model, org.ovirt.engine.api.model.VmInitNetwork template) { + org.ovirt.engine.api.model.VmInitNetwork entity = template != null ? template + : new org.ovirt.engine.api.model.VmInitNetwork(); + + entity.setName(model.getName()); + entity.setStartOnBoot(model.getStartOnBoot()); + entity.setBootProtocol(model.getBootProtocol().name()); + entity.setIp(model.getIp()); + entity.setNetmask(model.getNetmask()); + entity.setGateway(model.getGateway()); + + return entity; + } + + + @Mapping(from = CloudInit.class, to = VmInit.class) + public static VmInit map(CloudInit model, VmInit template) { + VmInit entity = template != null ? template : new VmInit(); if (model.isSetHost() && model.getHost().isSetAddress()) { entity.setHostname(model.getHost().getAddress()); @@ -961,60 +1093,56 @@ if (model.isSetNetworkConfiguration()) { if (model.getNetworkConfiguration().isSetNics()) { - Map<String, VdsNetworkInterface> interfaces = new HashMap<>(); + List<VmInitNetwork> interfaces = new ArrayList<VmInitNetwork>(); for (NIC iface : model.getNetworkConfiguration().getNics().getNics()) { - VdsNetworkInterface vdsNetworkInterface = new VdsNetworkInterface(); + VmInitNetwork vmInitInterface = new VmInitNetwork(); + interfaces.add(vmInitInterface); if (iface.isSetBootProtocol()) { - NetworkBootProtocol protocol = HostNicMapper.map(BootProtocol.fromValue(iface.getBootProtocol()), null); - vdsNetworkInterface.setBootProtocol(protocol); + NetworkBootProtocol protocol = HostNicMapper.map + (BootProtocol.fromValue(iface.getBootProtocol()), vmInitInterface.getBootProtocol()); + vmInitInterface.setBootProtocol(protocol); if (protocol != NetworkBootProtocol.DHCP && iface.isSetNetwork() && iface.getNetwork().isSetIp()) { if (iface.getNetwork().getIp().isSetAddress()) { - vdsNetworkInterface.setAddress(iface.getNetwork().getIp().getAddress()); + vmInitInterface.setIp(iface.getNetwork().getIp().getAddress()); } if (iface.getNetwork().getIp().isSetNetmask()) { - vdsNetworkInterface.setSubnet(iface.getNetwork().getIp().getNetmask()); + vmInitInterface.setNetmask(iface.getNetwork().getIp().getNetmask()); } if (iface.getNetwork().getIp().isSetGateway()) { - vdsNetworkInterface.setGateway(iface.getNetwork().getIp().getGateway()); + vmInitInterface.setGateway(iface.getNetwork().getIp().getGateway()); } } - } - - interfaces.put(iface.getName(), vdsNetworkInterface); - - if (iface.isSetOnBoot() && iface.isOnBoot()) { - if (entity.getStartOnBoot() == null) { - entity.setStartOnBoot(new ArrayList<String>()); + if (iface.isSetOnBoot() && iface.isOnBoot()) { + vmInitInterface.setStartOnBoot(true); } - entity.getStartOnBoot().add(iface.getName()); } } - entity.setInterfaces(interfaces); + entity.setNetworks(interfaces); } if (model.getNetworkConfiguration().isSetDns()) { if (model.getNetworkConfiguration().getDns().isSetServers() && model.getNetworkConfiguration().getDns().getServers().isSetHosts() && !model.getNetworkConfiguration().getDns().getServers().getHosts().isEmpty()) { - List<String> dnsServers = new ArrayList<>(); + StringBuilder dnsServers = new StringBuilder(); for (Host host : model.getNetworkConfiguration().getDns().getServers().getHosts()) { if (host.isSetAddress()) { - dnsServers.add(host.getAddress()); + dnsServers.append(host.getAddress()); } } - entity.setDnsServers(dnsServers); + entity.setDnsServers(dnsServers.toString()); } if (model.getNetworkConfiguration().getDns().isSetSearchDomains() && model.getNetworkConfiguration().getDns().getSearchDomains().isSetHosts() && !model.getNetworkConfiguration().getDns().getSearchDomains().getHosts().isEmpty()) { - List<String> searchDomains = new ArrayList<>(); + StringBuilder searchDomains = new StringBuilder(); for (Host host : model.getNetworkConfiguration().getDns().getSearchDomains().getHosts()) { if (host.isSetAddress()) { - searchDomains.add(host.getAddress()); + searchDomains.append(host.getAddress()); } } - entity.setDnsSearch(searchDomains); + entity.setDnsSearch(searchDomains.toString()); } } } @@ -1029,18 +1157,6 @@ if ("root".equals(user.getUserName())) { entity.setRootPassword(user.getPassword()); } - } - } - - if (model.isSetFiles() - && model.getFiles().isSetFiles() - && !model.getFiles().getFiles().isEmpty()) { - entity.setAttachments(new HashMap<String, Attachment>()); - for (File file : model.getFiles().getFiles()) { - Attachment attachment = new Attachment(); - attachment.setAttachmentType(map(PayloadEncoding.fromValue(file.getType()), null)); - attachment.setContent(file.getContent()); - entity.getAttachments().put(file.getName(), attachment); } } diff --git a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/TemplateMapperTest.java b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/TemplateMapperTest.java index d206616..9aac4ef 100644 --- a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/TemplateMapperTest.java +++ b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/TemplateMapperTest.java @@ -74,7 +74,6 @@ assertEquals(model.getDisplay().isSingleQxlPci(), transform.getDisplay().isSingleQxlPci()); assertEquals(model.getDisplay().isAllowOverride(), transform.getDisplay().isAllowOverride()); assertEquals(model.getDisplay().getKeyboardLayout(), transform.getDisplay().getKeyboardLayout()); - assertEquals(model.getDomain().getName(), transform.getDomain().getName()); assertEquals(model.getTimezone(), transform.getTimezone()); assertEquals(model.getDisplay().isSmartcardEnabled(), transform.getDisplay().isSmartcardEnabled()); assertEquals(model.isDeleteProtected(), transform.isDeleteProtected()); diff --git a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmMapperTest.java b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmMapperTest.java index 25bbb38..7a4f5f6 100644 --- a/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmMapperTest.java +++ b/backend/manager/modules/restapi/types/src/test/java/org/ovirt/engine/api/restapi/types/VmMapperTest.java @@ -129,7 +129,6 @@ assertEquals(model.getDisplay().isAllowOverride(), transform.getDisplay().isAllowOverride()); assertEquals(model.getPlacementPolicy().getHost().getId(), transform.getPlacementPolicy().getHost().getId()); assertTrue(Math.abs(model.getMemoryPolicy().getGuaranteed() - transform.getMemoryPolicy().getGuaranteed()) <= (1024 * 1024)); - assertEquals(model.getDomain().getName(), transform.getDomain().getName()); assertEquals(model.getTimezone(), transform.getTimezone()); assertEquals(model.getDisplay().isSmartcardEnabled(), transform.getDisplay().isSmartcardEnabled()); assertEquals(model.getDisplay().getKeyboardLayout(), transform.getDisplay().getKeyboardLayout()); -- To view, visit http://gerrit.ovirt.org/23021 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I817de4fd7c7efcc3740583ede7a96bd522015660 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