Bug 1576382

Summary: no VM name validation on import from OVF
Product: [oVirt] ovirt-engine Reporter: Michal Skrivanek <michal.skrivanek>
Component: BLL.VirtAssignee: Shmuel Melamud <smelamud>
Status: CLOSED CURRENTRELEASE QA Contact: Liran Rotenberg <lrotenbe>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.3CC: bugs, kkulkarn, lrotenbe
Target Milestone: ovirt-4.2.4Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: v2v
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-26 08:42:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1574666, 1581742    

Description Michal Skrivanek 2018-05-09 10:35:35 UTC
Seems we do not validate VM name when using ImportVmFromConfiguration, see bug 1574666

Comment 1 Michal Skrivanek 2018-05-28 15:51:21 UTC
*** Bug 1581749 has been marked as a duplicate of this bug. ***

Comment 2 Liran Rotenberg 2018-06-14 11:25:09 UTC
Verified on:
ovirt-engine-4.2.4.2-0.1.el7_3.noarch
vdsm-4.20.30-1.el7ev.x86_64
libvirt-3.9.0-14.el7_5.6.x86_64
virt-v2v-1.36.10-6.10.rhvpreview.el7ev.x86_64

Steps of verification:
1. Create a VM with special chars in the name on VMWare(e.g vm_!@#$%_$_special_chars)
2. Import the VM via REST

Result:
Importing the VM failed as expected:
2018-06-13 16:34:25,264+03 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.GetVmsFullInfoFromExternalProviderVDSCommand] (default task-29) [externalvmimports_create_c55bc931-00] FINISH, GetVmsFullInfoFromExtern
alProviderVDSCommand, return: [VM [vm_!@#$%_$_special_chars]], log id: 17682cd6
2018-06-13 16:34:25,332+03 WARN  [org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand] (default task-29) [3b1bb8f9] Validation of action 'ImportVmFromExternalProvider' failed for user admi
n@internal-authz. Reasons: VAR__ACTION__IMPORT,VAR__TYPE__VM,ACTION_TYPE_FAILED_NAME_MAY_NOT_CONTAIN_SPECIAL_CHARS,$message ACTION_TYPE_FAILED_NAME_MAY_NOT_CONTAIN_SPECIAL_CHARS,$payload [Ljava.lang.Class;@2224e
63e,$groups [Ljava.lang.Class;@532bad96,ACTION_TYPE_FAILED_ATTRIBUTE_PATH,$path vm.vmStatic.name,$validatedValue vm_!@#$%_$_special_chars
2018-06-13 16:34:25,351+03 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-29) [] Operation Failed: [Can not import VM. The given name contains special characters. Only lower-
case and upper-case letters, numbers, '_', '-', '.' are allowed., Attribute: vm.vmStatic.name]

Comment 3 Sandro Bonazzola 2018-06-26 08:42:24 UTC
This bugzilla is included in oVirt 4.2.4 release, published on June 26th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.4 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.