nova/nova/virt/libvirt
Matthew Booth 4aa39c44a4 libvirt: Fix races with nfs volume mount/umount
A single nfs export typically contains multiple volumes. We were
handling this in the libvirt driver by:

1. On mount, we 'ensure' the mount is available, so we don't fail if
   another instance already has it mounted.

2. On umount, we trap and ignore 'device is busy' so we don't fail if
   another instance is already using it.

Unfortunately, while this works for serial mounts and unmounts, there
are multiple failure cases when volumes from the same export are
mounted and unmounted simultaneously. It causes an error if an
instance is stopped: as the qemu process is not actively using the
mountpoint it will not prevent an unmount for another volume on the
same mountpoint from succeeding. It will not be possible to restart
the instance, because its mountpoint will not be mounted.

To fix this, we create a singleton manager object, which tracks mounts
and umount requests per export, and calls the real mount/umount only
when required. It uses per-export locks to allow concurrency while
avoiding races. Because we now expect to know the state of the host at
all times, we no longer need to execute speculative mount/umount
commands.

As we track attachments (a mapping from volume to instance) rather
than volumes, we also gracefully support multi-attach.

This change implements this for nfs, but the solution is intended to
be extended to all LibvirtBaseFileSystemVolumeDrivers.

Closes-Bug: #1421550
Change-Id: I3155984d76df06371a6c45f633aa448168a96d64
2017-05-08 15:33:23 +00:00
..
storage Port libvirt.storage.test_rbd to Python 3 2016-12-15 13:38:53 +00:00
volume libvirt: Fix races with nfs volume mount/umount 2017-05-08 15:33:23 +00:00
__init__.py Remove vi modelines 2014-02-03 14:19:44 +00:00
blockinfo.py Merge "Fix root_device_name for Xen" 2017-01-31 18:56:46 +00:00
compat.py Replace deprecated LOG.warn with LOG.warning 2016-03-15 11:57:56 +00:00
config.py Read NIC features in libvirt 2017-04-11 14:38:19 +00:00
designer.py libvirt: conditionally set script path for ethernet vif types 2017-03-21 14:12:39 -04:00
driver.py libvirt: Fix races with nfs volume mount/umount 2017-05-08 15:33:23 +00:00
firewall.py Merge "libvirt: Ignore 'allow_same_net_traffic' for port filters" 2017-04-05 20:27:49 +00:00
guest.py Spelling error "paramenter" 2017-04-17 16:40:50 +08:00
host.py Merge "Avoid multiple initializations of Host class" 2017-02-25 14:54:01 +00:00
imagebackend.py Merge "get_model method missing for Ploop image" 2017-03-20 13:33:38 +00:00
imagecache.py Don't check for file type in _find_base_file 2017-04-27 10:42:26 +01:00
instancejobtracker.py Replace deprecated LOG.warn with LOG.warning 2016-03-15 11:57:56 +00:00
migration.py Use flake8-import-order 2017-03-06 06:50:23 -08:00
utils.py Merge "libvirt: workaround findmnt behaviour change" 2017-02-03 13:37:23 +00:00
vif.py Add lan9118 as valid nic for hw_vif_model property for qemu 2017-03-22 17:06:29 +00:00