ovftool命令参考
ovftool --X:logFile=upload1.log --X:logLevel=verbose --noSSLVerify vi://[user]:[pass]@[ESXi IP]:[port]/my_datacenter/vm/my_vm_folder/my_vm_name /tmp/test.OVF
实际操作步骤:
C:\Program Files\VMware\VMware OVF Tool>ovftool --X:logFile=d:\upload1.log --X:logLevel=verbose --noSSLVerify vi://root:@10.20.30.40/dandianscm d:\
Error: cURL error: SSL connect error
Completed with errors
C:\Program Files\VMware\VMware OVF Tool>
查看日志文件:
2019-05-12T14:38:51.681+08:00 verbose -[11392] [Originator@6876 sub=Default] [SSL_DB] Using C:\Users\haoxutao\AppData\Roaming\VMware\ovftool_SSLDB as SSL DB
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] Subscribing to signal: 2 (SIGINT)
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] Subscribing to signal: 4 (SIGILL)
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] Subscribing to signal: 22 (SIGABRT)
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] Subscribing to signal: 8 (SIGFPE)
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] Subscribing to signal: 15 (SIGTERM)
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] Initializing progress
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] OvfTool Version: VMware ovftool 4.1.0 (build-2459827)
2019-05-12T14:38:51.693+08:00 verbose -[11392] [Originator@6876 sub=Default] Using home directory: C:\Users\haoxutao\AppData\Roaming\VMware\ovftool.cfg
2019-05-12T14:38:51.699+08:00 verbose -[11392] [Originator@6876 sub=Default] Curl Version: 7.30.0
2019-05-12T14:38:51.699+08:00 verbose -[11392] [Originator@6876 sub=Default] Done initializing libs
2019-05-12T14:38:51.699+08:00 verbose -[11392] [Originator@6876 sub=Default] Determining source
2019-05-12T14:38:51.699+08:00 verbose -[11392] [Originator@6876 sub=Default] Determining target
2019-05-12T14:38:51.699+08:00 verbose -[11392] [Originator@6876 sub=Default] Getting source
2019-05-12T14:38:51.699+08:00 verbose -[11392] [Originator@6876 sub=Default] Getting vi source
2019-05-12T14:38:51.700+08:00 verbose -[11392] [Originator@6876 sub=Default] Connecting to vi host
2019-05-12T14:38:51.700+08:00 verbose -[11392] [Originator@6876 sub=Default] Skip SSL verification
2019-05-12T14:38:51.700+08:00 verbose -[11392] [Originator@6876 sub=HttpConnectionPool-000000] HttpConnectionPoolImpl created. maxPoolConnections = 20; idleTimeout = 900000000; maxOpenConnections = 20; maxConnectionAge = 0
2019-05-12T14:38:51.700+08:00 verbose -[11392] [Originator@6876 sub=Default] Getting version of the VI host : 10.20.30.40
2019-05-12T14:38:51.700+08:00 verbose -[11392] [Originator@6876 sub=Default] Initializing new curl session
2019-05-12T14:38:51.704+08:00 verbose -[11392] [Originator@6876 sub=Default] WebRequest set basic http authorization, username : root
2019-05-12T14:38:51.704+08:00 verbose -[11392] [Originator@6876 sub=Default] Getting http page: https://10.20.30.40/sdk/vimServiceVersions.xml
2019-05-12T14:38:51.718+08:00 verbose -[07436] [Originator@6876 sub=Default] Curl_perform error code 35 (SSL connect error)
2019-05-12T14:38:51.718+08:00 verbose -[11392] [Originator@6876 sub=Default] CURL error buffer: Unknown SSL protocol error in connection to 10.20.30.40:443
2019-05-12T14:38:51.718+08:00 verbose -[11392] [Originator@6876 sub=Default] Curl session torn down
2019-05-12T14:38:51.721+08:00 verbose -[11392] [Originator@6876 sub=Default] Backtrace:
-->
--> [backtrace begin] product: VMware Workstation, version: e.x.p, build: build-2444548, tag: -
--> backtrace[00] vmacore.dll[0x001BBC9A]
--> backtrace[01] vmacore.dll[0x0005D18F]
--> backtrace[02] vmacore.dll[0x0005E3CE]
--> backtrace[03] vmacore.dll[0x00012C5B]
--> backtrace[04] ovftool.exe[0x0009025F]
--> backtrace[05] ovftool.exe[0x000AE63F]
--> backtrace[06] ovftool.exe[0x000AEA1A]
--> backtrace[07] ovftool.exe[0x000E4DFA]
--> backtrace[08] ovftool.exe[0x000E5626]
--> backtrace[09] ovftool.exe[0x000E60A4]
--> backtrace[10] ovftool.exe[0x0002B89F]
--> backtrace[11] ovftool.exe[0x00074D17]
--> backtrace[12] ovftool.exe[0x000755C4]
--> backtrace[13] ovftool.exe[0x00307F46]
--> backtrace[14] KERNEL32.DLL[0x00017974]
--> backtrace[15] ntdll.dll[0x0006A271]
--> [backtrace end]
-->
错误原因经查询为版本问题
C:\Program Files\VMware\VMware OVF Tool>ovftool.exe -v
VMware ovftool 4.1.0 (build-2459827)
C:\Program Files\VMware\VMware OVF Tool>
升级为4.3,一台机器已OK
C:\Program Files\VMware\VMware OVF Tool>ovftool.exe -v
VMware ovftool 4.3.0 (build-7948156)
C:\Program Files\VMware\VMware OVF Tool>
另外一台机器,继续导出报错,报错内容为:
C:\Program Files\VMware\VMware OVF Tool>ovftool --X:logFile=d:\vmware\upload1.log --X:logLevel=verbose --noSSLVerify vi://root:@10.20.30.40/backup d:\vmware
Enter login information for source vi://10.20.30.40/
Username: root
Password: **********
Error: Could not lookup host: root
Completed with errors
C:\Program Files\VMware\VMware OVF Tool
查看日志文件
2019-05-12T15:07:04.682+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] [SSL_DB] Using C:\Users\Administrator\AppData\Roaming\VMware\ovftool_SSLDB as SSL DB
2019-05-12T15:07:04.783+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Subscribing to signal: 2 (SIGINT)
2019-05-12T15:07:04.783+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Subscribing to signal: 4 (SIGILL)
2019-05-12T15:07:04.783+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Subscribing to signal: 22 (SIGABRT)
2019-05-12T15:07:04.783+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Subscribing to signal: 8 (SIGFPE)
2019-05-12T15:07:04.783+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Subscribing to signal: 15 (SIGTERM)
2019-05-12T15:07:04.783+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Initializing progress
2019-05-12T15:07:04.783+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] OvfTool Version: VMware ovftool 4.3.0 (build-7948156)
2019-05-12T15:07:04.784+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Using home directory: C:\Users\Administrator\AppData\Roaming\VMware\ovftool.cfg
2019-05-12T15:07:04.791+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Curl Version: 7.58.0
2019-05-12T15:07:04.791+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Done initializing libs
2019-05-12T15:07:04.791+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Determining source
2019-05-12T15:07:04.791+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Determining target
2019-05-12T15:07:04.792+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Getting source
2019-05-12T15:07:04.792+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Getting vi source
2019-05-12T15:07:04.792+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Constructing URL...
2019-05-12T15:07:04.792+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Resolving host name root...
2019-05-12T15:07:16.369+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Failed to lookup host: root, error code: 11001
2019-05-12T15:07:16.377+08:00 verbose OVFTool[10456] [Originator@6876 sub=Default] Backtrace:
--> [backtrace begin] product: VMware Workstation, version: e.x.p, build: build-7948156, tag: OVFTool, cpu: x86_64, os: windows, buildType: release
--> backtrace[00] vmacore.dll[0x001F59FA]
--> backtrace[01] vmacore.dll[0x00064E70]
--> backtrace[02] vmacore.dll[0x0006763E]
--> backtrace[03] vmacore.dll[0x000254AC]
--> backtrace[04] ovftool.exe[0x00013FB6]
--> backtrace[05] ovftool.exe[0x000A886F]
--> backtrace[06] ovftool.exe[0x000FBA1A]
--> backtrace[07] ovftool.exe[0x0012C82D]
--> backtrace[08] ovftool.exe[0x00128F6F]
--> backtrace[09] ovftool.exe[0x0003F1B0]
--> backtrace[10] ovftool.exe[0x000DA8DD]
--> backtrace[11] ovftool.exe[0x000DB624]
--> backtrace[12] ovftool.exe[0x00382845]
--> backtrace[13] kernel32.dll[0x000159CD]
--> backtrace[14] ntdll.dll[0x0002A561]
--> [backtrace end]
可能原因处理,更改主机名称,登录esxi控制台
[root@localhost:~] esxcfg-advcfg -s ESX02 /Misc/hostname
Value of HostName is ESX02
[root@ESX02:~]
改名参考文档:
https://kb.vmware.com/s/article/1010821?lang=zh_CN
继续测试还是不行:
然后参考这个文档:https://communities.vmware.com/thread/594406
运行下面报错:
ovftool --X:logFile=d:\vmware\upload1.log --X:logLevel=verbose --noSSLVerify vi://root:cFnD_MNi#ba@10.20.30.40
运行这个不报错:
ovftool --X:logFile=d:\vmware\upload1.log --X:logLevel=verbose --noSSLVerify vi://root:abc123@10.20.30.40
显然ovftool无法处理密码中的特殊字符。有没有办法绕过这个而不改变root密码?
处理办法:对密码进行URL编码,就像这样
ovftool --X:logFile=d:\vmware\upload1.log --X:logLevel=verbose --noSSLVerify vi://root:cFnD_MNi%23ba@10.20.30.40 /dandianscm d:\vmware
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/312079/viewspace-2644071/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/312079/viewspace-2644071/