Noam Slomianko has uploaded a new change for review. Change subject: engine: engine: add comment field to vm and template ......................................................................
engine: engine: add comment field to vm and template Part of the adding a comment field to many parts of the system - add to db - change dao - add comment to VmBase, VmStatic, VM, VmTemplate - add comment to UnitVmModel, VmListModel, VmGeneralModel, TemplateGeneralModel, TemplateListModel - reflect changes in the UI, namely to the AbstractVmPopupWidget Bug-Url: https://bugzilla.redhat.com/610501 Change-Id: Ib56cfbaf618eee10631eb91923733fbe4e52f45c Signed-off-by: Noam Slomianko <nslom...@redhat.com> --- M backend/manager/dbscripts/create_views.sql A backend/manager/dbscripts/upgrade/03_03_0060_add_comment_vm.sql M backend/manager/dbscripts/vm_templates_sp.sql M backend/manager/dbscripts/vms_sp.sql M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVmTemplateCommandTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/AbstractVmRowMapper.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResource.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/template/TemplateGeneralModelForm.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/vm/VmGeneralModelForm.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateGeneralModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGeneralModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabTemplateView.java 33 files changed, 180 insertions(+), 31 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/14319/1 diff --git a/backend/manager/dbscripts/create_views.sql b/backend/manager/dbscripts/create_views.sql index 9b9a7e6..76f9156 100644 --- a/backend/manager/dbscripts/create_views.sql +++ b/backend/manager/dbscripts/create_views.sql @@ -344,6 +344,7 @@ vm_templates.cpu_per_socket as cpu_per_socket, vm_templates.num_of_sockets*vm_templates.cpu_per_socket as num_of_cpus, vm_templates.description as description, + vm_templates.comment as comment, vm_templates.vds_group_id as vds_group_id, vm_templates.domain as domain, vm_templates.num_of_monitors as num_of_monitors, @@ -529,7 +530,7 @@ CREATE OR REPLACE VIEW vms AS SELECT vm_static.vm_name as vm_name, vm_static.mem_size_mb as vm_mem_size_mb, vm_static.nice_level as nice_level, - vm_static.vmt_guid as vmt_guid, vm_static.os as vm_os, vm_static.description as vm_description, vm_static.vds_group_id as vds_group_id, + vm_static.vmt_guid as vmt_guid, vm_static.os as vm_os, vm_static.description as vm_description, vm_static.comment as vm_comment, vm_static.vds_group_id as vds_group_id, vm_static.domain as vm_domain, vm_static.creation_date as vm_creation_date, vm_static.auto_startup as auto_startup, vm_static.is_stateless as is_stateless, vm_static.is_smartcard_enabled as is_smartcard_enabled, vm_static.is_delete_protected as is_delete_protected, vm_static.dedicated_vm_for_vds as dedicated_vm_for_vds, vm_static.fail_back as fail_back, vm_static.default_boot_sequence as default_boot_sequence, vm_static.vm_type as vm_type, vds_groups.name as vds_group_name, vds_groups.selection_algorithm as selection_algorithm, vds_groups.transparent_hugepages as transparent_hugepages, @@ -571,7 +572,7 @@ CREATE OR REPLACE VIEW vms_with_tags AS -SELECT vms.vm_name, vms.vm_mem_size_mb, vms.nice_level, vms.vmt_guid, vms.vm_os, vms.vm_description, +SELECT vms.vm_name, vms.vm_mem_size_mb, vms.nice_level, vms.vmt_guid, vms.vm_os, vms.vm_description, vms.vm_comment, vms.vds_group_id, vms.vm_domain, vms.vm_creation_date, vms.auto_startup, vms.is_stateless, vms.is_smartcard_enabled, vms.is_delete_protected, vms.dedicated_vm_for_vds, vms.fail_back, vms.default_boot_sequence, vms.vm_type, vms.vds_group_name, vms.selection_algorithm, vms.storage_pool_id, vms.storage_pool_name, diff --git a/backend/manager/dbscripts/upgrade/03_03_0060_add_comment_vm.sql b/backend/manager/dbscripts/upgrade/03_03_0060_add_comment_vm.sql new file mode 100644 index 0000000..13d559f --- /dev/null +++ b/backend/manager/dbscripts/upgrade/03_03_0060_add_comment_vm.sql @@ -0,0 +1 @@ +select fn_db_add_column('vm_static', 'comment', 'VARCHAR(4000) NOT NULL default '''''); diff --git a/backend/manager/dbscripts/vm_templates_sp.sql b/backend/manager/dbscripts/vm_templates_sp.sql index af4a1c2..1eb20e2 100644 --- a/backend/manager/dbscripts/vm_templates_sp.sql +++ b/backend/manager/dbscripts/vm_templates_sp.sql @@ -10,6 +10,7 @@ Create or replace FUNCTION InsertVmTemplate(v_child_count INTEGER, v_creation_date TIMESTAMP WITH TIME ZONE, v_description VARCHAR(4000) , + v_comment VARCHAR(4000), v_mem_size_mb INTEGER, v_name VARCHAR(40), v_num_of_sockets INTEGER, @@ -57,6 +58,7 @@ child_count, creation_date, description, + comment, mem_size_mb, vm_name, num_of_sockets, @@ -102,6 +104,7 @@ v_child_count, v_creation_date, v_description, + v_comment, v_mem_size_mb, v_name, v_num_of_sockets, @@ -156,6 +159,7 @@ Create or replace FUNCTION UpdateVmTemplate(v_child_count INTEGER, v_creation_date TIMESTAMP WITH TIME ZONE, v_description VARCHAR(4000) , + v_comment VARCHAR(4000) , v_mem_size_mb INTEGER, v_name VARCHAR(40), v_num_of_sockets INTEGER, @@ -199,7 +203,7 @@ AS $procedure$ BEGIN UPDATE vm_static - SET child_count = v_child_count,creation_date = v_creation_date,description = v_description, + SET child_count = v_child_count,creation_date = v_creation_date,description = v_description, comment = v_comment, mem_size_mb = v_mem_size_mb,vm_name = v_name,num_of_sockets = v_num_of_sockets, cpu_per_socket = v_cpu_per_socket,os = v_os, vds_group_id = v_vds_group_id,domain = v_domain,num_of_monitors = v_num_of_monitors, diff --git a/backend/manager/dbscripts/vms_sp.sql b/backend/manager/dbscripts/vms_sp.sql index fe10afa..4353be1 100644 --- a/backend/manager/dbscripts/vms_sp.sql +++ b/backend/manager/dbscripts/vms_sp.sql @@ -390,6 +390,7 @@ Create or replace FUNCTION InsertVmStatic(v_description VARCHAR(4000) , + v_comment VARCHAR(4000), v_mem_size_mb INTEGER, v_os INTEGER, v_vds_group_id UUID, @@ -435,8 +436,8 @@ RETURNS VOID AS $procedure$ BEGIN -INSERT INTO vm_static(description, mem_size_mb, os, vds_group_id, vm_guid, VM_NAME, vmt_guid,domain,creation_date,num_of_monitors,allow_console_reconnect,is_initialized,is_auto_suspend,num_of_sockets,cpu_per_socket,usb_policy, time_zone,auto_startup,is_stateless,dedicated_vm_for_vds, fail_back, default_boot_sequence, vm_type, nice_level, default_display_type, priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem, entity_type, quota_id, cpu_pinning, is_smartcard_enabled,is_delete_protected,host_cpu_flags, tunnel_migration, vnc_keyboard_layout, is_run_and_pause) - VALUES(v_description, v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_domain, v_creation_date, v_num_of_monitors, v_allow_console_reconnect, v_is_initialized, v_is_auto_suspend, v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone, v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back, v_default_boot_sequence, v_vm_type, v_nice_level, v_default_display_type, v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem, 'VM', v_quota_id, v_cpu_pinning, v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags, v_tunnel_migration, v_vnc_keyboard_layout, v_is_run_and_pause); +INSERT INTO vm_static(description, comment, mem_size_mb, os, vds_group_id, vm_guid, VM_NAME, vmt_guid,domain,creation_date,num_of_monitors,allow_console_reconnect,is_initialized,is_auto_suspend,num_of_sockets,cpu_per_socket,usb_policy, time_zone,auto_startup,is_stateless,dedicated_vm_for_vds, fail_back, default_boot_sequence, vm_type, nice_level, default_display_type, priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem, entity_type, quota_id, cpu_pinning, is_smartcard_enabled,is_delete_protected,host_cpu_flags, tunnel_migration, vnc_keyboard_layout, is_run_and_pause) + VALUES(v_description, v_comment, v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_domain, v_creation_date, v_num_of_monitors, v_allow_console_reconnect, v_is_initialized, v_is_auto_suspend, v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone, v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back, v_default_boot_sequence, v_vm_type, v_nice_level, v_default_display_type, v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem, 'VM', v_quota_id, v_cpu_pinning, v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags, v_tunnel_migration, v_vnc_keyboard_layout, v_is_run_and_pause); -- perform deletion from vm_ovf_generations to ensure that no record exists when performing insert to avoid PK violation. DELETE FROM vm_ovf_generations gen WHERE gen.vm_guid = v_vm_guid; INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) VALUES (v_vm_guid, (SELECT storage_pool_id FROM vds_groups vg WHERE vg.vds_group_id = v_vds_group_id)); @@ -506,6 +507,7 @@ Create or replace FUNCTION UpdateVmStatic(v_description VARCHAR(4000) , + v_comment VARCHAR(4000), v_mem_size_mb INTEGER, v_os INTEGER, v_vds_group_id UUID, @@ -554,7 +556,7 @@ AS $procedure$ BEGIN UPDATE vm_static - SET description = v_description,mem_size_mb = v_mem_size_mb,os = v_os,vds_group_id = v_vds_group_id, + SET description = v_description, comment = v_comment, mem_size_mb = v_mem_size_mb,os = v_os,vds_group_id = v_vds_group_id, VM_NAME = v_vm_name,vmt_guid = v_vmt_guid, domain = v_domain,creation_date = v_creation_date,num_of_monitors = v_num_of_monitors, allow_console_reconnect = v_allow_console_reconnect, @@ -882,6 +884,7 @@ Create or replace FUNCTION InsertVm(v_description VARCHAR(4000) , + v_comment VARCHAR(4000), v_mem_size_mb INTEGER, v_os INTEGER, v_vds_group_id UUID, @@ -923,8 +926,8 @@ RETURNS VOID AS $procedure$ BEGIN -INSERT INTO vm_static(description, mem_size_mb, os, vds_group_id, vm_guid, VM_NAME, vmt_guid, num_of_monitors, allow_console_reconnect, is_initialized, is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, time_zone,auto_startup,is_stateless,dedicated_vm_for_vds,fail_back,vm_type,nice_level,default_boot_sequence,default_display_type,priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,cpu_pinning,is_smartcard_enabled,is_delete_protected,host_cpu_flags, tunnel_migration, is_run_and_pause) - VALUES(v_description, v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_num_of_monitors, v_num_of_monitors, v_is_initialized, v_is_auto_suspend, v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone,v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back,v_vm_type,v_nice_level,v_default_boot_sequence,v_default_display_type,v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem,v_cpu_pinning,v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags, v_tunnel_migration, v_is_run_and_pause); +INSERT INTO vm_static(description, comment, mem_size_mb, os, vds_group_id, vm_guid, VM_NAME, vmt_guid, num_of_monitors, allow_console_reconnect, is_initialized, is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, time_zone,auto_startup,is_stateless,dedicated_vm_for_vds,fail_back,vm_type,nice_level,default_boot_sequence,default_display_type,priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,cpu_pinning,is_smartcard_enabled,is_delete_protected,host_cpu_flags, tunnel_migration, is_run_and_pause) + VALUES(v_description, v_comment, v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_num_of_monitors, v_num_of_monitors, v_is_initialized, v_is_auto_suspend, v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone,v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back,v_vm_type,v_nice_level,v_default_boot_sequence,v_default_display_type,v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem,v_cpu_pinning,v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags, v_tunnel_migration, v_is_run_and_pause); INSERT INTO vm_dynamic(vm_guid, status) VALUES(v_vm_guid, 0); @@ -1130,4 +1133,3 @@ WHERE vm_pool_id = v_vm_pool_id; END; $procedure$ LANGUAGE plpgsql; - 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 b07d090..2236b57 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 @@ -300,6 +300,7 @@ 0, new Date(), getParameters().getDescription(), + getParameters().getComment(), getParameters().getMasterVm().getMemSizeMb(), getVmTemplateName(), getParameters().getMasterVm().getNumOfSockets(), getParameters().getMasterVm().getCpuPerSocket(), diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java index a25bf21..86a7a65 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java @@ -29,7 +29,7 @@ public static void Init() { mUpdateVmTemplate = new ObjectIdentityChecker(VmTemplateHandler.class); BlankVmTemplateId = new Guid("00000000-0000-0000-0000-000000000000"); - mUpdateVmTemplate.AddPermittedFields(new String[] { "name", "description", "domain", "os", "osType", + mUpdateVmTemplate.AddPermittedFields(new String[] { "name", "description", "comment", "domain", "os", "osType", "autoSuspend", "interfaces", "memSizeMb", "numOfSockets", "cpuPerSocket", "vdsGroupId", "numOfMonitors", "allowConsoleReconnect", "usbPolicy", "timeZone", "diskMap", "defaultBootSequence", "disabled", diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVmTemplateCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVmTemplateCommandTest.java index e7449dc..b902083 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVmTemplateCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVmTemplateCommandTest.java @@ -66,7 +66,8 @@ vdsGroup.setcompatibility_version(Version.v3_2); when(vdsGroupDao.get(vdsGroupId)).thenReturn(vdsGroup); - AddVmTemplateParameters params = new AddVmTemplateParameters(vm, "templateName", "Template for testing"); + AddVmTemplateParameters params = new AddVmTemplateParameters(vm, "templateName", "Template for testing", + "comment test"); // Using the compensation constructor since the normal one contains DB access cmd = spy(new AddVmTemplateCommand<AddVmTemplateParameters>(params)); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java index 8c7628e..e62f9fc 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmTemplateParameters.java @@ -34,18 +34,22 @@ message = "ACTION_TYPE_FAILED_DESCRIPTION_MAY_NOT_CONTAIN_SPECIAL_CHARS") private String _description; + @Pattern(regexp = ValidationUtils.ONLY_I18N_ASCII_OR_NONE, + message = "ACTION_TYPE_FAILED_DESCRIPTION_MAY_NOT_CONTAIN_SPECIAL_CHARS") + private String _comment; + private boolean publicUse = false; - public AddVmTemplateParameters(VmStatic masterVm, String name, String description) { + public AddVmTemplateParameters(VmStatic masterVm, String name, String description, + String comment) { _masterVm = masterVm; _name = name; _description = description; + _comment = comment; } - public AddVmTemplateParameters(VM vm, String name, String description) { - _masterVm = vm.getStaticData(); - _name = name; - _description = description; + public AddVmTemplateParameters(VM vm, String name, String description, String comment) { + this(vm.getStaticData(), name, description, comment); } public VmStatic getMasterVm() { @@ -60,6 +64,10 @@ return _description; } + public String getComment() { + return _comment; + } + @Override public Guid getVmTemplateId() { return privateVmTemplateID; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java index 32bc728..d4adaa7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java @@ -180,6 +180,14 @@ this.vmStatic.setDescription(value); } + public String getVmComment() { + return vmStatic.getComment(); + } + + public void setVmComment(String value) { + vmStatic.setComment(value); + } + public int getNumOfMonitors() { return this.vmStatic.getNumOfMonitors(); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java index 39bf8a6..632b384 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java @@ -56,6 +56,12 @@ groups = { CreateEntity.class, UpdateEntity.class }) private String description; + @EditableField + @Size(max = BusinessEntitiesDefinitions.VM_DESCRIPTION_SIZE) + @ValidDescription(message = "ACTION_TYPE_FAILED_DESCRIPTION_MAY_NOT_CONTAIN_SPECIAL_CHARS", + groups = { CreateEntity.class, UpdateEntity.class }) + private String comment; + @EditableOnVmStatusField private int memSizeMb; @@ -204,6 +210,7 @@ VmOsType os, Date creationDate, String description, + String comment, int memSizeMb, int numOfSockets, int cpusPerSocket, @@ -237,6 +244,7 @@ this.os = os; this.creationDate = creationDate; this.description = description; + this.comment = comment; this.memSizeMb = memSizeMb; this.numOfSockets = numOfSockets; this.cpuPerSocket = cpusPerSocket; @@ -354,6 +362,14 @@ public void setDescription(String value) { this.description = value; + } + + public String getComment() { + return comment; + } + + public void setComment(String value) { + comment = value; } public int getMemSizeMb() { @@ -567,6 +583,7 @@ result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode()); result = prime * result + ((defaultBootSequence == null) ? 0 : defaultBootSequence.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((comment == null) ? 0 : comment.hashCode()); result = prime * result + ((domain == null) ? 0 : domain.hashCode()); result = prime * result + (failBack ? 1231 : 1237); result = prime * result + ((initrdUrl == null) ? 0 : initrdUrl.hashCode()); @@ -614,6 +631,7 @@ && ObjectUtils.objectsEqual(creationDate, other.creationDate) && defaultBootSequence == other.defaultBootSequence && ObjectUtils.objectsEqual(description, other.description) + && ObjectUtils.objectsEqual(comment, other.comment) && ObjectUtils.objectsEqual(domain, other.domain) && failBack == other.failBack && ObjectUtils.objectsEqual(initrdUrl, other.initrdUrl) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java index 095cf5b..19258b4 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java @@ -60,6 +60,7 @@ vmStatic.getOs(), vmStatic.getCreationDate(), vmStatic.getDescription(), + vmStatic.getComment(), vmStatic.getMemSizeMb(), vmStatic.getNumOfSockets(), vmStatic.getCpuPerSocket(), 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 01f2be2..3f1da1a 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 @@ -54,7 +54,12 @@ 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, VmOsType os, Guid vdsGroupId, Guid vmtGuid, String domain, int numOfMonitors, int status, int usbPolicy, String timeZone, boolean autoSuspend, int niceLevel, boolean failBack, BootSequence defaultBootSequence, VmType vmType, @@ -66,6 +71,7 @@ os, creationDate, description, + comment, memSizeMb, numOfSockets, cpuPerSocket, diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/AbstractVmRowMapper.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/AbstractVmRowMapper.java index 84d7e07..1926d4d 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/AbstractVmRowMapper.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/AbstractVmRowMapper.java @@ -20,6 +20,7 @@ protected final void map(final ResultSet rs, final T entity) throws SQLException { entity.setOs(VmOsType.forValue(rs.getInt("os"))); entity.setDescription(rs.getString("description")); + entity.setComment(rs.getString("comment")); entity.setCreationDate(DbFacadeUtils.fromDate(rs.getTimestamp("creation_date"))); entity.setNumOfSockets(rs.getInt("num_of_sockets")); entity.setCpuPerSocket(rs.getInt("cpu_per_socket")); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java index da73429..3df7da0 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java @@ -198,6 +198,7 @@ public void save(VM vm) { getCallsHandler().executeModification("InsertVm", getCustomMapSqlParameterSource() .addValue("description", vm.getDescription()) + .addValue("comment", vm.getVmComment()) .addValue("mem_size_mb", vm.getMemSizeMb()) .addValue("os", vm.getOs()) .addValue("vds_group_id", vm.getVdsGroupId()) @@ -305,6 +306,7 @@ entity.setVmtGuid(Guid.createGuidFromString(rs.getString("vmt_guid"))); entity.setVmOs(VmOsType.forValue(rs.getInt("vm_os"))); entity.setVmDescription(rs.getString("vm_description")); + entity.setVmComment(rs.getString("vm_comment")); entity.setVdsGroupId(Guid.createGuidFromString(rs.getString("vds_group_id"))); entity.setVmDomain(rs.getString("vm_domain")); entity.setVmCreationDate(DbFacadeUtils.fromDate(rs.getTimestamp("vm_creation_date"))); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java index 2e55799..649c9c5 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java @@ -43,6 +43,7 @@ private MapSqlParameterSource getFullParameterSource(VmStatic vm) { return getIdParamterSource(vm.getId()) .addValue("description", vm.getDescription()) + .addValue("comment", vm.getComment()) .addValue("mem_size_mb", vm.getMemSizeMb()) .addValue("os", vm.getOs()) .addValue("vds_group_id", vm.getVdsGroupId()) diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java index 607b33c..4d80601 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java @@ -129,6 +129,7 @@ .addValue("child_count", template.getChildCount()) .addValue("creation_date", template.getCreationDate()) .addValue("description", template.getDescription()) + .addValue("comment", template.getComment()) .addValue("mem_size_mb", template.getMemSizeMb()) .addValue("name", template.getName()) .addValue("num_of_sockets", template.getNumOfSockets()) diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResource.java index 71d1474..7c33f96 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResource.java @@ -75,7 +75,8 @@ // REVISIT: powershell has a IsVmTemlateWithSameNameExist safety check AddVmTemplateParameters params = new AddVmTemplateParameters(staticVm, template.getName(), - template.getDescription()); + template.getDescription(), + ""); boolean isDomainSet = false; if (template.isSetStorageDomain() && template.getStorageDomain().isSetId()) { params.setDestinationStorageDomainId(asGuid(template.getStorageDomain().getId())); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index 618198f..d7dec8d 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -222,6 +222,9 @@ @DefaultStringValue("Description") String descriptionVm(); + @DefaultStringValue("Comment") + String commentVm(); + @DefaultStringValue("Template") String templateVm(); @@ -312,6 +315,9 @@ @DefaultStringValue("Description") String descriptionVmPopup(); + + @DefaultStringValue("Comment") + String commentVmPopup(); @DefaultStringValue("Based on Template") String basedOnTemplateVmPopup(); @@ -701,6 +707,9 @@ @DefaultStringValue("Description") String descriptionTemplateGeneral(); + @DefaultStringValue("Comment") + String commentTemplateGeneral(); + @DefaultStringValue("Host Cluster") String hostClusterTemplateGeneral(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java index ac7e754..ad4ff16 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java @@ -134,6 +134,11 @@ @WithElementId("description") public EntityModelTextBoxEditor descriptionEditor; + @UiField + @Path(value = "comment.entity") + @WithElementId("comment") + public EntityModelTextBoxEditor commentEditor; + @UiField(provided = true) @Path(value = "template.selectedItem") @WithElementId("template") @@ -713,6 +718,7 @@ quotaEditor.setLabel(constants.quotaVmPopup()); nameLabel.setText(constants.nameVmPopup()); descriptionEditor.setLabel(constants.descriptionVmPopup()); + commentEditor.setLabel(constants.commentVmPopup()); templateEditor.setLabel(constants.basedOnTemplateVmPopup()); memSizeEditor.setLabel(constants.memSizeVmPopup()); totalvCPUsEditor.setLabel(constants.numOfVCPUs()); @@ -1074,6 +1080,7 @@ quotaEditor.setTabIndex(nextTabIndex++); nameEditor.setTabIndex(nextTabIndex++); descriptionEditor.setTabIndex(nextTabIndex++); + commentEditor.setTabIndex(nextTabIndex++); numOfVmsEditor.setTabIndex(nextTabIndex++); prestartedVmsEditor.setTabIndex(nextTabIndex++); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml index a0c5ecd..44766cb 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml @@ -225,6 +225,8 @@ <e:EntityModelTextBoxOnlyEditor ui:field="nameEditor" addStyleNames="{style.nameEditor}" contentWidgetStyleName="{style.nameEditorContent}"/> </g:FlowPanel> <e:EntityModelTextBoxEditor ui:field="descriptionEditor" /> + <e:EntityModelTextBoxEditor ui:field="commentEditor" /> + <!-- New VM Pool --> <e:EntityModelTextBoxEditor ui:field="numOfVmsEditor" /> diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/template/TemplateGeneralModelForm.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/template/TemplateGeneralModelForm.java index e819d6f..e5b6b51 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/template/TemplateGeneralModelForm.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/template/TemplateGeneralModelForm.java @@ -20,6 +20,7 @@ TextBoxLabel name = new TextBoxLabel(); TextBoxLabel description = new TextBoxLabel(); + TextBoxLabel comment = new TextBoxLabel(); TextBoxLabel hostCluster = new TextBoxLabel(); TextBoxLabel definedMemory = new TextBoxLabel(); TextBoxLabel oS = new TextBoxLabel(); @@ -50,9 +51,10 @@ formBuilder.setColumnsWidth("120px", "240px", "160px"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ formBuilder.addFormItem(new FormItem(constants.nameTemplateGeneral(), name, 0, 0)); formBuilder.addFormItem(new FormItem(constants.descriptionTemplateGeneral(), description, 1, 0)); - formBuilder.addFormItem(new FormItem(constants.hostClusterTemplateGeneral(), hostCluster, 2, 0)); - formBuilder.addFormItem(new FormItem(constants.osTemplateGeneral(), oS, 3, 0)); - formBuilder.addFormItem(new FormItem(constants.defaultDisTypeTemplateGeneral(), defaultDisplayType, 4, 0)); + formBuilder.addFormItem(new FormItem(constants.commentTemplateGeneral(), comment, 2, 0)); + formBuilder.addFormItem(new FormItem(constants.hostClusterTemplateGeneral(), hostCluster, 3, 0)); + formBuilder.addFormItem(new FormItem(constants.osTemplateGeneral(), oS, 4, 0)); + formBuilder.addFormItem(new FormItem(constants.defaultDisTypeTemplateGeneral(), defaultDisplayType, 5, 0)); formBuilder.addFormItem(new FormItem(constants.definedMemTemplateGeneral(), definedMemory, 0, 1)); formBuilder.addFormItem(new FormItem(constants.numOfCpuCoresTemplateGeneral(), cpuInfo, 1, 1)); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/vm/VmGeneralModelForm.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/vm/VmGeneralModelForm.java index 0bbf075..de685ec 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/vm/VmGeneralModelForm.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/vm/VmGeneralModelForm.java @@ -19,6 +19,7 @@ TextBoxLabel name = new TextBoxLabel(); TextBoxLabel description = new TextBoxLabel(); + TextBoxLabel comment = new TextBoxLabel(); TextBoxLabel quotaName = new TextBoxLabel(); TextBoxLabel template = new TextBoxLabel(); TextBoxLabel definedMemory = new TextBoxLabel(); @@ -51,10 +52,11 @@ formBuilder.setColumnsWidth("120px", "240px", "160px"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ formBuilder.addFormItem(new FormItem(constants.nameVm(), name, 0, 0)); formBuilder.addFormItem(new FormItem(constants.descriptionVm(), description, 1, 0)); - formBuilder.addFormItem(new FormItem(constants.templateVm(), template, 2, 0)); - formBuilder.addFormItem(new FormItem(constants.osVm(), oS, 3, 0)); - formBuilder.addFormItem(new FormItem(constants.defaultDisplayTypeVm(), defaultDisplayType, 4, 0)); - formBuilder.addFormItem(new FormItem(constants.priorityVm(), priority, 5, 0) { + formBuilder.addFormItem(new FormItem(constants.commentVm(), comment, 2, 0)); + formBuilder.addFormItem(new FormItem(constants.templateVm(), template, 3, 0)); + formBuilder.addFormItem(new FormItem(constants.osVm(), oS, 4, 0)); + formBuilder.addFormItem(new FormItem(constants.defaultDisplayTypeVm(), defaultDisplayType, 5, 0)); + formBuilder.addFormItem(new FormItem(constants.priorityVm(), priority, 6, 0) { @Override public boolean isVisible() { return getModel().getHasPriority(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java index ad4f3d6..5725cf8 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java @@ -177,6 +177,7 @@ vm.setVdsGroupName(instance.getVdsGroupName()); vm.setVmCreationDate(instance.getVmCreationDate()); vm.setVmDescription(instance.getVmDescription()); + vm.setVmComment(instance.getVmComment()); vm.setVmDomain(instance.getVmDomain()); vm.setId(instance.getId()); vm.setVmHost(instance.getVmHost()); @@ -408,6 +409,7 @@ obj.setCreationDate(instance.getCreationDate()); obj.setDedicatedVmForVds(instance.getDedicatedVmForVds()); obj.setDescription(instance.getDescription()); + obj.setComment(instance.getComment()); obj.setDomain(instance.getDomain()); obj.setAutoSuspend(instance.isAutoSuspend()); obj.setInitialized(instance.isInitialized()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateGeneralModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateGeneralModel.java index 4880a71..d8a7bc3 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateGeneralModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateGeneralModel.java @@ -79,6 +79,22 @@ } } + private String comment; + + public String getComment() + { + return comment; + } + + public void setComment(String value) + { + if (!StringHelper.stringsEqual(comment, value)) + { + comment = value; + OnPropertyChanged(new PropertyChangedEventArgs("Comment")); //$NON-NLS-1$ + } + } + private String quotaName; public String getQuotaName() { @@ -450,6 +466,7 @@ setName(template.getName()); setDescription(template.getDescription()); + setComment(template.getComment()); setQuotaName(template.getQuotaName() != null ? template.getQuotaName() : ""); //$NON-NLS-1$ setQuotaAvailable(template.getQuotaEnforcementType() != null && !template.getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED)); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java index 7786592..641fe6d 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java @@ -443,6 +443,7 @@ template.setNumOfMonitors((Integer) model.getNumOfMonitors().getSelectedItem()); template.setAllowConsoleReconnect((Boolean) model.getAllowConsoleReconnect().getEntity()); template.setDescription((String) model.getDescription().getEntity()); + template.setComment((String) model.getComment().getEntity()); template.setDomain(model.getDomain().getIsAvailable() ? (String) model.getDomain().getSelectedItem() : ""); //$NON-NLS-1$ template.setMemSizeMb((Integer) model.getMemSize().getEntity()); template.setMinAllocatedMem(((Integer) model.getMinAllocatedMemory().getEntity())); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java index 34d81fe..2451251 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java @@ -657,7 +657,8 @@ AddVmTemplateParameters addVmTemplateParameters = new AddVmTemplateParameters(newvm, (String) model.getName().getEntity(), - (String) model.getDescription().getEntity()); + (String) model.getDescription().getEntity(), + (String) model.getComment().getEntity()); addVmTemplateParameters.setPublicUse((Boolean) model.getIsTemplatePublic().getEntity()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java index ad3af1d..eaf59ad 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java @@ -114,6 +114,7 @@ // Update model state according to VM properties. getModel().getName().setEntity(vm.getName()); getModel().getDescription().setEntity(vm.getVmDescription()); + getModel().getComment().setEntity(vm.getVmComment()); getModel().getMemSize().setEntity(vm.getVmMemSizeMb()); getModel().getMinAllocatedMemory().setEntity(vm.getMinAllocatedMem()); getModel().getOSType().setSelectedItem(vm.getVmOs()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java index c61025f..715820f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java @@ -93,6 +93,7 @@ getCluster().setIsChangable(!value); getQuota().setIsChangable(false); getDescription().setIsChangable(false); + getComment().setIsChangable(false); getNumOfDesktops().setIsChangable(false); getPrestartedVms().setIsChangable(false); @@ -461,6 +462,18 @@ private void setDescription(NotChangableForVmInPoolEntityModel value) { privateDescription = value; + } + + private NotChangableForVmInPoolEntityModel privateComment; + + public EntityModel getComment() + { + return privateComment; + } + + private void setComment(NotChangableForVmInPoolEntityModel value) + { + privateComment = value; } private NotChangableForVmInPoolListModel privateDomain; @@ -1075,6 +1088,7 @@ setNumOfMonitors(new NotChangableForVmInPoolListModel()); setAllowConsoleReconnect(new NotChangableForVmInPoolEntityModel()); setDescription(new NotChangableForVmInPoolEntityModel()); + setComment(new NotChangableForVmInPoolEntityModel()); setDomain(new NotChangableForVmInPoolListModel()); setMinAllocatedMemory(new NotChangableForVmInPoolEntityModel()); setUsbPolicy(new NotChangableForVmInPoolListModel()); @@ -1967,6 +1981,11 @@ new LengthValidation(DESCRIPTION_MAX_LIMIT), new SpecialAsciiI18NOrNoneValidation() }); + getComment().ValidateEntity( + new IValidation[] { + new LengthValidation(DESCRIPTION_MAX_LIMIT), + new SpecialAsciiI18NOrNoneValidation() + }); boolean is64OsType = (osType == VmOsType.Other || osType == VmOsType.OtherLinux || AsyncDataProvider.Is64bitOsType(osType)); @@ -2026,9 +2045,9 @@ setIsFirstRunTabValid(getIsDisplayTabValid()); setIsGeneralTabValid(getIsFirstRunTabValid()); - setIsGeneralTabValid(getName().getIsValid() && getDescription().getIsValid() && getDataCenter().getIsValid() - && getTemplate().getIsValid() && getCluster().getIsValid() && getMemSize().getIsValid() - && getMinAllocatedMemory().getIsValid()); + setIsGeneralTabValid(getName().getIsValid() && getDescription().getIsValid() && getComment().getIsValid() + && getDataCenter().getIsValid() && getTemplate().getIsValid() && getCluster().getIsValid() + && getMemSize().getIsValid() && getMinAllocatedMemory().getIsValid()); setIsFirstRunTabValid(getDomain().getIsValid() && getTimeZone().getIsValid()); setIsDisplayTabValid(getUsbPolicy().getIsValid() && getNumOfMonitors().getIsValid()); @@ -2037,7 +2056,8 @@ setIsBootSequenceTabValid(getCdImage().getIsValid() && getKernel_path().getIsValid()); setIsCustomPropertiesTabValid(customPropertySheetValid); - return getName().getIsValid() && getDescription().getIsValid() && getDataCenter().getIsValid() + return getName().getIsValid() && getDescription().getIsValid() && getComment().getIsValid() + && getDataCenter().getIsValid() && getDisksAllocationModel().getIsValid() && getTemplate().getIsValid() && getCluster().getIsValid() && getDefaultHost().getIsValid() && getMemSize().getIsValid() && getMinAllocatedMemory().getIsValid() && getNumOfMonitors().getIsValid() && getDomain().getIsValid() && getUsbPolicy().getIsValid() diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGeneralModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGeneralModel.java index 710370b..9f3b84c 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGeneralModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGeneralModel.java @@ -83,6 +83,19 @@ } } + private String comment; + + public String getComment() { + return comment; + } + + public void setComment(String value) { + if (!StringHelper.stringsEqual(comment, value)) { + comment = value; + OnPropertyChanged(new PropertyChangedEventArgs("Comment")); //$NON-NLS-1$ + } + } + private String template; public String getTemplate() @@ -589,6 +602,7 @@ setName(vm.getName()); setDescription(vm.getVmDescription()); + setComment(vm.getVmComment()); setQuotaName(vm.getQuotaName() != null ? vm.getQuotaName() : ""); //$NON-NLS-1$ setQuotaAvailable(vm.getQuotaEnforcementType() != null && !vm.getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED)); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java index 103d8fe..07db760 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java @@ -1779,7 +1779,8 @@ AddVmTemplateParameters addVmTemplateParameters = new AddVmTemplateParameters(newvm, (String) model.getName().getEntity(), - (String) model.getDescription().getEntity()); + (String) model.getDescription().getEntity(), + (String) model.getComment().getEntity()); addVmTemplateParameters.setPublicUse((Boolean) model.getIsTemplatePublic().getEntity()); addVmTemplateParameters.setDiskInfoDestinationMap( @@ -2313,6 +2314,7 @@ getcurrentVm().setNumOfMonitors((Integer) model.getNumOfMonitors().getSelectedItem()); getcurrentVm().setAllowConsoleReconnect((Boolean) model.getAllowConsoleReconnect().getEntity()); getcurrentVm().setVmDescription((String) model.getDescription().getEntity()); + getcurrentVm().setVmComment((String) model.getComment().getEntity()); getcurrentVm().setVmDomain(model.getDomain().getIsAvailable() ? (String) model.getDomain().getSelectedItem() : ""); //$NON-NLS-1$ getcurrentVm().setVmMemSizeMb((Integer) model.getMemSize().getEntity()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java index 52f5a61..51745c3 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java @@ -546,6 +546,7 @@ getcurrentVm().setVmOs((VmOsType) model.getOSType().getSelectedItem()); getcurrentVm().setNumOfMonitors((Integer) model.getNumOfMonitors().getSelectedItem()); getcurrentVm().setVmDescription((String) model.getDescription().getEntity()); + getcurrentVm().setVmComment((String) model.getComment().getEntity()); getcurrentVm().setVmDomain(model.getDomain().getIsAvailable() ? (String) model.getDomain().getSelectedItem() : ""); //$NON-NLS-1$ getcurrentVm().setVmMemSizeMb((Integer) model.getMemSize().getEntity()); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java index c6740c3..2ba34aa 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java @@ -1457,6 +1457,9 @@ @DefaultStringValue("Description") String descriptionTemplate(); + @DefaultStringValue("Comment") + String commentTemplate(); + @DefaultStringValue("Edit") String editTemplate(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabTemplateView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabTemplateView.java index 56bc056..c2b922b 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabTemplateView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabTemplateView.java @@ -84,6 +84,14 @@ }; getTable().addColumn(descriptionColumn, constants.descriptionTemplate(), "150px"); //$NON-NLS-1$ + TextColumnWithTooltip<VmTemplate> commentColumn = new TextColumnWithTooltip<VmTemplate>() { + @Override + public String getValue(VmTemplate object) { + return object.getComment(); + } + }; + getTable().addColumn(commentColumn, constants.commentTemplate(), "150px"); //$NON-NLS-1$ + getTable().addActionButton(new WebAdminButtonDefinition<VmTemplate>(constants.editTemplate()) { @Override protected UICommand resolveCommand() { -- To view, visit http://gerrit.ovirt.org/14319 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib56cfbaf618eee10631eb91923733fbe4e52f45c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Noam Slomianko <nslom...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches