Environment Python 2.7 or more than 3.4
1 Installing Pyvmomi
Pip Install Pyvmomi
2. Git clone https://github.com/vmware/pyvmomi-community-samples/
There's a lot of people writing numbers. Clone_vm.py is used to clone a virtual machine.
But in my environment, vcenter6.0 always reported SSL errors
Modified the following original file
def main ():
"""
Let this thing fly
"""
args = Get_args ()
Si = None
context = SSL. Sslcontext (SSL. PROTOCOL_TLSV1)
Context.verify_mode = SSL. Cert_none
Add two lines of yellow, file header add import SSL
Execute script
python2.7 clone_vm.py-s-u-p '--template "centos-6.7-500g-withlvm-ver:9-2"-V test-122
Result 650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/7E/66/wKiom1b96xagLq6sAADHktaNO50432.jpg "title=" capture. JPG "alt=" Wkiom1b96xaglq6saadhktano50432.jpg "/>
Python invokes Vcenter's API cloning virtual machine