Skip to content

[VM Discovery P4] Hypervisor connector (blocked: target hypervisor confirmation) #115

Description

@mayankpande88

Part of epic: nudgebee/nudgebee-enterprise#35404. Blocked on target-environment input: which hypervisor is in use. Build exactly one connector first — not all three.

What we're building, in one sentence

Ask the target environment's hypervisor for its list of VMs — because it's the only source that also knows about powered-off VMs (a powered-off VM answers no ping and no SSH; without the hypervisor it simply doesn't exist to us, and the coverage report would silently lie).

New action: discovery_hypervisor

Takes a datasource_id pointing at a configured hypervisor datasource (new datasource types, configured like the db proxies, read-only credentials via pkg/secrets).

Response per VM, whichever backend:

{"uuid": "4c4c4544-...", "name": "web-01", "power_state": "poweredOff",
 "guest_os": "Ubuntu 22.04", "ips": ["10.0.1.15"]}

The UUID is the point — it's the SMBIOS UUID the SSH inventory also sees from inside the guest (/sys/class/dmi/id/product_uuid), so the server can merge "VM per vCenter" and "host we SSHed into" into one asset.

The three candidate backends (build ONE)

vCenter — library: govmomi (Apache-2.0, VMware's own Go SDK). Property-collector query over all VMs for config.uuid, name, runtime.powerState, guest.guestFullName, guest.net. Credential: a vCenter user with the built-in Read-Only role.

Proxmox — plain REST, no SDK needed: GET /api2/json/cluster/resources?type=vm with an API token (PVEAuditor role = read-only). Returns vmid/name/status per node; VM UUID via the config endpoint.

libvirt/KVM without management UI — no daemon API exposed: SSH to the KVM host (reuse pkg/proxy/ssh plumbing) and run virsh list --all --name + virsh domuuid <name> + virsh domifaddr <name>. Slower, but works on any plain KVM box.

Acceptance criteria (each is a test)

  • Returns every VM on the hypervisor including powered-off ones, with UUID, name, power state, guest OS (when the hypervisor knows it), IPs (when tools/agent report them).
  • A VM powered off mid-test shows power_state: poweredOff on the next poll.
  • Credential is read-only: connector works with the read-only role and nothing more.
  • Server side: powered-off VM appears in the coverage report as gap reason powered-off, not as "unknown machine".

Design: docs/design/vm-discovery-phase0.md §5, §9 (PR #117).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions