3 Replies Latest reply on May 16, 2014 1:42 PM by samdoyle

    How do I indicate VMX file Guestinfo Variable Creation During OVA Build or within OVF?

    virtualG78 Novice

      After an OVA is deployed, it is possible to "hardcode" persistent VMware guestinfo variables by appending them to the VM's vmx file, as explained here:

       

      http://www.virtuallyghetto.com/2011/01/how-to-extract-host-information-from.html (Option 1)

       

      I've been able to do this by:

       

      1.  Deploying an OVA created from VMware Studio using vSphere client without powering on.

       

      2.  Downloading the vmx file from the created virtual machine and appending the desired variable, eg:

       

      guestinfo.myapp.variable="initial-value"

       

      3.  Uploading the vmx file back to the original location.

       

      4.  Powering on the VM.

       

      Now I can use the conventional VMware tools utilities to read and write persistently.

       

      vmtoolsd --cmd "info-get guestinfo.myapp.variable"

      vmtoolsd --cmd "info-set guestinfo.myapp.variable new-value"

       

      Updated values remain persistent after power-off or reboot which is exactly what I need.

       

      So how to I tell VMware Studio at OVA build time, or specify in the OVF file before deployment that I want guestinfo.myapp.variable to be created in the VM's vmx file?

        • 1. Re: How do I indicate VMX file Guestinfo Variable Creation During OVA Build or within OVF?
          dinad Novice

          Why did no one ever answer this ??

           

          Where do you find these extra parameters .. googling does not show much at all :-(

          Is there a way to update the vmx file using a python script from within the guest ?

           

          Another challenge is how to find the datastore path that the vm resides in.. from within the gues ? which command does one use ? I would like to use a python script .. not pysphere or similar.. just raw python.

           

          Could someone please assist ?

          • 2. Re: How do I indicate VMX file Guestinfo Variable Creation During OVA Build or within OVF?
            samdoyle Enthusiast
            VMware Employees

            Hi,

             

            In your build profile you can add it to the config section. You can specify both standard and extra config options

             

              <Section xsi:type="vadk:VMWConfigSection_Type">

                <Info>

                        VMW Config elements in this element will be passed directly

                        to the OVF output descriptor without interpretation

                </Info>

                <vmw:Config vmw:key="cpuHotAddEnabled" vmw:value="TRUE"/>

                <vmw:ExtraConfig vmw:key="svga.maxWidth" vmw:value="640"/>

                <vmw:ExtraConfig vmw:key="svga.maxHeight" vmw:value="480"/>

              </Section>


            S.D.

            • 3. Re: How do I indicate VMX file Guestinfo Variable Creation During OVA Build or within OVF?
              samdoyle Enthusiast
              VMware Employees

              If you are talking about your own custom properties you would use the PropertySection

               

                <Section xsi:type="vadk:PropertySection_Type">

                  <Info/>

                  <Property ovf:key="Password" ovf:type="string" ovf:userConfigurable="true" ovf:value="" ovf:qualifiers="MinLen(6),MaxLen(32)" ovf:password="true">

                    <Label>Initial password</Label>

                    <Description>A password</Description>

                  </Property>

                </Section>

               

              For getting the datastore I'm not sure if it is exposed or what property it would be for that matter but guestinfo is usually obtained through rpctool

               

              i.e.  /usr/sbin/vmware-rpctool 'info-get guestinfo.ovfEnv'