Without this change, the circuit breaker was initialized in base.rb but never called in the vsphere provider, so vSphere API failures (TCP timeouts, connection errors) would not trip the circuit open. Changes: - Add with_circuit_breaker helper that calls @circuit_breaker.call if circuit_breaker is configured, otherwise yields directly - Wrap vms_in_pool, get_vm, create_vm, destroy_vm, get_vm_ip_address with with_circuit_breaker so vSphere failures trip the circuit - Replace 'return' with 'next' inside blocks where needed to ensure circuit breaker on_success is properly called on partial results This prevents cascading failures: once the circuit opens after failure_threshold errors, subsequent calls fail fast (CircuitOpenError) instead of waiting for the full TCP timeout (~18s per pool). Resolves: P4DEVOPS-9438 |
||
|---|---|---|
| .github | ||
| lib | ||
| scripts | ||
| spec | ||
| .github_changelog_generator | ||
| .gitignore | ||
| .rubocop.yml | ||
| .rubocop_todo.yml | ||
| CHANGELOG.md | ||
| CODEOWNERS | ||
| Gemfile | ||
| Gemfile.lock | ||
| install-gemfile-lock | ||
| LICENSE | ||
| Rakefile | ||
| README.md | ||
| release-prep | ||
| update-gemfile-lock | ||
| vmpooler-provider-vsphere.gemspec | ||
vmpooler-provider-vsphere
This is a provider for VMPooler allows using vSphere as a source of machines. This provider was originally part of the main VMPooler code base but was extracted to be a standalone gem so that development could be done independently of VMPooler itself.
Usage
Include this gem in the same Gemfile that you use to install VMPooler itself and then define one or more pools with the provider key set to vsphere. VMPooler will take care of the rest.
Examples of deploying VMPooler with this provider can be found in the puppetlabs/vmpooler-deployment repository.
Custom VM Config Attribute
This provider sets a custom attribute on the VM called guestinfo.hostname to the name of the generated VM, which can be queried from inside the guest OS if VMware Tools is isntalled. For example:
macOS: "/Library/Application Support/VMware Tools/vmware-tools-daemon" --cmd "info-get guestinfo.hostname"
Linux or Windows Guest: vmtoolsd --cmd "info-get guestinfo.hostname"
See the VMware Tools Administration docs for more information about querying information from the GuestInfo variable.
Update the Gemfile Lock
To update the Gemfile.lock run ./update-gemfile-lock.
Verify, and update if needed, that the docker tag in the script and GitHub action workflows matches what is used in the vmpooler-deployment Dockerfile.
Releasing
Follow these steps to publish a new GitHub release, and build and push the gem to https://rubygems.org.
- Bump the "VERSION" in
lib/vmpooler-provider-vsphere/version.rbappropriately based on changes inCHANGELOG.mdsince the last release. - Run
./release-prepto updateGemfile.lockandCHANGELOG.md. - Commit and push changes to a new branch, then open a pull request against
mainand be sure to add the "maintenance" label. - After the pull request is approved and merged, then navigate to Actions --> Release Gem --> run workflow --> Branch: main --> Run workflow.
License
vmpooler-provider-vsphere is distributed under the Apache License, Version 2.0. See the LICENSE file for more details.