Bug 1277741 - Error converting VMware vCloud VM (with name containing spaces and parenthesis) via bash script
Summary: Error converting VMware vCloud VM (with name containing spaces and parenthesi...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: libguestfs
Version: rawhide
Hardware: Unspecified
OS: Other
unspecified
high
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: V2V
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-04 00:03 UTC by Alessandro
Modified: 2015-11-06 16:11 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1277738
Environment:
Last Closed: 2015-11-06 16:11:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alessandro 2015-11-04 00:03:50 UTC
While running bash script:

#!/bin/bash
export LIBGUESTFS_BACKEND=direct

# Declare all VMs to import
VMWAREVMS=("conversion-test-vm (43f00f9c-276b-4bc7-9c2f-66c41824960e)")

# Iterate through each VMware VM, performing the conversion
for vm in "${VMWAREVMS[@]}"
do
virt-v2v -ic vpx://DOMAIN%5cUSERNAME@vCenterServerName/DC/Logical%20Folder/Cluster/ESXiHostName/?no_verify=1 -o libvirt -os virtimages $vm --password-file /tmp/passwd
done

ERROR:
[root@CENTOS7 Scripts]# ./Virt-V2V-Script.sh
VM name is: conversion-test-vm (43f00f9c-276b-4bc7-9c2f-66c41824960e)
virt-v2v: error: expecting a libvirt guest name on the command line

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

DEBUG INFO:
[root@CENTOS7 Scripts]# ./Virt-V2V-Script.sh
VM name is: conversion-test-vm (43f00f9c-276b-4bc7-9c2f-66c41824960e)
2015-11-04 00:02:33.179+0000: 6230: info : libvirt version: 1.2.17, package: 1.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2015-07-02-03:38:08, x86-024.build.eng.bos.redhat.com)
2015-11-04 00:02:33.179+0000: 6230: debug : virGlobalInit:389 : register drivers
2015-11-04 00:02:33.179+0000: 6230: debug : virRegisterConnectDriver:691 : driver=0x7f3bc4489620 name=Test
2015-11-04 00:02:33.179+0000: 6230: debug : virRegisterConnectDriver:702 : registering Test as driver 0
2015-11-04 00:02:33.179+0000: 6230: debug : virRegisterConnectDriver:691 : driver=0x7f3bc448b240 name=ESX
2015-11-04 00:02:33.179+0000: 6230: debug : virRegisterConnectDriver:702 : registering ESX as driver 1
2015-11-04 00:02:33.179+0000: 6230: debug : virRegisterConnectDriver:691 : driver=0x7f3bc448a0a0 name=remote
2015-11-04 00:02:33.179+0000: 6230: debug : virRegisterConnectDriver:702 : registering remote as driver 2
virt-v2v: error: expecting a libvirt guest name on the command line

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

ESXi host and vCenter Server version 5.5.

Libirt version:
libvirt-client-1.2.17-1.el7.x86_64

Virt-v2v version:
virt-v2v-1.28.1-1.48.el7.x86_64

Many Thanks!

Comment 1 Alessandro 2015-11-05 21:33:25 UTC
As an additional info.
If I run the same command from terminal instead of using the bash script the conversion works just fine.

Command from terminal:

virt-v2v -ic vpx://DOMAIN%5cUSERNAME@vCenterServerName/DC/Logical%20Folder/Cluster/ESXiHostName/?no_verify=1 -o libvirt -os virtimages "conversion-test-vm (43f00f9c-276b-4bc7-9c2f-66c41824960e)" --password-file /tmp/passwd

Comment 2 Pino Toscano 2015-11-06 11:48:20 UTC
(In reply to Alessandro from comment #0)
> #!/bin/bash
> export LIBGUESTFS_BACKEND=direct
> 
> # Declare all VMs to import
> VMWAREVMS=("conversion-test-vm (43f00f9c-276b-4bc7-9c2f-66c41824960e)")
> 
> # Iterate through each VMware VM, performing the conversion
> for vm in "${VMWAREVMS[@]}"
> do
> virt-v2v -ic
> vpx://DOMAIN%5cUSERNAME@vCenterServerName/DC/Logical%20Folder/Cluster/
> ESXiHostName/?no_verify=1 -o libvirt -os virtimages $vm --password-file
> /tmp/passwd
> done

You need to quote $vm here, otherwise the different words in the variable will be passed as different arguments. Hence:

  virt-v2v -ic vpx://DOMAIN%5cUSERNAME@vCenterServerName/DC/Logical%20Folder/Cluster/ESXiHostName/?no_verify=1 -o libvirt -os virtimages "$vm" --password-file /tmp/passwd

Comment 3 Alessandro 2015-11-06 15:59:18 UTC
Hi Pino,
tried that as well and just ran again to double check.
Still same issue:
[root@CENTOS7 Scripts]# ./Test.sh
VM name is: conversion-test-vm2 (f97c63bc-e711-4281-bb57-627c86e06b18)
virt-v2v: error: expecting a libvirt guest name on the command line

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

Test.sh body:
#!/bin/bash
export LIBGUESTFS_BACKEND=direct

# Declare all VMs to import
VMWAREVMS=("conversion-test-vm (43f00f9c-276b-4bc7-9c2f-66c41824960e)")

# Iterate through each VMware VM, performing the conversion
for vm in "${VMWAREVMS[@]}"
do
virt-v2v -ic vpx://DOMAIN%5cUSERNAME@vCenterServerName/DC/Logical%20Folder/Cluster/ESXiHostName/?no_verify=1 -o libvirt -os virtimages "$vm" --password-file /tmp/passwd
done

Comment 4 Alessandro 2015-11-06 16:06:53 UTC
(In reply to Alessandro from comment #3)
> Hi Pino,
> tried that as well and just ran again to double check.
> Still same issue:
> [root@CENTOS7 Scripts]# ./Test.sh
> VM name is: conversion-test-vm2 (f97c63bc-e711-4281-bb57-627c86e06b18)
> virt-v2v: error: expecting a libvirt guest name on the command line
> 
> If reporting bugs, run virt-v2v with debugging enabled and include the 
> complete output:
> 
>   virt-v2v -v -x [...]
> 
> Test.sh body:
> #!/bin/bash
> export LIBGUESTFS_BACKEND=direct
> 
> # Declare all VMs to import
> VMWAREVMS=("conversion-test-vm (43f00f9c-276b-4bc7-9c2f-66c41824960e)")
> 
> # Iterate through each VMware VM, performing the conversion
> for vm in "${VMWAREVMS[@]}"
> do
> virt-v2v -ic
> vpx://DOMAIN%5cUSERNAME@vCenterServerName/DC/Logical%20Folder/Cluster/
> ESXiHostName/?no_verify=1 -o libvirt -os virtimages "$vm" --password-file
> /tmp/passwd
> done

Pino,
never mind.
I have checked the body for hidden escapes and there was a space between "?" and "no_verify=1". Like follows:

"? no_verify=1".

Problem solved.

You can close this case.

Thanks!

Comment 5 Pino Toscano 2015-11-06 16:11:46 UTC
OK, closing then per comment #4 and comment #4.


Note You need to log in before you can comment on or make changes to this bug.