Multipath bindings

From VVCWiki
Revision as of 19:38, 18 May 2016 by Vvc (talk | contribs) (Created page with "* Create file with friendly names and LUN id, for example <pre> ORACLE_UAT_BWDLIVE_ARCH_1 10 ORACLE_UAT_BWDLIVE_DATA_1 11 ORACLE_UAT_BWDLIVE_DATA_2 12 </pre> * Run mpath-...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
  • Create file with friendly names and LUN id, for example
ORACLE_UAT_BWDLIVE_ARCH_1  10
ORACLE_UAT_BWDLIVE_DATA_1  11
ORACLE_UAT_BWDLIVE_DATA_2  12
  • Run mpath-bindings script:
#!/usr/bin/perl

use strict;

my $wwid='';
my ($lun, $device);

my $mapfile = $ARGV[0];
my %maps = ();
open(MF,"<$mapfile") or die "Couldn't open $mapfile with VOL_NAME LUN_ID";
while (my $line = <MF>) {
  if ($line =~ m/^(\w+)\W+(\d+)/ ) {
    my $vol = $1;
    my $id  = $2;
    $maps{$id} = $vol;
  }
}
close(MF);

open(MP,'multipath -l|') or die "$@";
while(my $line=<MP>) {
  if ($line =~ m/^(\w+)\s+\((\w+)\)/ ) {
    if ($wwid ne '') {
      print $maps{$lun},"\t",$wwid,"\n";
    }
    $device = $1;
    $wwid   = $2;
  } elsif ($line =~ m/\d+:\d+:\d+:(\d+)/ ) {
    $lun = $1;
  }
}
if ($wwid ne '') {
  print $maps{$lun},"\t",$wwid,"\n";
}
close(MP) or die "$@";
  • stop mutipathd
service mutipathd stop
  • flush multipath maps
multipath -F
  • replace content of /etc/multipath/bindings with output of the perl script
# Multipath bindings, Version : 1.0
#
# Format:
# alias wwid
#
ORACLE_UAT_BWDLIVE_ARCH_1	3624a937071eb00640bd43d2a00012813
ORACLE_UAT_BWDLIVE_DATA_1	3624a937071eb00640bd43d2a00012811
ORACLE_UAT_BWDLIVE_DATA_2	3624a937071eb00640bd43d2a00012812
  • adjust /etc/mutipath.conf
defaults {
        find_multipaths no
        user_friendly_names yes
}
  • start mutipathd
service multipathd start
  • enjoy
# multipath -ll