Martin Betak has uploaded a new change for review.

Change subject: engine: Persist comment in AddVmTemplateCommand
......................................................................

engine: Persist comment in AddVmTemplateCommand

AddVmTemplateCommand did not map comment field from given VM to newly
created template.

Also added corresponding mapping to frontend CommonUnitToVmBaseBuilder.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1013670
Change-Id: I5ef17d46b067036063865fbb0e64d266493132cb
Signed-off-by: Martin Betak <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CommonUnitToVmBaseBuilder.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/FullUnitToVmBaseBuilder.java
M 
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
5 files changed, 7 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/24117/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
index ba652e7..962fd2e 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java
@@ -465,6 +465,7 @@
                         0,
                         new Date(),
                         getParameters().getDescription(),
+                        getParameters().getMasterVm().getComment(),
                         getParameters().getMasterVm().getMemSizeMb(),
                         getVmTemplateName(),
                         getParameters().getMasterVm().getNumOfSockets(),
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 9dbc4c8..c58559a 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
@@ -66,7 +66,7 @@
     @EditableField
     private boolean disabled;
 
-    public VmTemplate(int childCount, Date creationDate, String description, 
int memSizeMb, String name,
+    public VmTemplate(int childCount, Date creationDate, String description, 
String comment, int memSizeMb, String name,
             int numOfSockets, int cpuPerSocket, int osId, Guid vdsGroupId, 
Guid vmtGuid,
             int numOfMonitors, boolean singleQxlPci, int status, int 
usbPolicy, String timeZone, int niceLevel,
             int cpuShares, boolean failBack, BootSequence defaultBootSequence, 
VmType vmType,
@@ -82,7 +82,7 @@
                 osId,
                 creationDate,
                 description,
-                "",
+                comment,
                 memSizeMb,
                 numOfSockets,
                 cpuPerSocket,
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CommonUnitToVmBaseBuilder.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CommonUnitToVmBaseBuilder.java
index 264da6f..ac6df08 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CommonUnitToVmBaseBuilder.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CommonUnitToVmBaseBuilder.java
@@ -22,6 +22,8 @@
     @Override
     protected void postBuild(UnitVmModel model, VmBase vm) {
         vm.setAutoStartup(model.getIsHighlyAvailable().getEntity());
+        vm.setComment(model.getComment().getEntity());
+        vm.setDescription(model.getDescription().getEntity());
         vm.setPriority(model.getPriority().getSelectedItem().getEntity());
         vm.setRunAndPause(model.getIsRunAndPause().getEntity());
         vm.setStateless(model.getIsStateless().getEntity());
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/FullUnitToVmBaseBuilder.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/FullUnitToVmBaseBuilder.java
index 7f6ed51..528ce4e 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/FullUnitToVmBaseBuilder.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/FullUnitToVmBaseBuilder.java
@@ -24,10 +24,4 @@
                 new UsbPolicyUnitToVmBaseBuilder()
         );
     }
-
-    @Override
-    protected void postBuild(UnitVmModel model, VmBase vm) {
-        vm.setComment(model.getComment().getEntity());
-        vm.setDescription(model.getDescription().getEntity());
-    }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
 
b/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
index b6ced4b..3035d6b 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
@@ -151,6 +151,8 @@
         assertTrue(vm.isAutoStartup());
         assertEquals(QUOTA_ID, vm.getQuotaId());
         assertEquals(PRIORITY, vm.getPriority());
+        assertEquals(DESCRIPTION, vm.getDescription());
+        assertEquals(COMMENT, vm.getComment());
     }
 
     /**
@@ -172,8 +174,6 @@
 
         assertEquals(HOST_ID, vm.getDedicatedVmForVds());
         assertEquals(VM_NAME, vm.getName());
-        assertEquals(DESCRIPTION, vm.getDescription());
-        assertEquals(COMMENT, vm.getComment());
         assertEquals(USB_POLICY, vm.getUsbPolicy());
 
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ef17d46b067036063865fbb0e64d266493132cb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to