File 0001-Fix-failure-to-attach-iscsi-volume-with-multipath.patch of Package openstack-nova
From f0cfab6b50dc14397029f6457b90631bfff4eee4 Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@suse.com>
Date: Wed, 29 Jul 2015 12:30:12 +0200
Subject: [PATCH] Fix failure to attach iscsi volume with multipath
"multipath -ll" can return various different errors, and we only filter
one kind of error, but that's not enough.
Instead, we can take the approach that os-brick picked, which is to
filter lines that look like error lines (starting with a date).
Change-Id: I491b6a939ff1a15d158b302a82045de16b3aa45b
Closes-Bug: #1479291
---
nova/virt/libvirt/volume.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/nova/virt/libvirt/volume.py b/nova/virt/libvirt/volume.py
index d60c162..5e0ec60 100644
--- a/nova/virt/libvirt/volume.py
+++ b/nova/virt/libvirt/volume.py
@@ -118,6 +118,8 @@ volume_opts = [
CONF = cfg.CONF
CONF.register_opts(volume_opts, 'libvirt')
+MULTIPATH_ERROR_REGEX = re.compile("\w{3} \d+ \d\d:\d\d:\d\d \|.*$")
+
class LibvirtBaseVolumeDriver(object):
"""Base class for volume drivers."""
@@ -749,7 +751,7 @@ class LibvirtISCSIVolumeDriver(LibvirtBaseVolumeDriver):
device],
check_exit_code=[0, 1])[0]
mpath_line = [line for line in out.splitlines()
- if "scsi_id" not in line] # ignore udev errors
+ if not re.match(MULTIPATH_ERROR_REGEX, line)]
if len(mpath_line) > 0 and len(mpath_line[0]) > 0:
return "/dev/mapper/%s" % mpath_line[0].split(" ")[0]
--
2.4.6