Bug 1562602

Summary: VM with special characters failed to start
Product: [oVirt] ovirt-engine Reporter: Nisim Simsolo <nsimsolo>
Component: BLL.VirtAssignee: Andrej Krejcir <akrejcir>
Status: CLOSED CURRENTRELEASE QA Contact: meital avital <mavital>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2.2CC: akrejcir, bugs, michal.skrivanek, mzamazal, nsimsolo, rbarry, tbaransk
Target Milestone: ovirt-4.3.0Flags: rule-engine: ovirt-4.3+
Target Release: 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.3.0_alpha Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-13 07:46:48 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:
Attachments:
Description Flags
engine.log
none
vdsm.log none

Description Nisim Simsolo 2018-04-01 11:52:09 UTC
Description of problem:
Trying to run the next VM which was imported from VMware and include special characters:  
centos44%/\&+=?!@#$^*()[]
failed with the next engine.log error:

2018-04-01 14:22:29,946+03 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedThreadFactory-engineScheduled-Thread-67) [] EVENT_ID: VM_DOWN_ERROR(119), VM centos44%/\&+=?!@#$^*()[]1 is down with error. Exit message: (domain_definition):2: xmlParseEntityRef: no name
  <name>centos44%/\&+=?!@#$^*()[]1</name>

- another issue with it is that in RHV, only the next special chars are valid: "." "," "_" "-"
and importing from external provider is allowing other chars to be included in VM name.

- Removing these chars from VM name is solving the "running VM" issue. 
- At the past there were no issues with running such VM.

Version-Release number of selected component (if applicable):
rhvm-4.2.2.6-0.1.el7
libvirt-client-3.9.0-14.el7_5.2.x86_64
qemu-kvm-rhev-2.10.0-21.el7_5.1.x86_64
sanlock-3.6.0-1.el7.x86_64
vdsm-4.20.23-1.el7ev.x86_64
virt-v2v-1.36.10-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Import VM with special chars from external provider.
2. Run VM
3.

Actual results:
VM failed to start.

Expected results:
VM should run, or an appropriate message related to these chars should appear.

Additional info:
engine.log and vdsm.log attached

Comment 1 Nisim Simsolo 2018-04-01 11:53:51 UTC
Created attachment 1415790 [details]
engine.log

Comment 2 Nisim Simsolo 2018-04-01 11:54:13 UTC
Created attachment 1415791 [details]
vdsm.log

Comment 3 Michal Skrivanek 2018-04-16 12:49:10 UTC
can you try that?

Comment 4 Milan Zamazal 2018-04-16 14:20:01 UTC
I could observe at least three problems:

- libvirt doesn't permit `/' character in VM name.
- `&' is not escaped when passed for the first time to libvirt, so an invalid XML is provided to libvirt.
- The second libvirt defineXML call fails, apparently due to changed VM name, perhaps escaping is applied this time.

So it looks like at least one XML escaping problem in Vdsm (XML received from Engine looks OK) and the libvirt constraint on `/'.

Comment 5 Michal Skrivanek 2018-04-16 15:02:10 UTC
we'll see if there is anything to backport, hopefully it's not going to be a problem

Comment 7 Ryan Barry 2018-11-01 18:12:04 UTC
After speaking with Milan/Michal, let's also run it through validation in the engine.

Andrej, can you pick it up from there?

Comment 8 meital avital 2018-11-21 15:23:54 UTC
I'm not sure what is the expected behavior now in order to verify this bug. 
The current behavior when trying to import VM named: RHEL7_2-invalid-name-44%/\&+=?!@#$^*()[]:
is:
the second import dialog rejects the action when clicking "ok" button with the next "operation canceled" pop-up message: 

Error while executing action: 
"
RHEL7_2-invalid-name-44%/\&+=?!@#$^*()[]:
Can not import VM. The given name contains special characters. Only lower-case and upper-case letters, numbers, '_', '-', '.' are allowed.
Attribute: vm.vmStatic.name
"

Is that the expected behavior in such case?

Comment 9 Andrej Krejcir 2018-11-21 15:36:39 UTC
Yes, that is expected. It should not be possible to import a VM with invalid name, using UI or API.

Maybe we could improve the UI, if the popup is too inconvenient, but it works.

Comment 10 Sandro Bonazzola 2018-11-26 15:37:11 UTC
Referenced in vdsm v4.30.3 despite this bug is on ovirt-engine

Comment 11 Milan Zamazal 2018-11-26 16:03:56 UTC
There were fixes in both Vdsm and Engine.

Comment 12 meital avital 2018-11-28 09:57:05 UTC
Verified on:
ovirt-engine-4.3.0-0.2.master.20181121071050.gita8fcd23.el7.noarch

Comment 13 Sandro Bonazzola 2019-02-13 07:46:48 UTC
This bugzilla is included in oVirt 4.3.0 release, published on February 4th 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.0 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.