2 Replies Latest reply on Jul 13, 2016 11:15 AM by Curumim

    guestinfo vs machine.id variables for passing info in VM

    rchoudhary Lurker

      I am trying to pass some configuration specs to a VM. These specs. would later be retrieved (with the help of vmtoolsd cmd)by the init services during booting of the VM.


      Now i found two choices here:

      1. Either I can set the VM specific info using guestinfo.<variable> . guestinfo supports multiple key/value pairs.

      2. Or I set the info using machine.id . machine.id doesn't support multiple key/value pairs and you have to specify all the paramaters as a string:

      machine.id = <string>


      Cons of guestinfo:

      1. These variables are not saved in the VM's .vmx file.

      2. We can set these variables only when a VM is powered-on. Don't know the exact location where these variables are stored. but still we can retrieve these variables using vmtoolsd --cmd "info-get guestinfo.<variable>" only till VM is powered on. Once VM is powered off, these variables would get lost. So persistence is a problem.



      1. This variable is saved in .vmx file and is persisted even during VM's reboot.



      I really don't know when machine.id variable should be used. Is using this variable a safe option? Is this variable being used internally by the VM? Is this reserved for something or can i go ahead using this variable for setting some VM info.


      Help on this would be really appreciated.

        • 1. Re: guestinfo vs machine.id variables for passing info in VM
          botski Lurker

          machine.id is custom for you to use (vmware itself doesn't use it).  If you want multiple key/value pairs, maybe put JSON in there?


          machine.id = "{'IP':'','Colour':'Yellow speckeld tangerine'}"


          perl -e 'use JSON; eval(q[$j=from_json(`vmtoolsd --cmd machine.id.get`)]); use Data::Dumper;print Data::Dumper->Dump([$j],["%j"]);'

          $%j = {

                  'IP' => '',

                  'Colour' => 'Yellow speckeld tangerine'


          • 2. Re: guestinfo vs machine.id variables for passing info in VM
            Curumim Lurker

            Old post but this may help.

            I've been using a variable.


            export OVF_ENV_FIXED_HACK=`cat /mutiline.txt`
            /usr/sbin/vmtoolsd --cmd "info-set guestinfo.ovfenv $OVF_ENV_FIXED_HACK"


            This one is a "cheat" to pass info to an ESXi, for properties that it expects from a VCenter, when there is none.

            You may be able to pass multiple lines with "<" redirect as well, have not tested though.


            For persistance, I added a few lines to call this script in the ifup scripts, BEFORE the network goes up, so that all I need is loaded. You can also add a service (calling the script) as requirement for other basic services.