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!
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
(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
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
(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!
OK, closing then per comment #4 and comment #4.