VMware Cloud Community
orian
Hot Shot
Hot Shot

Run script in parallel in same virtual machine

Hi,

Is it possible to run "run script in VM guest" workflow in parallel?

For example I have a workflow which creates an A record in DNS virtual server, while creating a new server.

If I create two servers one after other, the first creates the DNS record, however the second fails because the first creation does not finish to return the output and exit code before the second begins.

There is a way to check if the "run script in VM guest" workflow is running in specific vm before running another tread of "run script in VM guest" workflow?

Thanks!

0 Kudos
2 Replies
orian
Hot Shot
Hot Shot

Any idea?

0 Kudos
eoinbyrne
Expert
Expert

You could try workflow locking to keep the two invocations sequential?

pastedImage_0.png

You would need to modify the calling workflow to leverage the lock correctly

i.e.,

LockingSystem.lockAndWait("some-string-for-lock-id", "some-string-for-lock-owner");

try

{

  <code for critical section goes here>

}

finally

{

LockingSystem.unlock("some-string-for-lock-id", "some-string-for-lock-owner");

}

When vRO encounters the locking code in a workflow, the lock acquisition checks if it can lock and if not it waits until the lock is released.

If you're doing this on an OOTB workflow you could just duplicate it for your needs and modify to suit

0 Kudos