Skip to content

feat: add drives support in virtual machines#170

Open
javierlago-ticgal wants to merge 4 commits into
glpi-project:mainfrom
TICGAL-GLPI-Plugins:feat/virtualmachine-storages
Open

feat: add drives support in virtual machines#170
javierlago-ticgal wants to merge 4 commits into
glpi-project:mainfrom
TICGAL-GLPI-Plugins:feat/virtualmachine-storages

Conversation

@javierlago-ticgal

@javierlago-ticgal javierlago-ticgal commented May 19, 2026

Copy link
Copy Markdown

Summary

Add drives as an optional field inside virtualmachines, referencing the existing drives definition at the computer level via $ref. This allows hypervisors such as Hyper-V to report virtual disk files (VHDs) per VM with their path and size.

Motivation

Hypervisors like Hyper-V expose virtual disk files (VHDs) per VM through WMI (Msvm_StorageAllocationSettingData). The relevant fields are volumn (VHD path) and total (size in MB) — which belong to the drives schema, not storages.

The distinction matters: GLPI's VirtualMachine.php maps these keys differently:

Field Asset class GLPI location
drives Volume Volumes tab
storages Drive Components tab (physical hardware)

VHDs are logical volumes, so drives is the correct field. Using storages would create hardware component entries (manufacturer, model, interface) which is semantically incorrect for virtual disk files.

Changes

  • inventory.schema.json: add drives as optional field in virtualmachines using $ref: #/properties/content/properties/drives
  • examples/computer_3_partial_hyperv_vms.json: Hyper-V VM example using drives with volumn/total fields
  • CHANGELOG.md: unreleased entry

Notes

  • Non-breaking change: the field is optional, existing inventories are unaffected
  • Agents send volumn (VHD path) and total (size in MB) — both present in the drives schema definition
  • No changes needed on the GLPI core side: VirtualMachine.php already maps drives → Volume
  • This PR is related to a pending contribution to glpi-project/glpi-agent adding Hyper-V disk inventory support

Add storages as an optional field in the virtualmachines schema definition,
reusing the existing storages $ref from the computer level. This allows
hypervisors such as Hyper-V to report virtual disk files (VHDs) with their
path and size as part of the VM inventory.
@stonebuzz

Copy link
Copy Markdown
Collaborator

Need : glpi-project/glpi-agent#1163

Comment thread examples/computer_2_partial_vms.json Outdated
storages maps to the Drive asset class in GLPI (physical hardware component),
while drives maps to Volume (logical volume, shown in Volumes tab). VHDs are
logical volumes, so drives with volumn/total fields is the correct mapping.

Update example to use volumn/total instead of name/disksize accordingly.
@javierlago-ticgal javierlago-ticgal changed the title feat: add storages support in virtual machines feat: add drives support in virtual machines May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants