XCP-ng DevBlog - SMAPIv3

Devblog Sep 19, 2019

The current storage interface protocol used in XCP-ng is an old protocol named SMAPIv1, and it hasn't been improved for some time. While being a very solid solution, it certainly lacks a lot of support for plugins, and has a lot of headroom for more performance.

However on the developers side, SMAPIv1 also lacks documentation and is difficult to maintain and improve. More importantly, adding new plugins is a lot of work that requires knowledge in tapdisk and blkback among other things. In short, working with SMAPIv1 is a pain and doesn't seem to be a suitable solution in the long term.

SMAPIv3 is a new and interesting alternative to creating new plugins without a deep knowledge of the storage.

What is SMAPIv3?

SMAPIv3 is a storage interface protocol that provides an easy way to connect the Xen API (xapi) to any storage type. It is also an Open Source API initially developed by Citrix for its hypervisor (Citrix hypervisor aka Xenserver). However even though the API itself is Open Source, the implementation by Citrix is not, therefore we decided to fork the initial project to create: xcp-ng-xapi-storage.

SMAPIv3 features and fork

The initial fork of the storage interface protocol contains libs, plugins and daemons. Currently, the original SMAPIv3 supports:

  • Storage Repositories: VDI collection from the same location.
  • VDIs may be created, cloned, snapshotted, queried, attached and detached from VMs. This stack is recent, so some features are missing and will be implemented in the future to get the same level of functionality as SMAPIv1.
  • Plugins are automatically loaded when they are added in specific folders monitored by a service: xapi-storage-script. It's an open source component created by Citrix.
  • The plugins expose capabilities and these are reported via the Xen API.
  • Good log integration (/var/log/SMlog).
  • Plugins separated into two types: Volume and Datapath.
    • Datapath plugins are in the more complicated category, a good knowledge of Xen is required. It's the link between the storage format (like raw device, VHD, Qcow2...) and the VM. Two plugins like this exist: qdisk and tapdisk, they are not used directly by developers to simplify the creation of Volume plugins.
    • Volume plugins exist to directly access the physical storage.
      For example a filebased plugin provides access to a folder to store VDIs, a file URI is given to this plugin to manage the folder. In other words: The URI encodes a method to access the disk data. I/O is the job of Datapath plugin, a Volume plugin is just a key to access the physical storage. Currently we have 3 plugins in this category: filebased, nfs and ext4.

storagescript

For more info, you can take a look at this original draft: https://xapi-project.github.io/xapi-storage

What we are currently working on

Currently we are working on three important aspects:

  • Make live migration possible in SMAPIv3, as it's currently not working. It's a top priority issue we are working on.
  • Improve the ecosystem by supporting new volume plugins. For example, we did so for ext4.
  • We are fixing various bugs and issues that have existed since the original SMAPIv3 project (eg. we already fixed the SR.set_name and SR.set_description implementation of plugins and other small issues). We also simplified the code for the filebased/nfs plugins.

For the future

  • Currently, we have noticed some issues in SMAPIv3's overall performance. This will require some work on other components (such as qemu-dp). This is something we are planning to work on in the future.
  • In a more general way, we want to work on the improvement of the SMAPIv3 ecosystem which means creating integration between SMAPIv3 and other tools (eg. export on the fly using xcp-ng-vdi-stream to avoid using NBD to export qcow2 images)

How to test SMAPIv3

⚠ The SMAPIv3 plugin is experimental, don't use it in a production environment.

If you want to contribute to the project, it's now possible to deploy the SMAPIv3 package in XCP-ng for testing.

Installation process

Use these commands to install the package:

yum install xcp-ng-xapi-storage --enablerepo=xcp-ng-testing
systemctl start qemuback.service

For issues, please read this page: https://github.com/xcp-ng/xcp-ng-xapi-storage#issues-and-solutions

Feedback & bug reports

Use this dedicated forum thread to discuss the experimental SMAPIv3 plugin.

Tags

Marc Pezin

CMO at Vates since 2017, I have been at the forefront of shaping and advancing the communication strategies and business development initiatives for Vates Virtualization Management Stack.