feat: add drives support in virtual machines#170
Open
javierlago-ticgal wants to merge 4 commits into
Open
Conversation
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.
Collaborator
|
Need : glpi-project/glpi-agent#1163 |
trasher
reviewed
May 19, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
drivesas an optional field insidevirtualmachines, referencing the existingdrivesdefinition 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 arevolumn(VHD path) andtotal(size in MB) — which belong to thedrivesschema, notstorages.The distinction matters: GLPI's
VirtualMachine.phpmaps these keys differently:drivesVolumestoragesDriveVHDs are logical volumes, so
drivesis the correct field. Usingstorageswould create hardware component entries (manufacturer, model, interface) which is semantically incorrect for virtual disk files.Changes
inventory.schema.json: adddrivesas optional field invirtualmachinesusing$ref: #/properties/content/properties/drivesexamples/computer_3_partial_hyperv_vms.json: Hyper-V VM example usingdriveswithvolumn/totalfieldsCHANGELOG.md: unreleased entryNotes
volumn(VHD path) andtotal(size in MB) — both present in thedrivesschema definitionVirtualMachine.phpalready mapsdrives → Volumeglpi-project/glpi-agentadding Hyper-V disk inventory support