Configure:
1. starting VNC service on esxi
enable VNC service on Firewall in each ESXI Host.
like this:
~ # cd /etc/vmware/firewall
/etc/vmware/firewall # vi vnc.xml
<!--Config for VNC-->
<ConfigRoot>
<service>
<id>VNC</id>
<rule id='0000'>
<direction>inbound</direction>
<protocol>tcp</protocol>
<porttype>dst</porttype>
<port>
<begin>5901</begin>
<end>5999</end>
</port>
</rule>
<rule id='0001'>
<direction>outbound</direction>
<protocol>tcp</protocol>
<porttype>dst</porttype>
<port>
<begin>0</begin>
<end>65535</end>
</port>
</rule>
<enabled>true</enabled>
<required>false</required>
</service>
</ConfigRoot>
/etc/vmware/firewall # cd
~ # esxcli network firewall refresh
~ # esxcli network firewall ruleset list|grep VNC
VNC true
~ #
2. adding config vnc Task into workflow after creating a VM.
Programming:
1. using fenced:userAPIGetVNCURL api to get novnc's visiting url.