Python invokes Vcenter's API cloning virtual machine

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.