Hello Developers,
During the preparation of our addon for the upcoming OpenNebula 4.14 I’ve stuck at a problem that I would like to discuss because I am not sure is it a new feature or fix to the existing feature.
The new feature #3782 to create snapshots have hard-coded size reporting in src/vmm_mad/remotes/poll_xen_kvm.rb that supports only devices of type rbd (for Ceph disks) and file (for qcow2 files as disks).
StorPool supports snapshots too but we work as raw disk device.
IMHO the code that collect stats should be open for additional external scripts to report the sizes.
I am proposing here a patch that is working only for disks with source attribute dev. It is calling an external program with the dev as only argument which is returning an XML with the info to fill the disk&snapshot size structures.
The returned XML schema is:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="disk">
<xs:element name="size" type="xs:positiveInteger"/>
<xs:element name="snapshot" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:positiveInteger"/>
<xs:element name="size" type="xs:positiveInteger"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:element>
</xs:schema>
If you prefer to not open the stats interface for snapshots to external scripts I should add the patch to our addon. But then I must track every change to the patched file and rebuild patches for every update.
I would like to have an interface in OpenNebula where to hook instead of patching core files. Probably other addons will use it too if their product support snapshots.
Probably the proposed patch is not the best solution but I hope you would use it at least as a reference what is our need.
0001-feature-3782-extend-to-return-disk-and-snapshot-info.patch (2.8 KB)
Kind Regards
Anton Todorov