4 Replies Latest reply on Oct 23, 2019 7:57 AM by eoinbyrne

    Change vCenter location during blueprint requested fase

    Paul_SI Lurker

      Hi All,

      We have multiple large customers with their own vCenters and I'd like to include them in a default deployment process. This process is build in vRO and is using MDT to install the VM.

      Now I'd like to change the vcenter location of the VM before it is being build, not the vrm.datacenter.location (found in:https://code.vmware.com/forums/3055/vrealize-orchestrator#589074)

      I have a SQL table that holds the config per customer, so this will be queried for the vCenter/Datacenter/Cluster locations based on the domain name decision the customer makes.

      Is this possible?

        • 1. Re: Change vCenter location during blueprint requested fase
          Paul_SI Lurker

          I've found a property in the payload called EndpointId, this holds the vRA endpoint Id of the vCenter.

           

          How can I change this to another Id? This is not a property of the vCACEntity.

          • 2. Re: Change vCenter location during blueprint requested fase
            eoinbyrne Hot Shot

            Can I ask why you're not doing this with Reservations & Reservation Policies? The Reservation ties a BusinessGroup and a Compute Resource in a 1:1 relationship. This would seem to cover the requirement you have? If I understand correctly you are customizing IaaS request after submission here using the EBS. I've found that it's a LOT easier to customize the IaaS CatalogItem request (i.e., before submission) to get this type of effect. You can set this property on the request

             

            __reservationPolicyId to the ReservationPolicy for the customer/site/location/whatever the policy represents.

             

            Have a look around for examples using vCACCAFERequestsHelper

             

             

            You can use it and do the following

            - Retrieve the JSON content (ProvisioningRequestData) for a CatalogItem

            - Customize the JSON with your new values (we often do sizing, naming, NetworkSelection, ReservationPolicy, Additional disks, etc)

            - Set the customized JSON back into the request

            - Submit the request

             

            HTH

            • 3. Re: Change vCenter location during blueprint requested fase
              Paul_SI Lurker

              Hi eoinbyrne,

               

              Thank you for your detailed post!

               

              Your idea to do this with the reservations and policies sounds much better, I'm a bit of a beginner here. This didn't came up to me This way I'm also better in controll witch BG's are able to manage the deployed machine I guess. We were also looking for a way to give a second BG rights to the deployed machines.

               

              Aafter a search in vRO for some examples I found this one:

              #-> Library -> vRealize Automation -> Requests -> Request a catalog item with provisioning request

               

              This holds the following script and this looks like something I can edit and reuse.

               

              var provisioningRequest = vCACCAFERequestsHelper.getProvisioningRequestForCatalogItem(catalogItem);
              provisioningRequest.setDescription(description);
              provisioningRequest.setReasons(reasons);
              if(requestedFor){
                  provisioningRequest.setRequestedFor(requestedFor);
              }
              provisioningRequest.setBusinessGroupId(catalogItem.getOrganization().getSubtenantRef());
              
              ////Uncomment to customize request data
              //var jsonData = vCACCAFERequestsHelper.getProvisioningRequestData(provisioningRequest);
              //var json = JSON.parse(jsonData);
              ////Change cpu example
              //json.ComponentName.data.cpu = 2;
              //vCACCAFERequestsHelper.setProvisioningRequestData(provisioningRequest, JSON.stringify(json));
              
              request = System.getModule("com.vmware.library.vcaccafe.request").requestCatalogItemWithProvisioningRequest(catalogItem, provisioningRequest);
              

               

              I'm goint to experiment with this, thanks! I'll post back any results that I can figure out.

               

              PS: Do you know how I can print-out all properties related to a specific EBS phase? I have my workflow running in:

              > com.vmware.csp.iaas.blueprint.service.machine.lifecycle.provision / VMPSMasterWorkflow32.Requested

              • 4. Re: Change vCenter location during blueprint requested fase
                eoinbyrne Hot Shot

                You can dump the Payload content like this

                 

                 

                If you look at the EBS documentation for MachineLifecycle the schema is given as JSON (or when defining a new Subscription you get the schema in the right pane and you can expand the members which have children)

                 

                You mentioned there about giving two BusinessGroups access to the same VMs - I'm not sure that's doable without some mind bending around group memberships, roles & entitlements. The problem would be that vRA will only show a user Resources to which they are entitled (by being members of certain groups or having certain roles basically). When a VM is created it is allocated to a HostReservation and these have a 1:1 relationship with a BusinessGroup. Also, unless a user is a BG manager his Items view will only show VMs which belong to him

                 

                You can skirt this somewhat if you make everybody members of both business groups & make them all Managers, but then each user must be aware of which BG he is requesting a VM for.

                 

                In addition, BG Roles can introduce even more possibilities here (Manager vs Support User vs Member).

                 

                If I absolutely had to provide the functionality I'd probably do it with XaaS forms to compute which VMs the requestor can manage (& hide the ownership of the VM underneath)