File 0001-Remove-error-messages-from-multipath-command-output-.patch of Package openstack-nova

From 80f51443d30034d9cfd3f98745fe4607ae9e7ab8 Mon Sep 17 00:00:00 2001
From: Ralf Haferkamp <rhafer@suse.de>
Date: Thu, 8 Oct 2015 18:01:28 +0200
Subject: [PATCH] Remove error messages from multipath command output before
 parsing

This fixes an issue in _get_multipath_device_name() that fails to
parse the output from 'multipath -ll <device>' command when the
stdout contains error messages in addition to the expected output.

Change-Id: I59bf37a932acd97cf915d086b4072b71e8214936
Related-Bug: #1380742
Partial-Bug: #1433204

This is a port of commit 99d67bd77cbc83c0a465c64fce2827ee5d5d0afc
from the os-brick project.
---
 nova/virt/libvirt/volume.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: nova-2014.2.4.dev84/nova/virt/libvirt/volume.py
===================================================================
--- nova-2014.2.4.dev84.orig/nova/virt/libvirt/volume.py
+++ nova-2014.2.4.dev84/nova/virt/libvirt/volume.py
@@ -18,6 +18,7 @@
 
 import glob
 import os
+import re
 import time
 import urllib2
 
@@ -40,6 +41,8 @@ from nova.virt.libvirt import utils as l
 
 LOG = logging.getLogger(__name__)
 
+MULTIPATH_ERROR_REGEX = re.compile("\w{3} \d+ \d\d:\d\d:\d\d \|.*$")
+
 volume_opts = [
     cfg.IntOpt('num_iscsi_scan_tries',
                default=5,
@@ -614,7 +617,7 @@ class LibvirtISCSIVolumeDriver(LibvirtBa
                                   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)] # ignore udev errors
         if len(mpath_line) > 0 and len(mpath_line[0]) > 0:
             return "/dev/disk/by-id/dm-name-%s" % mpath_line[0].split(" ")[0]
 
openSUSE Build Service is sponsored by