Bug 1387838

Summary: KVM Import fails when libvirtd qemu+tcp URI is used, with no user/password entered.
Product: [oVirt] ovirt-engine Reporter: ling
Component: Backend.CoreAssignee: Tomáš Golembiovský <tgolembi>
Status: CLOSED DUPLICATE QA Contact: meital avital <mavital>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0.4.4CC: bugs, michal.skrivanek, tjelinek
Target Milestone: ovirt-4.1.0-alphaFlags: tjelinek: ovirt-4.1?
rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-18 11:53:13 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:

Description ling 2016-10-22 11:15:10 UTC
Description of problem:
Trying to import VMs from a KVM node using a URI like this: qemu+tcp://vmserver2-safari/system, Required Authentication unchecked, and nothing entered in user and password field. I have set libvirtd on the KVM end to use tcp with no authentication. Verified connection works.

However, receive these errors when I picked a VM to import:

2016-10-22 09 (tel:2016102209):49:29,300 INFO [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (pool-7-thread-2) [d38191] Correlation ID: d38191, Call Stack: null, Custom Event ID: -1, Message: Starting to convert Vm ks-safari
2016-10-22 09 (tel:2016102209):49:52,846 INFO [org.ovirt.engine.core.bll.exportimport.ConvertVmCallback] (DefaultQuartzScheduler1) [76a0f17f] Conversion of VM from exteral enironment failed: must be string or buffer, not None

After looking at the log more closely, and search the net for the  ConvertVmVDSCommand, I cam to this: 

https://gerrit.ovirt.org/#/c/33055/100..100/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConvertVmVDSCommand.java

@Override
protected void executeVdsBrokerCommand() {
status = getBroker().convertVmFromExternalSystem(
getParameters().getUrl(),
getParameters().getUsername(),
getParameters().getPassword(),
createVmProperties(),
getParameters().getVmId().toString());

So, I thought let me try again and leave "Required Authentication" checked, and enter a user and password, even though libvirtd on the KVM side doesn't need user/password. A wild guess, and but this workaround worked.

Also noticed there are couple of typos in the error message:

"Conversion of VM from exteral enironment failed: must be string or buffer, not None"


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.Go to Virtual Machines
2.Select Import
3.Select Source KVM (via Libvirt)
4.Enter a URI like this: qemu+tcp://vmserver2-safari/system
5. Uncheck "Required password" and leave user and password fields blank.
6. The KVM end has to be set up to allow tcp, and none for authentication.
7. Click Load
8. Pick a VM to import
9. Error occurs after a few minutes. 

Actual results:
The Alert screen on the GUI shows this "Failed to import Vm ks-safari to Data Center Safari_Lab, Cluster Default"

Expected results:
VM gets imported after disk image get copied and converted.

Additional info:
It should detect that "Required Authentication" is unchecked, and therefore handler the blank user and password fields properly.

Comment 1 Tomas Jelinek 2016-11-09 11:23:20 UTC
I'd say that in v2v.py the _password_file expects the os.write(fd, self._password.value) to have the _password.value not None. 
It looks like this has never been working.

Comment 2 Tomáš Golembiovský 2016-11-16 15:43:25 UTC
(In reply to Tomas Jelinek from comment #1)
> I'd say that in v2v.py the _password_file expects the os.write(fd,
> self._password.value) to have the _password.value not None. 
> It looks like this has never been working.

I can confirm the problem. This will be fixed.

For now, as a workaround for password-less connections do the following:
1) check 'requires authetication' box
2) put something into username and password text fields; anything like "abcd" or "12345" is ok, the values will be ignored

Comment 3 ling 2016-11-17 08:42:45 UTC
Thanks for looking at the bug and fixing it!

Comment 4 Tomas Jelinek 2016-11-18 11:53:13 UTC
the root cause of this is the same as 
https://bugzilla.redhat.com/show_bug.cgi?id=1388596
hence closing this one as duplicate to track the same issue on one place only.

*** This bug has been marked as a duplicate of bug 1388596 ***