Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

How to tell if an entity is busy?

$
0
0

Hi all,

 

I've got a workflow that occasionally fails with an error that the entity is busy completing an operation.  I'm not sure how to determine that the entity is busy or not, though.

 

In the case I have, the entity is a vCloud:VM object from the vCloud Director APIs.  This behavior is present in both 5.1 and 5.5 (VCD and VCO).

 

 

 

if (nICUpdates == true) {

  System.log ("Update Customization:  nICUpdateTask.status = " + nICUpdateTask.status);

  System.log ("Update Customization:  virtualMachine.status = " + virtualMachine.status);

  System.log ("Update Customization:  virtualMachine.vmStatus.value = " + virtualMachine.vmStatus.value);

 

  virtualMachine.needsCustomization = true;

  var customizationSection = virtualMachine.getGuestCustomizationSection();

  customizationSection.enabled = true;

  customizationSection.required = true;

  customizationSection.changeSid = false;

  customizationSection.adminPasswordEnabled = false;

 

  System.sleep(500);

  // Hoping that tasks is the right thing to look at.

  var vmBusy = true;

  while (vmBusy == true) {

    virtualMachine.updateInternalState();

    var tasks = virtualMachine.tasks;

    System.log ("Tasks = " + tasks);

  System.log ("Status = " + virtualMachine.status);

    if ((tasks != null) && (tasks.length != 0)) {

      System.sleep(500);

    } else {

      System.log ("No tasks running.");

      vmBusy = false;

    }

  }

 

  var customizationUpdateTask = virtualMachine.updateSection (customizationSection);

}

 

In the code, nICUpdates is a boolean, virtualMachine a vCloud:VM, nICUpdateTask a vCloudTask.  Basically, the previous step set some parameters on the VM's NIC, and this step wants to turn on customization if the NIC was updated.  I've put a bunch of stupid waiting logic in there to try to avoid this problem.  It usually works right, but sometimes, the nICUpdateTask.status claims success, the virtualMachine.tasks is null and virtualMachine.status = 8.  Even in that case, the last call to updateSection() fails as below:

 

[2014-04-08 12:56:27.244] [I] Update Customization:  nICUpdateTask.status = success

[2014-04-08 12:56:27.244] [I] Update Customization:  virtualMachine.status = 8

[2014-04-08 12:56:27.244] [I] Update Customization:  virtualMachine.vmStatus.value = 8

[2014-04-08 12:56:28.244] [I] Tasks = null

[2014-04-08 12:56:28.245] [I] Status = 8

[2014-04-08 12:56:28.245] [I] No tasks running.

[2014-04-08 12:56:28.548] [I] The entity jumphost is busy completing an operation.; majorErrorCode=400; minorErrorCode=BUSY_ENTITY; vendorSpecificErrorCode=null; (Workflow:Update VM NIC and Customization / Update Customization (item9)#29)

 

So, my question is:  Is there a correct way to determine if a vCloud VM is busy completing an operation using the APIs available?

 

Thanks,

Jason


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>