nova/nova
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
..
CA
api Merge "Use plain routes list for os-assisted-volume-snapshots endpoint" 2017-05-04 12:21:01 +00:00
cells Merge "remove log translation tags from nova.cells" 2017-04-21 15:24:59 +00:00
cloudpipe
cmd Remove nova-cert 2017-04-27 22:28:01 -04:00
common
compute Merge "Catching OverQuota Exception" 2017-05-04 11:10:03 +00:00
conductor Make conductor ask scheduler to limit migrates to same cell 2017-03-29 07:12:31 -07:00
conf Merge "conf: Deprecate 'default_floating_pool'" 2017-05-04 11:15:20 +00:00
console Add RPC version aliases for Ocata 2017-02-27 18:37:48 +04:00
consoleauth Make consoleauth target the proper cell 2017-03-07 15:33:50 -08:00
db Add ability to query for ComputeNodes by their mapped value 2017-04-27 19:50:59 -04:00
hacking remove hacking rule that enforces log translation 2017-03-16 09:56:21 -04:00
image Use cursive for signature verification 2017-03-28 01:41:41 -07:00
ipv6
keymgr
locale Imported Translations from Zanata 2017-03-03 10:09:38 +00:00
network Merge "neutron: retrieve physical network name from a multi-provider network" 2017-05-04 13:50:22 +00:00
notifications Transform instance.volume_attach notification 2017-05-02 16:00:23 -04:00
objects Add ability to query for ComputeNodes by their mapped value 2017-04-27 19:50:59 -04:00
pci Modify PciPassthroughFilter to accept lists 2017-04-11 19:49:07 +00:00
policies Merge "Add policy description for Servers IPs" 2017-05-04 03:55:22 +00:00
scheduler Merge "Add reserved_host_cpus option" 2017-04-28 23:50:46 +00:00
servicegroup Don't use 'updated_at' to check service's status 2016-12-08 09:51:03 +00:00
tests libvirt: Fix races with nfs volume mount/umount 2017-05-08 15:33:23 +00:00
virt libvirt: Fix races with nfs volume mount/umount 2017-05-08 15:33:23 +00:00
vnc
volume Catching OverQuota Exception 2017-05-03 19:00:34 +00:00
wsgi Clarify the language in the apache wsgi sample 2017-02-02 15:43:25 -08:00
__init__.py
availability_zones.py Make os-availability-zones know about cells 2017-03-15 11:02:58 -07:00
baserpc.py
block_device.py db: Add attachment_id to block_device_mapping 2017-03-16 15:26:33 -04:00
cache_utils.py remove log translation tags from nova.cells 2017-04-10 14:48:07 +00:00
config.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
context.py Temporarily untarget context when deleting from cell0 2017-03-13 13:45:03 -04:00
crypto.py
debugger.py
exception.py Merge "libvirt: Always disconnect_volume after rebase failures" 2017-04-26 11:39:46 +00:00
exception_wrapper.py Short circuit notifications when not enabled 2017-03-30 22:32:14 +00:00
filters.py
hooks.py
i18n.py
loadables.py
manager.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
policy.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
profiler.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
quota.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
rpc.py Clean up ClientRouter debt 2017-04-25 09:58:26 -07:00
safe_utils.py
service.py Remove nova-cert 2017-04-27 22:28:01 -04:00
service_auth.py Add service_token for nova-cinder interaction 2017-01-11 15:49:16 +00:00
test.py libvirt: Pass instance to connect_volume and disconnect_volume 2017-05-08 11:31:11 -04:00
utils.py Fix some reST field lists in docstrings 2017-03-23 09:25:37 +08:00
version.py
weights.py Correct some spelling errors 2017-02-25 02:45:30 +00:00
wsgi.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00