getting hostnames between vmware hosts and guests

The vmware-tools are open source now. There’s a open-vm-tools package for lenny/sid, but not etch. There are people out there who have back ported it.

This package appears to make a ‘guestinfo.ip’ variable, which is a method for passing data between the host and guest without networking. There does not appear to be any variables for the hostname of the guest or the host by default, which is REALLY, REALLY dumb. You can make one though.

guest$ /usr/sbin/vmware-guestd –cmd ‘info-get guestinfo.ip’

This is really awesomely funny:

guest$ /usr/sbin/vmware-guestd –cmd ‘info-set guestinfo.hostname’
Two and exactly two arguments expected
guest$ /usr/sbin/vmware-guestd –cmd info-set guestinfo.hostname
Too many mandatory argument(s) on the command line. The maximum is 1.

[04:00pm|btm> HA HA HA HA HA
[04:02pm|jet_li> btm: welcome to my world
[04:02pm|jet_li> btm: here’s a hint. typing harder won’t help
[04:03pm|jet_li> btm: neither will profanity, or throwing things

This does work:

guest$ /usr/sbin/vmware-guestd –cmd ‘info-set guestinfo.hostname foo’

Then on the server you can run ‘vmware-cmd -l’ to list your config files. Then run:

host$ vmware-cmd ‘/path/to/config.vmx’ getguestinfo hostname

And you get:

getguestinfo(hostname) = foo

Now go do something useful with it (I’m going to use it with iClassify and puppet.)

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.