diff --git a/Orchestrator/Workflows/Generate Unique Hostname/01_create_lock.js b/Orchestrator/Workflows/Generate Unique Hostname/01_create_lock.js new file mode 100644 index 0000000..1ca2f82 --- /dev/null +++ b/Orchestrator/Workflows/Generate Unique Hostname/01_create_lock.js @@ -0,0 +1,7 @@ +/* JavaScript: create lock + Creates a vRO lock to avoid conflicts from multiple concurrent workflow runs. + Inputs: none + Outputs: none +*/ +System.debug("Creating lock..."); +LockingSystem.lockAndWait("namingLock","eventBroker"); \ No newline at end of file diff --git a/Orchestrator/Workflows/Generate Unique Hostname/02_getSdkConnectionForVC.js b/Orchestrator/Workflows/Generate Unique Hostname/02_getSdkConnectionForVC.js new file mode 120000 index 0000000..7054a1a --- /dev/null +++ b/Orchestrator/Workflows/Generate Unique Hostname/02_getSdkConnectionForVC.js @@ -0,0 +1 @@ +Actions/com.virtuallypotato.utility/getSdkConnectionForVC.js \ No newline at end of file diff --git a/Orchestrator/Workflows/Generate Unique Hostname/README.md b/Orchestrator/Workflows/Generate Unique Hostname/README.md index 2497a26..8a92857 100644 --- a/Orchestrator/Workflows/Generate Unique Hostname/README.md +++ b/Orchestrator/Workflows/Generate Unique Hostname/README.md @@ -1,6 +1,8 @@ # Generate Unique Hostname workflow Ensures a unique, sequentially-numbered hostname by checking for naming conflicts in vCenter, DNS, and Active Directory. +![Schema](schema.png) + ## Inputs/Outputs | Name | Type | Direction | Description | |:--- |:--- |:---|:---| @@ -10,3 +12,15 @@ Ensures a unique, sequentially-numbered hostname by checking for naming conflict | `vCenterName` | string | Input | FQDN of the owning vCenter | | `vmName` | string | Output | generated VM name | +## Variables +| Name | Type | Value | Description | +|:--- |:--- |:--- |:--- | +| `adHost` | AD:AdHost | `[object AD:AdHost]` | host used by the AD plugin | +| `candidateVmName` | string | | holds the current working name during checks | +| `computerNames` | ConfigurationElement | `[object ConfigurationElement]` | vRO config element to keep track of the last-used number sequence for a given `nameBase` | +| `conflict` | boolean | `false` | gets set to true when a name conflict is encountered | +| `digitCount` | number | `2` | determines how many digits get appended to `nameBase` | +| `errMsg` | string | | thrown when errors are encountered | +|`hostnameSequence` | number | `0` | starts the sequence at 0, tracks as it changes | +| `vcSdkConnection` | VC:SdkConnection | | host used by the vCenter plugin (set based on `vmName` input) | +| `vms` | Array/VC:VirtualMachine | | holds VM objects to check for conflicts | \ No newline at end of file diff --git a/Orchestrator/Workflows/Generate Unique Hostname/schema.png b/Orchestrator/Workflows/Generate Unique Hostname/schema.png new file mode 100644 index 0000000..0855288 Binary files /dev/null and b/Orchestrator/Workflows/Generate Unique Hostname/schema.png differ