querying a vm without vmware tools

classic Classic list List threaded Threaded
2 messages Options
mvk
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

querying a vm without vmware tools

mvk
hi, guys.
I know it's possible to dig the excellent and well organized vmware api documentation, and find the query, but I've tried, and gave it too much time.
Here it is:
I want to determine the MAC address of a vm without VMWare tools installed (bootstraping problem)
name, host are known. web/native windoz client can see the mac address.
can't use vm.guest.*
Guess is I need to query the host in some wicked way, so let's assume I have a reference to a vim.HostSystem object.
What's next ?

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying a vm without vmware tools

hartsock
Administrator
Hey there.

So the short answer is, you get a hold of the VM some how ... probably:
http://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.SearchIndex.html

Then, once you have your particular VM you can list out the devices it has...
https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/virtual_machine_device_info.py

Or...
http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vim.VirtualMachine.html

Or...

macs = []
device = vm.summary.runtime.device[some_index]
if hasattr(device, 'macAddress'):
    macs.append(device.macAddress)


Some combination of the sample code and the above should get you a
list of all mac addresses attached to a VM.

Happy hacking!

On Fri, Nov 7, 2014 at 4:53 AM, mvk [via pyvmomi]
<[hidden email]> wrote:

> hi, guys.
> I know it's possible to dig the excellent and well organized vmware api
> documentation, and find the query, but I've tried, and gave it too much
> time.
> Here it is:
> I want to determine the MAC address of a vm without VMWare tools installed
> (bootstraping problem)
> name, host are known. web/native windoz client can see the mac address.
> can't use vm.guest.*
> Guess is I need to query the host in some wicked way, so let's assume I have
> a reference to a vim.HostSystem object.
> What's next ?
>
> Thanks.
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://pyvmomi.2338814.n4.nabble.com/querying-a-vm-without-vmware-tools-tp6.html
> To start a new topic under pyvmomi, email
> [hidden email]
> To unsubscribe from pyvmomi, click here.
> NAML



--
# Shawn.Hartsock - twitter: @hartsock
Loading...