VSphere Client
install:
pip install VSphereClient
request demo:
if __name__ == '__main__':
from VSphereClient import VSphere
ip = '10.x.x.x'
user = 'username'
password = 'password'
port = 443
vm = VSphere(host=ip, user=user, password=password, port=port, ssl=None)
data_center = vm.get_data_center()
print('data_center', data_center)
cluster = vm.get_cluster(data_center[0]['id'])
print('cluster', cluster)
host = vm.get_host(data_center[0]['id'], cluster[0]['id'])
print('host', host)
vm_list = vm.get_vm(data_center[0]['id'], cluster[0]['id'])
print('vm_list', vm_list)
store_cluster = vm.get_storage_cluster()
print('store_cluster', store_cluster)
store_list = vm.get_storage_by_host(data_center[0]['id'], cluster[0]['id'], host[0]['id'])
print('store_list', store_list)
store_list = vm.get_storage_by_host(data_center[0]['id'], cluster[0]['id'], '')
print(store_list)
vlan = vm.get_vlan(data_center[0]['id'])
print('vlan', vlan)
# windows: 'HQ-T-Temp-WIN2016EN-2023Q2', '123456'
# linux: 'HQ-T-Temp-redhat7.9-2023Q2', '123456'
clone_res = vm.clone_vm(template_name='HQccc023Q2',
vm_name='ops-test-00001',
datacenter_id=data_center[0]['id'],
cluster_id=cluster[0]['id'],
host_id=host[0]['id'],
cpu_num=8,
memory=16384,
vm_ip='192.168.1.10',
vm_subnetmask='255.255.255.0',
vm_gateway='192.168.1.1',
vm_dns=["10.1.1.1", "10.1.1.2"],
vm_domain='abc.auto',
network_id=vlan[0]['id'],
data_disk_id=store_list[0]['id'],
data_disk_size=130,
password='Aa123456,.'
)
print('clone_res', clone_res)
# windows 修改密码
result = vm.change_password(is_win=True, vm_name='ops-test-00002',
username='administrator',
old_password='Aa123456,./789',
new_password='Aa123456,./788')
print(result)
# linux 修改密码
result = vm.change_password(is_win=False, vm_name='ops-test-00001',
username='root',
old_password='MZyyty1O5ty!2lT2l',
new_password='MD2DHHD!aIup03H2u')
print(result)
Metadata
Release files for VSphereClient 0.0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| VSphereClient-0.0.0.2.tar.gz | 10.0 kB | Without provenance | Details for VSphereClient-0.0.0.2.tar.gz |
Release files / VSphereClient-0.0.0.2.tar.gz
| Download URL | VSphereClient-0.0.0.2.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4707109957afd1f05282a28c33d45fcb515bad1a70455c8e6d3dd8265c499a80
|
|
BLAKE2b-256 checksum How to use checksums |
f78f7a2ed529f4a83035e66472a0ac095460ee7d554777ff7b954d8f1732a4c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
|
Security for VSphereClient 0.0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.