Migrating active partitions using Live Partition Mobility

This page has not been liked. Updated 4/5/13 12:52 PM by jerberstarkTags: None

Introduction

Live Partition Mobility is a feature of PowerVM that allows for migrating active partitions from one physical server to another without disrupting the running applications. Generally, applications are completely unaware that a migration has occurred, and there is no need for the applications to be aware. However, some special purpose applications might need to be informed that a migration has occurred. This document details an example of one such application.

Example

In this example, the application is a clustering application using Virtual Fibre Channel (NPIV) for storage access. The application uses SCSI reservations to control access to the shared LUNs. When a SCSI reservation is performed, the reservation is acquired for the I_T_L nexus between the NPIV port and the target being reserved. When a partition migration event occurs, this I_T_L nexus changes. Each Virtual Fibre Channel port has two WWPNs associated with it, for use during migration. Each time a partition migration occurs, the WWPN in use will toggle to the alternate WWPN. For our example application, this means that the application will need to clear the reservation for the previous I_T_L nexus and acquire a new reservation for the new I_T_L nexus.

Prerequisite Software

The first step in preparing for notifications of Partition Mobility events is to install the prerequisite software. Go to: http://www14.software.ibm.com/webapp/set2/sas/f/lopdiags/home.html, select the Linux distribution you are using as well as the management method for the server, select the Linux release, and then download and install all the packages listed on the page. Ensure that you have DynamicRM version 1.3.7 or later installed to get this functionality.

Notification Script

The Live Partition Mobility notification mechanism that is available for Linux on Power uses servicelog for event notification. Applications or scripts can be registered with servicelog to run when certain events occur. The event we are interested in is mobility. The following is a simple perl script to run when a migration event occurs:

#!/usr/bin/perl
open(OUTFILE, ">> /var/log/mobility_notify.log");

while (<STDIN>) {
        if (lc($_) =~ /^refcode/ && $_ =~ /#MIGRATE/) {
                print OUTFILE "Migration occurred: $ARGV[0]\n";

        # Insert code here to move SCSI reservation from old
        # I_T_L_to new I_T_L Nexus

                last;
        }
}

close OUTFILE;

This script logs a short message indicating a migration occurred to the /var/log/mobility_notify.log file if it receives a partition migration servicelog notification from stdin. For this example, this script is named /usr/local/bin/mobility_notify.pl. You could also easily add a bit of code here to move the SCSI reservation from the old I_T_L nexus to the new I_T_L nexus after the migration.

Next, register the script with servicelog. Depending on the version of servicelog being used, the syntax to do this might be slightly different. To check the version of servicelog, run the "rpm -q servicelog" command. Look for either servicelog-0.2.9 or servicelog-1.0.1, depending on the Linux release you're using.

Registering with servicelog 0.2.9

To register with servicelog 0.2.9, run the following command:

servicelog_notify --add --command="/usr/local/bin/mobility_notify.pl arg"  \
    --type=os --method=pairs_stdin

This will register the script with servicelog so that it will run for all servicelog events. To narrow the focus to only migration events, the script is filtering on just migration events. Here is an example of what the script would receive:

ServicelogID: 23

EventType: OS Event

Version: 1

RepairAction: 0

Serviceable: 0

Repaired: 0

EventTime: 08/13/2010 09:42:34

LogTime: 08/13/2010 09:42:34

Severity: 2

RepairEventKey:

Refcode: #MIGRATE

Subsystem:

Message: Partition migration completed

RepairProcedure: (null)

Registering with servicelog 1.0.1

To register with servicelog 1.0.1, run the following command:

servicelog_notify --add --command="/usr/local/bin/mobility_notify.pl arg" \
    --type=EVENT --match='refcode="#MIGRATE"' --method=pairs_stdin

The match option is a new option with servicelog 1.0. If you are using a common script that is compatible with servicelog 0.2.9, you can decide to leave this option out. Here is an example of what the script would receive:

ServicelogID: 14

LogTime: 08/10/2010 16:14:33

EventTime: 08/10/2010 16:14:33

LastUpdateTime: 08/10/2010 16:14:33

EventType: Basic Event

Severity: 2

Platform: ppc64

MachineSerial: XXXXXXX

MachineModel: 9117-MMA

NodeName: myhost

RefCode: #MIGRATE

Description: Partition migration completed

Serviceable: 0

Predictive: 0

Disposition: 0

CallHomeStatus: 0

Closed: 1

RepairID: 0

Additional Notes

Registering with servicelog makes an entry into a local database, so it is not necessary to re-register on each boot.

The registration examples above specify that "arg" is passed as a parameter to the notification script. You could also specify a device, such as /dev/sdc, and the script would manage moving the SCSI reservation for that single device. You could then register with servicelog for each device for which you want to manage a SCSI reservation.