-
Notifications
You must be signed in to change notification settings - Fork 0
/
HostInfo.py
29 lines (23 loc) · 907 Bytes
/
HostInfo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
import VmInclude
def main():
host = "127.0.0.1"
port = ":8443"
username = raw_input('username? ')
password = raw_input('password? ')
#connect to host
try:
hostconnection = VmInclude.connectToHost(host+port, username, password)
print("Type: ", hostconnection.get_server_type())
print(hostconnection.get_registered_vms())
print(hostconnection.get_clusters())
print('API Type: ' + hostconnection.get_api_type() + ' API Version: ', hostconnection.get_api_version())
print(hostconnection.get_resource_pools())
print(hostconnection.get_datacenters())
webserver = hostconnection.get_vm_by_name('Ubuntu 64-bit - webserver');
print(webserver.get_snapshots())
hostconnection.disconnect()
except VmInclude.VIApiException as err:
print(err)
if __name__ == '__main__':
main()