lurims
Enthusiast
Enthusiast

Automating bulk import of Unmanaged VMs

Jump to solution

I would like to create a vRO workflow(s) that will automatically get all "unmanaged" VMs from vRA and ingest those into vRA.  I DO NOT want to use the bulk import vRA feature and can not use other tools.  I am successful in creating the spread sheet of the VMs with the properties needed, but how would I import all those VMs using vRO API calls.  Could not find any calls in vRO library API.  Can anyone help?  Ideally the workflow I create will not have any inputs, gets all unmanaged VMs and import those into vRA.

0 Kudos
1 Solution

Accepted Solutions
lurims
Enthusiast
Enthusiast

Seems this thread is helpful.  I am able to import vC VM into vRA. "Import vCenter Virtual Machine" workflow takes care of it.

View solution in original post

0 Kudos
8 Replies
lurims
Enthusiast
Enthusiast

Seems this thread is helpful.  I am able to import vC VM into vRA. "Import vCenter Virtual Machine" workflow takes care of it.

0 Kudos
sangramregade
Contributor
Contributor
 
0 Kudos
sangramregade
Contributor
Contributor

Hi lurims Enthusiast,

Im also looking for such workflow which will help in bulk import of Unmanaged VMs , I tried to find workflows but not able to get anything working. Can you please help me in , that how did you get the details which was required for the csv file in spreadsheet, it will be very helpful if you can share any workflow which is related to this problem.

Thank you.  

0 Kudos
lurims
Enthusiast
Enthusiast

Are you still looking for this?

0 Kudos
sangramregade
Contributor
Contributor

Thanks lurims Enthusiast for the replay. I'm still looking for the solution on it , can you guide me out on it ? how can we find the proper mechanism to solve this problem.

It will be really helpful.

Thanks again.

0 Kudos
lurims
Enthusiast
Enthusiast

OK, just letting you know this was done in vRO 7.5.  Do you still need it?

sangramregade
Contributor
Contributor

Thank you so much for your support. It will be great because we are also using the 7.x version so how can i use it. Can you please share the details or the files it will be very helpful for us.

0 Kudos
lurims
Enthusiast
Enthusiast

I know this is complex, but I will try to answer your questions if you have blockers.

  1. First practice some bulk imports using CSV formats for a couple of VMs, which will give some exposure to different properties and values you need.  One important one is vRA Admin UPC ID, it has to be in the format your vRAAdminloginID@yourFullDomaininFQDN format.  If this is incorrect import will not work and it is case sensitive.  When you exercise with bulk import you see this value.
  2. Create a vRA 7.X Blueprint that will be used just for Importing with Blueprint Type as "Server", Action as "Create" and Provision workflow as "BasicVmWorkflow".  Play with this for the test machine in the above CSV file.
  3. Get unmanaged VMs from vRA. allvRAVMs = Server.findAllForType("VCAC:VirtualMachine").  This will be an array of all vRA 7.X VM objects.  Check this property to get unmanaged VMs, ex: (!vRAVM.isManaged) where vRAVM is the vRA VM Object while looping all VMs of the array allvRAVMs 
  4. You will need the vRA VM entity fro each vRA Vm Object, get it by using this library action script, com.vmware.library.vcac.getVirtualMachineByExternalRefId.  This will need a uniqueId of the VM, which you can get from vRA VM Properties which is UUID you can get vRA VM properties.
  5. Get the host reservation ID for each vRA Vm by using the library action script getHostReservationToStorageFromStoragePath.  This needs VCAC:VCACHost object, hostReservation and storage path.  Get storage path from vravm.storagePath property.  You can get the host reservation (vCAC:Reservation) object from the library action script getReservationEntityByName.  This will intern needs the VCenter Cluster object (VC:ClusterComputeResource) .  For this take the VC:VirtualMachine object, get the host liek this: parent =  vVVMObj.runtime.host. Loop while parent!=null && it is not equal to (parent instenaceOf VcClusterComputeResource).  The one in the parenthesis should be the exact text value.  parent = parent.parent; this parent is the VC:ClusterComputeResource object you need to pass for the host Reservation.
  6. Use vcAC:VirtualMachine object property called "registerVm" to import the VM.  This needs an input called arguments, which can be prepared like this.
  7. var args = {user:<this will be the vRA Admin UPC ID as stated above>,identifyUser:<same as vRA AdminUPC ID>,templateId:<the template you created as mentioend above>,hostReservationID:<get it from hostReservation object>,hostStorageReservationId:<Thsi is the above one>,blueprintComponentId:<from the blueprint you created>,blueprintId:<from the blueprint you created>,deploymentName:<you have to give a unique name that you come up with>}
 
0 Kudos