Feature #3782: Return disk and snapshot information for Ceph disks

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:element name="id" type="xs:positiveInteger"/>
          <xs:element name="size" type="xs:positiveInteger"/>

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

It make sense; in fact the original plans where to evolve this as described
in your email. We’ll consider the patch for inclusion.


I am really happy that feature #4238 is upstream! Now we have driver for true block device in the core. I am bumping this thread because I believe it is time for merging the proposed patch in one form or another :slightly_smiling:

After some time and monitoring the code in production I have slight improvements that I would like to share.

  • the most suitable way to call the helper script is like:
            dev_xml = `../../vmm/kvm/poll_disk_info "#{dev}"`

It is because the vmm/kvm/poll is possible to be called directly or via im/kvm-probes.d/poll.sh With this construct it will work with both ways.

  • the helper script structure. Probably better approach is to search for scripts in a (sub?)folder, call all of them with same arguments as the helper and each script will decide to process or not based on the provided link. On success stop processing other scripts.

The helper script could report the context iso size too :slight_smile:

Most probably there is a development that I am not aware of, so please threat the above as honest suggestion based on my assumptions and experience.

Kind Regards,
Anton Todorov