Comments (8)
How to enable logs in this code so that we understand whats happening behind the REST APIs? I tired following but still no logs or output.
import logging
logging.getLogger("requests").setLevel(logging.DEBUG)
logging.getLogger('urllib3').setLevel(logging.DEBUG)
from vsphere-automation-sdk-python.
Please share following details:
- Installation type: typical/local/air-gapped
- Environment details such as Python, Setuptools and pip version.
- Steps to reproduce
Our listVM sample is also available in samples dir and detailed instructions to install SDK and run samples are available in README. Please refer to quick start guide and run SDK samples sections.
from vsphere-automation-sdk-python.
Installation type is Typical.
(vCenterDemo) (base) girish$ pip3 --version
pip 23.1.2 from /Users/../lib/python3.7/site-packages/pip (python 3.7)
(vCenterDemo) (base) girish$
(vCenterDemo) (base) girish$
(vCenterDemo) (base) girish$ python3 --version
Python 3.7.6
(vCenterDemo) (base) girish$
(vCenterDemo) (base) girish$
Steps to reproduce:
(1) Update the sample code with vCenter server ip, user credentials
(2) Run python3 my sample.py (The code is pasted in earlier message) The sample given at https://github.com/vmware/vsphere-automation-sdk-python/tree/v8.0.0.1
from vsphere-automation-sdk-python.
Please try this (replace values in placeholders for IP, Username and Password):
import requests
import urllib3
from vmware.vapi.vsphere.client import create_vsphere_client
session = requests.session()
# Disable cert verification for demo purpose.
# This is not recommended in a production environment.
session.verify = False
# Disable the secure connection warning for demo purpose.
# This is not recommended in a production environment.
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Connect to a vCenter Server using username and password
vsphere_client = create_vsphere_client(server='<vc_ip>', username='<vc_username>', password='<vc_password>', session=session)
# List all VMs inside the vCenter Server
list_of_vms = vsphere_client.vcenter.VM.list()
print("List Of VMs")
print("----------------------------")
print(list_of_vms)
print("----------------------------")
from vsphere-automation-sdk-python.
Hi. Just tried the above code. but still no Vms.
(vCenterDemo) (base) girish$ python3 vCClient2.py
List Of VMs
[]
from vsphere-automation-sdk-python.
(vCenterDemo) (base) girish $ python3 vCClient2.py
List Of VMs
[ ]
from vsphere-automation-sdk-python.
Nevermind. Got the output.
Summary(vm='vm-16', name='vm-001', power_state=State(string='POWERED_ON'), cpu_count=2, memory_size_mib=8192)]
from vsphere-automation-sdk-python.
Thanks.
from vsphere-automation-sdk-python.
Related Issues (20)
- [question] how to list custom_attributes for vm? HOT 1
- Air Gap Installation Issue HOT 3
- No LICENSE.txt file in the package HOT 4
- Support communication with vCenter Server via kerberos authenticated proxy sever HOT 1
- pip install vsphere-automation-sdk-python is broken. HOT 3
- vcenter.iso.iso_path.get_datastore_path() missing HOT 3
- from vmware.vapi.vsphere.client import create_vsphere_client HOT 8
- How to get VM Hardware of a OVF Template in Content Library HOT 5
- Not able to create ticket for Web console for newly created VM HOT 6
- Possible problem with Python 3.12? HOT 7
- Use "com" folder as an implicit namespace HOT 2
- How to get list of running Tasks ? HOT 2
- How to get list of running Tasks using vsphere-automation-sdk-python? HOT 1
- Add "Rename" to VM operations HOT 1
- issue with installation HOT 2
- How to Get VM current CPU and Memory Usage by Python SDK HOT 1
- Outdated pip package HOT 1
- No Module Named 'vmware' HOT 4
- Failure to Create Session with vSphere Client Using Self-Signed Certificate HOT 7
- ModuleNotFoundError: No module named 'vmware.vapi'; 'vmware' is not a package HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vsphere-automation-sdk-python.