The libvirt qemu hypervisor driver has long supported protecting disk devices from concurrent use via libvirt's lock manager interface. Xen used to support the same functionality in the old xend toolstack, but dropped support in the new libxl toolstack. The Xen community decided, rightly so, that this functionality is best provided by a higher-level management tool, e.g. libvirt.

This project aims to provide integration between libvirt's lock manager and the libxl hypervisor driver, essentially reintroducing support for disk device protection in the Xen management stack.

Looking for hackers with the skills:

virtualization c

This project is part of:

Hack Week 12


  • about 8 years ago: mlatimer liked this project.
  • about 8 years ago: jfehlig added keyword "c" to this project.
  • about 8 years ago: jfehlig added keyword "virtualization" to this project.
  • about 8 years ago: jfehlig started this project.
  • about 8 years ago: jfehlig originated this project.

  • Comments

    • jfehlig
      about 8 years ago by jfehlig | Reply

      I've made quite a bit of progress on this project thus far. First I had to introduce a conf file (/etc/libvirt/libxl.conf) to control behavior of the libxl driver. I needed to add a knob to go with the new conf file and decided on something simple: a bool to control autoballooning of domain0.

      On top of this patch I have a rather large patch that provides integration with libvirt's LockManager. sanlock or virtlockd can be used as the lock manager. Using virtlockd, I've been able to successfully prevent starting a domain on a host when the image used by the domain is in use by another domain on the same (or another) host.

      There is still lots of cleanup to do and corner cases to handle before I can send a V1 of the patch series to libvirt devel mail list. E.g. acquiring and dropping locks needs to be handled in migration, save, restore, pause, etc.

    • jfehlig
      about 8 years ago by jfehlig | Reply

      It has been a successful week for this project! I'm able to prevent starting a domain that contains a disk being used by another domain:

      host1 # virsh create sles12pv.xml

      Domain sles12gm-pv created from sles12pv.xml

      host2 # virsh create sles12pv.xml

      error: Failed to create domain from sles12pv.xml

      And prevent attaching a disk that is being used by another domain:

      error: resource busy: Lockspace resource '/mnt1/sles12gm-pv/disk0.raw' is locked

      host1 # virsh attach-device sles12pv disk.xml --live

      Device attached successfully

      host2 # virsh attach-device sles12hvm disk.xml --live

      error: Failed to attach device from disk.xml

      error: resource busy: Lockspace resource '/mnt1/images/blank-raw.disk' is locked

      I had time to cleanup the patch series and make it presentable as a V1 upstream

    Similar Projects

    Sandboxed USB Inspection by nguyens

    [comment]: # (Please use the project descriptio...

    Build a Unikernel that runs WebAssembly by flavio_castelli

    [comment]: # (Please use the project descriptio...

    Expanding e2e tests on Windows self-hosted runners via CI by iguimaraes


    • Documented all necessary s...

    Port OTPClient to GTK >= 4.10 by pstivanin

    Project Description

    OTPClient is currentl...

    Package libfyaml by tinita

    Project Description


    Dictu Language by bdowns328

    [comment]: # (Please use the project descriptio...

    Complete the port of flatpak to appstream from appstream-glib by ldragon

    [comment]: # (Please use the project descriptio...