pyvmomi | VMware vSphere API Python Bindings | REST library

 by   vmware Python Version: 8.0.2.0.1 License: Apache-2.0

kandi X-RAY | pyvmomi Summary

kandi X-RAY | pyvmomi Summary

pyvmomi is a Python library typically used in Web Services, REST applications. pyvmomi has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can install using 'pip install pyvmomi' or download it from GitHub, PyPI.

VMware vSphere API Python Bindings
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pyvmomi has a highly active ecosystem.
              It has 2045 star(s) with 763 fork(s). There are 190 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 298 open issues and 526 have been closed. On average issues are closed in 854 days. There are 1 open pull requests and 0 closed requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of pyvmomi is 8.0.2.0.1

            kandi-Quality Quality

              pyvmomi has 0 bugs and 0 code smells.

            kandi-Security Security

              pyvmomi has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pyvmomi code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pyvmomi is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              pyvmomi releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              It has 11352 lines of code, 374 functions and 34 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pyvmomi and discovered the below as its top functions. This is intended to give you an instant insight into pyvmomi implemented functionality, and help decide if they suit your requirements.
            • Handle closing element
            • Parse ISO 8601 formatted ISO 8601 formatted string
            • Retrieves a TZInfo instance
            • Extract ns and wsdlname from tag
            • Get a vmodl type from a given name
            • Wait for tasks to finish
            • Update the task
            • Update the progress if needed
            • Creates a filter for the given tasks
            • Makes a method that returns a login method
            • Gets a valid SAML assertion token
            • Creates a method that returns a method that returns a credentials method
            • Convert MethodTypeInfo to a method definition
            • Invokes a SOAP method
            • Cache a function
            • Invokes a method
            • Return the type of a vmodl type
            • Invokes accessor
            • Create a connection without SSL verification
            • Read data from the stream
            • Creates a SOAP stub adapter
            • Invoke method
            • Parse ISO8601 formatted ISO8601 formatted string
            • Get a bearer assertion line
            • Fetch a security token by its hok token
            • Handler for opening an element
            • Wait for a task to complete
            Get all kandi verified functions for this library.

            pyvmomi Key Features

            No Key Features are available at this moment for pyvmomi.

            pyvmomi Examples and Code Snippets

            How can I get started?
            Pythondot img1Lines of Code : 173dot img1License : Non-SPDX (NOASSERTION)
            copy iconCopy
            tmoose@ubuntu:~/rapid7/vm-automation$ python
            >>> import vm_automation
            >>> myserver = vm_automation.esxiServer("xxx.xxx.xxx.xxx", "user", "password", "443", "example.log")
            >>> print myserver.connect()
            True
            
            {
            	"HYPERVISOR_TY  
            Table of Contents
            Pythondot img2Lines of Code : 142dot img2License : Non-SPDX (NOASSERTION)
            copy iconCopy
            # [nsxraml]
            # nsxraml_file = <>
            # Uncomment the above section and add the path to the raml spec you want to use instead of the bundled version
            
            [nsxv]
            nsx_manager = 
            nsx_username = admin
            nsx_password = 
            
            [vcenter]
            vcenter = 
            vcenter_user = admi  
            vsphere-monitor
            Pythondot img3Lines of Code : 32dot img3License : Permissive (Apache-2.0)
            copy iconCopy
            git clone https://github.com/freedomkk-qfeng/vsphere-monitor.git
            
            yum install -y python-virtualenv
            cd vsphere-monitor
            virtualenv ./env
            ./env/bin/pip install -r requirement.txt
            
            # falcon
            endpoint = "vcenter" # 上报给 open-falcon 的 endpoint
            push_api = "ht  

            Community Discussions

            QUESTION

            Python logging issue: some logs are missing from the output
            Asked 2021-Dec-26 at 19:33

            I am trying to understand python logging. I created a project with the following structure.

            ...

            ANSWER

            Answered 2021-Dec-26 at 13:28

            I fix your issue by adding ,disable_existing_loggers=False) in s_lib.py. The default value is True. Here's a link to Python Doc

            Source https://stackoverflow.com/questions/70486367

            QUESTION

            How do I run a python file with arguments as variables from another python file?
            Asked 2021-Oct-14 at 17:00

            I'm working on cloning a Virtual Machine (VM) in vCenter environment using this code. It takes command line arguments for name of the VM, template, datastore, etc. (e.g. $ clone_vm.py -s -p < password > -nossl ....)

            I have another Python file where I've been able to list the Datastore volumes in descending order of free_storage. I have stored the datastore with maximum available storage in a variable ds_max. (Let's call this ds_info.py)
            I would like to use ds_max variable from ds_info.py as a command line argument for datastore command line argument in clone_vm.py.

            I tried importing the os module in ds_info.py and running os.system(python clone_vm.py ....arguments...) but it did not take the ds_max variable as an argument.

            I'm new to coding and am not confident to change the clone_vm.py to take in the Datastore with maximum free storage. Thank you for taking the time to read through this.

            ...

            ANSWER

            Answered 2021-Oct-14 at 17:00

            I suspect there is something wrong in your os.system call, but you don't provide it, so I can't check.

            Generally it is a good idea to use the current paradigm, and the received wisdom (TM) is that we use subprocess. See the docs, but the basic pattern is:

            Source https://stackoverflow.com/questions/69574495

            QUESTION

            How to add a disk to VM when cloning from a template?
            Asked 2021-Aug-28 at 04:55

            I've found pyvmomi examples on how to add a disk to an already existing VM, but I would like to customize the VM template and then clone. Setting the CPUs and memory are pretty straight forward, but the adding of one or more disks to an existing template, asides from the boot disk, eludes me.

            ...

            ANSWER

            Answered 2021-Aug-01 at 14:53

            The errors which you're getting seem to indicate that you need to fix the unit_number. Keep in mind that 7 is reserved for the scsi controller and 16 is the maximum supported number of disks by VMWare (view sample code).

            Source https://stackoverflow.com/questions/68537695

            QUESTION

            How to aapend data efficiently into pandas dataframe using for loop
            Asked 2021-Jul-28 at 18:12

            I am trying to get the data from Python script and storing that into a list and then creating a dataframe out of it.

            But it create different Datafarme's for individual items in for loop, how to avoid that and create a single dataFrame.

            Code:

            ...

            ANSWER

            Answered 2021-Jul-28 at 13:13
            # new df to concat every instance
            final_df = pd.DataFrame()
            for instance in vcenter:
                try:
                    c = SmartConnect(host=instance, user=userid, pwd=p, sslContext=s)
                except Exception as e:
                    print(e)
                    continue
                content = c.content
                obj_ds = content.viewManager.CreateContainerView(content.rootFolder,[vim.Datastore],True)
            # Lists
                a_list = []
                b_list = []
                c_list = []
                d_list = []
                
            # for loop
                for z in obj_ds.view:
                    a_list.append(instance)
                    b_list.append(z)
                    c_list.append(int(z.summary.capacity/(1024*1024*1024)))
                    d_list.append(int(z.summary.freeSpace/(1024*1024*1024)))
            
            #dataframe
            
                df = pd.DataFrame({'A': a_list, 'B': b_list, 'C': c_list, 'D': d_list})
                # append in final_df
                final_df = pd.concat([final_df, df])
            
            # reset index
            final_df = final_df.reset_index(drop=True)
            print(final_df)
            

            Source https://stackoverflow.com/questions/68559696

            QUESTION

            Cannot turn on DRS on vSphere server with generated python code
            Asked 2021-Jul-20 at 12:34

            This is the code generated by the code capture feature.

            ...

            ANSWER

            Answered 2021-Jul-20 at 12:34

            It looks like you never established the cluster (or ClusterComputeResource) as the managedObject variable. That should have been done prior to creating the spec variable and may have been missed from the Code Capture output.

            Source https://stackoverflow.com/questions/68446938

            QUESTION

            How to determine the OS version using pvymomi?
            Asked 2021-Jul-13 at 12:24

            Using pvymomi, I can determine the OS. How does one determine the OS version?

            ...

            ANSWER

            Answered 2021-Jul-13 at 12:24

            After doing some research into this question, I have found that the vSphere Web Services API, which the Python package pyvmomi uses does not have an easy way to collect the exact version operating system version with a basic API call.

            If you look at the vSphere Web Services API information for guestFamily, which is in GuestInfo you will not see any API call for precise versioning information.

            Additionally, to obtain the exact operating system version information for CentOS you would normally have to query the kernel, which contains this information.

            You can obtain the version of CentOS using this command:

            Source https://stackoverflow.com/questions/68185538

            QUESTION

            Pyvmomi get CRUD operations for Portgroup
            Asked 2021-Jun-08 at 21:32

            I want to write a script in Python & Django, where I will do CRUD operations for Port-group. I am working on VM Sphere / VM-Ware. But after searching a lot I got only a single repository for reference - https://github.com/vmware/pyvmomi-community-samples/tree/master/samples

            PyVmomi library.

            I am not able to write script for CRUD operations of Portgroup. Please also explain that are Port group under Central server access or under proxy access or under VM access. Please discuss in details.

            ...

            ANSWER

            Answered 2021-Jun-08 at 21:32

            Three of those operations already exist as part of the pyvmomi community samples repo, which you linked:

            Hopefully those three samples can help you get on your way to creating the script you require.

            Access-wise, portgroups are a child object of the ESXi host (or HostSystem) within the API. You can either authenticate directly to the managing vCenter Server or to the ESXi Host itself to manage portgroups.

            Source https://stackoverflow.com/questions/67870952

            QUESTION

            Pyvmomi configure ESXi 'NTP Client Enabled' check box
            Asked 2020-Jul-16 at 04:06

            Using the below code its possible to update the start up policy of ntpd service in an ESXi server,

            ...

            ANSWER

            Answered 2020-Jul-16 at 04:06

            host.configManager.firewallSystem.EnableRuleset(id='ntpClient')

            Source https://stackoverflow.com/questions/62652581

            QUESTION

            How to get a file from a server in a cluster in Vsphere using pyVmomi to remote(host) pc
            Asked 2020-Feb-20 at 13:48

            I am able to execute a command inside the server but I want to get that output in my local pc. I don't want want to use ssh keys. I want to use just the host's username and password as well as vm's(server's) username and password. I couldn't find a direct method to get the shell output of server in my pc, but this method seems half done like generate and save the output in server and then get the file from server. I am finding it difficult to get file(sample.txt) from server to local host(pc).

            [EDIT: I am able to do this using via via method(Store the output to server and then get it back into local pc, is there a direct method ?) ]

            ...

            ANSWER

            Answered 2020-Feb-20 at 13:45

            This does the job but I would appreciate if someone knows how to directly get the output of shell command from server to my local pc. This code makes a file with the output of cmd inside the server and it gets copied into my local pc

            Source https://stackoverflow.com/questions/60318680

            QUESTION

            can I see the owner/creator of a vcenter vm with pyvmomi
            Asked 2020-Jan-16 at 19:07

            The closest info I can find in the vSphere UI is the user of the "Clone completed" event in the events list in monitoring. Can i access this list with pyvmomi? Or any better alternative would be appreciated.

            ...

            ANSWER

            Answered 2020-Jan-16 at 19:07

            That kind of information isn't part of the virtual machine object, so your best bet is to poll the events via EventManager Only caveat, if you have a particularly active environment, the events may rollover so using and polling a syslog would be the most consistent manner of obtaining that information.

            Source https://stackoverflow.com/questions/59757099

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pyvmomi

            You can install using 'pip install pyvmomi' or download it from GitHub, PyPI.
            You can use pyvmomi like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install pyvmomi

          • CLONE
          • HTTPS

            https://github.com/vmware/pyvmomi.git

          • CLI

            gh repo clone vmware/pyvmomi

          • sshUrl

            git@github.com:vmware/pyvmomi.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link