Bug 1277741 - Error converting VMware vCloud VM (with name containing spaces and parenthesis) via bash script
Error converting VMware vCloud VM (with name containing spaces and parenthesi...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: libguestfs (Show other bugs)
rawhide
Unspecified Other
unspecified Severity high
: ---
: ---
Assigned To: Richard W.M. Jones
Fedora Extras Quality Assurance
V2V
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-03 19:03 EST by Alessandro
Modified: 2015-11-06 11:11 EST (History)
14 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1277738
Environment:
Last Closed: 2015-11-06 11:11:46 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alessandro 2015-11-03 19:03:50 EST
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 16:33:25 EST
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 06:48:20 EST
(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 10:59:18 EST
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 11:06:53 EST
(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 11:11:46 EST
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.