Omer Frenkel has uploaded a new change for review.

Change subject: core: fix VmTemplate copy ctor
......................................................................

core: fix VmTemplate copy ctor

remove code duplication by calling VmBase(VmBase vmBase) ctor that
already copies all the field from that class, and leave in VmTemplate
only the template fields.

Change-Id: Ie585d00ee6c4232b09e1a2396ad335348b8122be
Signed-off-by: Omer Frenkel <ofren...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java
1 file changed, 6 insertions(+), 50 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/04/35204/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java
index 651d9e9..486de1d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java
@@ -144,62 +144,18 @@
     }
 
     public VmTemplate(VmTemplate template) {
-        this();
+        super((VmBase)template);
+
+        diskTemplateMap = new HashMap<Guid, DiskImage>();
+        diskImageMap = new HashMap<Guid, DiskImage>();
+
         setChildCount(template.getChildCount());
-        setCreationDate(template.getCreationDate());
-        setDescription(template.getDescription());
-        setMemSizeMb(template.getMemSizeMb());
-        setName(template.getName());
-        setNumOfSockets(template.getNumOfSockets());
-        setCpuPerSocket(template.getCpuPerSocket());
-        setOsId(template.getOsId());
-        setVdsGroupId(template.getVdsGroupId());
-        setId(template.getId());
-        setNumOfMonitors(template.getNumOfMonitors());
-        setSingleQxlPci(template.getSingleQxlPci());
         setStatus(template.getStatus());
-        setUsbPolicy(template.getUsbPolicy());
-        setTimeZone(template.getTimeZone());
-        setNiceLevel(template.getNiceLevel());
-        setCpuShares(template.getCpuShares());
-        setFailBack(template.isFailBack());
-        setDefaultBootSequence(template.getDefaultBootSequence());
-        setVmType(template.getVmType());
-        setSmartcardEnabled(template.isSmartcardEnabled());
-        setDeleteProtected(template.isDeleteProtected());
-        setSsoMethod(template.getSsoMethod());
-        setTunnelMigration(template.getTunnelMigration());
-        setVncKeyboardLayout(template.getVncKeyboardLayout());
-        setMinAllocatedMem(template.getMinAllocatedMem());
-        setStateless(template.isStateless());
-        setRunAndPause(template.isRunAndPause());
-        setCreatedByUserId(template.getCreatedByUserId());
         setTemplateType(template.getTemplateType());
-        setAutoStartup(template.isAutoStartup());
-        setPriority(template.getPriority());
-        setDefaultDisplayType(template.getDefaultDisplayType());
-        setInitrdUrl(template.getInitrdUrl());
-        setKernelUrl(template.getKernelUrl());
-        setKernelParams(template.getKernelParams());
-        setQuotaId(template.getQuotaId());
-        setDedicatedVmForVds(template.getDedicatedVmForVds());
-        setMigrationSupport(template.getMigrationSupport());
-        setAllowConsoleReconnect(template.isAllowConsoleReconnect());
-        setIsoPath(template.getIsoPath());
-        setMigrationDowntime(template.getMigrationDowntime());
         setBaseTemplateId(template.getBaseTemplateId());
         setTemplateVersionName(template.getTemplateVersionName());
         setTemplateVersionNumber(template.getTemplateVersionNumber());
-        setComment(template.getComment());
-        setOrigin(template.getOrigin());
-        setSerialNumberPolicy(template.getSerialNumberPolicy());
-        setCustomSerialNumber(template.getCustomSerialNumber());
-        setBootMenuEnabled(template.isBootMenuEnabled());
-        setSpiceFileTransferEnabled(template.isSpiceFileTransferEnabled());
-        setNumaTuneMode(template.getNumaTuneMode());
-        setSpiceCopyPasteEnabled(template.isSpiceCopyPasteEnabled());
-        setAutoConverge(template.getAutoConverge());
-        setMigrateCompressed(template.getMigrateCompressed());
+        setDisabled(template.isDisabled());
     }
 
     public ArchitectureType getClusterArch() {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie585d00ee6c4232b09e1a2396ad335348b8122be
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Omer Frenkel <ofren...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to