Remove stuck provisionings from vRA Managed Machine page

This documentation describes how you can remove a stuck provisioning in the vRA Managed Machine page.

Disclaimer: This is not officially supported by VMware, please use at your own risk.

If you have a Virtual Machine in State „FinalizeProvisioning“ in the Managed Machine list as shown below.

 

 

First you have to check whether the machine is existing in vCenter or not. Depends on this you have to options to fix this problem.

  1. The machine is existing in vCenter and correct installed, but the VM state is wrong as shown above.
  • Change the VM state in the vRA Database
  • Log into the vRA database
  • execute the following MSSQL statement

 

You should get a output like this:

If the VM in vCenter powered on then set the state to „On“. In case of the machine is powered Off set it to „Off“

Execute the SQL statement below:

 

Check the setting

 

 

2. If the machine not existing on the vCenter, then you have some options,

  • Use the Cloud Client
  • Remove the machine from the vRA MSSQL Database and from the embedded Postgres Database

 

Use Cloud Client

  • Download the vRealize Cloud Client 4.3
  • Run the batch from a server with access to both the vRA and IaaS Server
  • login to the vRA Server

For Example:

„vra login userpass -user <user> -password <password> -server <vRA Server> -tenant <Tenant>“

To test that you are connected correctly, you could for example retrieve a list of catalog items

For Example:

„vra catalog list“

Next, login to the IaaS Server

For Example:

„vra machines frceunregister -name >Managed Machine Name>“

If the issue persists, use the manual method to remove the virtual machine using the stored procedure.

 

Remove the virtual machine manually

  1. Download the KB2144269_RemoveVMFromVRA7.zip
  2. Extract the zip file and open the ups_RemoveVMFromVRA.sql in the SQL Server Management Studio and execute the sql Script. Make sure that you add the use <DB Name> at the beginning of the sql script.

After a refresh of the database, you should see the stored procudure (<DB Name> -> Programmability -> Stored Procedures) „dbo.usp_RemoveVMFromVRA“

Right click on the dbo.usp_RemoveVMFromVRA procedure and select Execute Stored Procedure

In „Execute Procedure“ window, input the virtual machine name into „Value“ column of „@MachineName“ parameter, which is stuck or orphaned in the vRA Managed Machine list and Click „OK“ button to execute the procedure.

On bottom „Messages“ pane, you will see message similar to the following
(*** row(s) affected)
Remove workflow of the virtual machine

(*** row(s) affected)
Remove approval request of the virtual machine

(*** row(s) affected)
Remove all workflow maps of the virtual machine

(*** row(s) affected)
Remove all static IP addresses of the virtual machine

(*** row(s) affected)
Remove approval workflow of the virtual machine

(*** row(s) affected)
Remove virtual machine [Virutal Machine Name]

If you see any other error messages showing up in Results or Messages window, that means there is error occurred during execution of the stored procedure. Please open a support ticket with VMware.

Now the machine should be removed from the Managed Machine list in vRA.

 

Check whether the machine is still existing in the vRA Postgres DB

  1. Login to the vRA Appliance via Putty
  2. Run the following commands
  • su – postgres
  • cd /opt/vmware/vpostgres/current/bin
  • ./psql
  • \c vcac
  • SELECT * FROM cat_resource WHERE name='<machine name>‘ and tenant_id='<tenant name>‘;
  • make sure you see the machine, then execute the next command, if the machine not visible nothing has to do
  • update cat_resource set status= ‚DELETED‘ where name = ‚<machine name>‘ and tenant_id= ‚<tenant name>‘

ATTENTION: Don´t forget the ; at the and of each command. E.g. select * from table;

This will remove the VM from vRA management.
This does not delete the deployment in vRA, after removing stuck machines from vRA management, we should be able to delete the deployment from UI.

For more details see VMware KB2414269

 

 

 

 

 

 

 

 

         

hferch has written 76 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">