7 Replies Latest reply on Apr 25, 2017 8:51 AM by rstoker13

    Set/Override GuestOS setting in VM deployment

    Tanner_R Novice

      Hello everyone,

       

      I have an empty VM template (no OS installed), that was created with the OS Version set to "SUSE Linux Enterprise 12 (64-Bit)." When I clone a VM from this template, I get an empty VM, set for use with SUSE 12 64-Bit. What I want is to allow the user to change this setting before deployment in VRA.

       

      I have tried to override this setting in VRA using the following properties:

       

      VirtualMachine.Config.GuestId

      vim.vm.GuestOsDescriptor.GuestOsIdentifier

      vm.GuestOsDescriptor.GuestOsIdentifier

      VirtualMachine.GuestOsDescriptor.GuestOsIdentifier

       

      With a value of 'rhel6_64Guest'. None of these have worked, and the VM is always cloned as SUSE 12 64-bit.

       

      Can anyone tell me what the correct property to set would be? For example, I can override some network settings by manually creating a property named 'VirtualMachine.Network0.Name'.

       

      Thanks,

      Tanner

        • 1. Re: Set/Override GuestOS setting in VM deployment
          rstoker13 Enthusiast
          VMware Employees

          See below. I have not used this property myself, but perhaps it would do the trick. Let me know how it goes.

           

          Table 3-14 in vRA 7.2 Custom Properties Reference

           

          VMware.VirtualCenter.OperatingSystem - Specifies the vCenter Server guest operating system version (VirtualMachineGuestOsIdentifier) with which vCenter Server creates the machine. This operating system version must match the operating system version to be installed on the provisioned machine. Administrators can create property groups using one of several property sets, or example, VMware[OS_Version]Properties, that are predefined to include the correct VMware.VirtualCenter.OperatingSystem values. This property is for virtual provisioning. When this property as a non-Windows value, the Connect Using RDP user interface option is disabled. The property can be used in a virtual, cloud or physical blueprint. For related information, see the enumeration type VirtualMachineGuestOsIdentifier in vSphere API/SDK Documentation. For a list of currently accepted values, see the vCenter Server documentation.

          • 2. Re: Set/Override GuestOS setting in VM deployment
            Tanner_R Novice

            This definitely appears to be the property I need, but I've deployed several more VM's, and cant get it to apply. It doesn't seem to want to work for some reason. I'll keep working on it.

            • 3. Re: Set/Override GuestOS setting in VM deployment
              rstoker13 Enthusiast
              VMware Employees

              Sorry for the delayed response. I am currently using "System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity()" to apply the properties that my business requires in a custom vRO workflow. Perhaps this method will work in your case as well. I am using the Event Broker to call the workflow during "Machine Provisioning" with the conditions below:

               

              Run based on conditions - All of the following

                   Data > Lifecycle State > Lifecycle state name - Equals - VMPSMasterWorkflow32.Requested

                   Data > Lifecycle State > State phase - Equals - EVENT

               

              I would be happy to share my code if you think it may help.

               

              Alternatively, there are several blog posts that may assist as well. The link below is a bit older but seems to be applying the property you seek to use. Please take a look and let me know if you are successful. Thanks and good luck!

               

              Using custom property in vRA/vCAC deploy VM in specific datacenter using local templates -Post02 – All about Cloud Ecosy…

               

               

              Also, be sure that the data input into the property is accurate and CASE correct. See the link below for the list of OS.

               

              vRealize Automation Guest OS IDs (VMware.VirtualCenter.OperatingSystem) — Virtual Nebula

              1 person found this helpful
              • 4. Re: Set/Override GuestOS setting in VM deployment
                Tanner_R Novice

                Some code would be helpful. I have gotten a workflow to fire off, using the event conditions that you have provided, but I still cannot get the OS to update using the 'Create/Update Property on vCAC VM' workflow.


                Thanks,Tanner

                • 5. Re: Set/Override GuestOS setting in VM deployment
                  rstoker13 Enthusiast
                  VMware Employees

                  I have attached the workflow that I use at the event described in my previous post. You can ignore the 3rd and 4th elements in the workflow as they are inconsequential.

                   

                  The first element is borrowed from a blog post I had found a few weeks ago. (Unfortunately, I cannot recall where I found it. I will update this post if I find it.) This element gathers all of the properties of the new VM from the payload provided to vRO from vRA. It also logs all of the properties so you can see all the information vRA is providing.

                   

                  The second element is selecting specific properties and making a decision based on the values. For instance, backup retention or T-Shirt sizing.

                   

                  The final element is applying the updated properties back to the VCACENTITY before the machine is deployed.

                   

                  This may not be the most elegant workflow, but it is getting the job done and doing so quickly. Let me know if you have additional questions. Thanks.

                  1 person found this helpful
                  • 6. Re: Set/Override GuestOS setting in VM deployment
                    Tanner_R Novice

                    I had code very similar to yours pieced together, and additionally modified yours to set the 'VMware.VirtualCenter.OperatingSystem' property. The workflow runs with out error, and says it successfully updated the property. Unfortunately, the property does not change on the VM. Im not sure why its not working.

                     

                    In the meantime, I was able to workaround my issue by setting my workflow to run after provisioning is complete. It powers off the VM and changes the Guest OS. I have attached that workflow for anyone who is curious. Thank you for your help on this issue!

                    • 7. Re: Set/Override GuestOS setting in VM deployment
                      rstoker13 Enthusiast
                      VMware Employees

                      Glad you got it working!