how to add HostSystem through vCenter

91 views
Skip to first unread message

bob doe

unread,
May 29, 2013, 1:26:08 AM5/29/13
to psp...@googlegroups.com
I can connect to vCenter and list all HostSystem, but how to I add a HostSystem (Esxi Hypervisor) to vCenter using psphere?

this works fine:
from psphere.client import Client
from psphere.managedobjects import HostSystem

client = Client(server="myVCenter.example.com", user="user", password="password)
hosts = HostSystem.all(client)
for host in hosts:
    print host.name
but how do I add a new HostSystem to client (given that I already have the login credentials for HostSystem)?

Thanks for the help




Matthew Welch

unread,
May 29, 2013, 1:41:28 AM5/29/13
to psp...@googlegroups.com
Your going to want to look at the HostConnectSpec.

basically you will do something like:

host_spec = client.create('HostConnectSpec')

run that through iPython to see what you need to supply or look at the API docs here:


the thumbprint will need to be accounted for, so double check that. 

I've written a helper around this in my omoto code on github. The relevant file you want is here:


It has all the code you will need to add the host. 

- matt






--
You received this message because you are subscribed to the Google Groups "psphere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psphere+u...@googlegroups.com.
To post to this group, send an email to psp...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/psphere/e78cad17-c249-40cf-98eb-0f39df3ea615%40googlegroups.com?hl=en-GB.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages