No description
Find a file
Mahima Singh 4a57a270f6 Wire circuit breaker into vsphere provider public methods
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
2026-03-12 16:49:20 +05:30
.github Fix missing param in auto_release_prep 2024-01-15 09:25:02 -05:00
lib Wire circuit breaker into vsphere provider public methods 2026-03-12 16:49:20 +05:30
scripts Initial commit migrating from VMPooler proper 2021-11-29 16:03:09 -05:00
spec Fix getting IP by not returning a bad address 2023-08-21 23:27:03 -04:00
.github_changelog_generator Add changelog generation and release instructions 2023-01-27 15:33:56 -05:00
.gitignore Initial commit migrating from VMPooler proper 2021-11-29 16:03:09 -05:00
.rubocop.yml Fix naming, add docs, add missing test file 2021-12-01 15:59:03 -05:00
.rubocop_todo.yml Fix naming, add docs, add missing test file 2021-12-01 15:59:03 -05:00
CHANGELOG.md (maint) Release prep for version 3.3.4 2023-08-30 09:32:36 -07:00
CODEOWNERS Remove DIO as codeowners 2022-08-26 09:47:20 -04:00
Gemfile Initial commit migrating from VMPooler proper 2021-11-29 16:03:09 -05:00
Gemfile.lock (maint) Release prep for version 3.3.4 2023-08-30 09:32:36 -07:00
install-gemfile-lock Bump jruby to 9.4.3.0 and update lockfile 2023-08-10 10:10:23 -04:00
LICENSE Fix naming, add docs, add missing test file 2021-12-01 15:59:03 -05:00
Rakefile Initial commit migrating from VMPooler proper 2021-11-29 16:03:09 -05:00
README.md Revert "Migrate issue management to Jira" 2023-07-10 15:56:57 -04:00
release-prep Remove interactive option from release prep script 2024-01-19 15:33:34 -05:00
update-gemfile-lock Bump jruby to 9.4.3.0 and update lockfile 2023-08-10 10:10:23 -04:00
vmpooler-provider-vsphere.gemspec Bump vmpooler requirement and add install gemfile script 2023-04-17 09:07:49 -04:00

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.

  1. Bump the "VERSION" in lib/vmpooler-provider-vsphere/version.rb appropriately based on changes in CHANGELOG.md since the last release.
  2. Run ./release-prep to update Gemfile.lock and CHANGELOG.md.
  3. Commit and push changes to a new branch, then open a pull request against main and be sure to add the "maintenance" label.
  4. 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.