Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

3417

May 3rd, 2017 05:00

How to determine a direction of replication

I'm looking for a method of determining source and target volumes in Unity uemcli environment. Also It's very interesting to determine a direction of replication for the volumes.

I'm writing a script for using in AIX PowerHA configuration. This script should has ability to determine a place of source or target volumes and select an action according this place. But an output of uemcli /prot/rep/session -name xxxx command shows:

1:    ID = yyy
      Name = xxx
      Session type = block
      Synchronization type = sync
      RPO = N/A
      Sync State = consistent
      Health state = OK (5)
      Operational status   = Active (0x840d)
      Time of last sync = N/A
      Sync status =
      Element pairs = sv_240=>sv_174, sv_241=>sv_175, sv_242=>sv_176, sv_239=>sv_17

And I don't see what kind of volumes placed on this site.

Do we have any method to recognize a direction of replication from uemcli?    

169 Posts

May 4th, 2017 03:00

I think you may also need to get "Local role" either via : uemcli /prot/rep/session show -detail or uemcli /prot/rep/session show -filter "Local role" (along with other values).Then you can decide the left values that is local to that box.

108 Posts

May 3rd, 2017 06:00

Hi vardua,

According the the UEMCLI documentation the element pairs field is:

Attribute Description Element pairs For consistency group and VMware VMFS datastore replications, the LUN element pairs within the replication.

Given that, if you use regular expressions you should be able to catch the element pairs line as a variable, then split what's after the 'pairs = ' on the comma and then again on the '=>'.  What you match on the left of '=>' is the source and what's to the right the destination, unless I have the elements pair field wrong? 

13 Posts

May 4th, 2017 02:00

Hello,

Thanks a lot for your answer. So, We should cut a LUN id sv_x, check it position in pair right/left and compare with output of Consistency_group_show command. This because output of replication_show command is the same for both, source and destination Unity boxes. This is a very unwieldy method, isn't it? I'll try to find another one.

108 Posts

May 4th, 2017 05:00

It's actually not that bad.  Here's a snippet of python code that does work:

x = 'Element pairs = sv_240=>sv_174, sv_241=>sv_175, sv_242=>sv_176, sv_239=>sv_17'

x.split(',')

list[0] = list[0].replace('Element pairs = ','')

for x in list:

     src,trgt = x.split('=>')

     print src

     print trgt

Obviously, you'd replace the print statements with whatever you need with to do with the source and target values (I'd probably add them to a list of tuples for further processing).  I hope this helps.

13 Posts

May 5th, 2017 08:00

Yes, you are right, but your results is a bit different from my target. :-)  I want to know is a current resource local or remote for this box. And the best way is a grep the output of show -detail command for Local state phrase.

But as I'm learning the python, your example is very useful for me. Thank you very much! 

13 Posts

May 5th, 2017 08:00

Yep!  that is what I need! Thunk you very much!

But in uemcli Guide the option -detail isn't listed. 

169 Posts

May 5th, 2017 16:00

detail is applicable to almost all the "show" output, so it must be mentioned in generic section. Default is -brief. You would have known by now, but in short, for every command, checking the syntax with -h will be handy:

Example:

uemcli /prot/rep/session -h

  [Show]

  /prot/rep/session [ { -id | -name | -res } ] show [ -output { nvp | csv | table [ -wrap ] } ] [ { -brief | -detail | -filter } ]

No Events found!

Top