A few more active/active updates and fixes, also support new kevent paths

This commit is contained in:
wboyer 2008-11-20 01:20:20 +00:00
commit 335a13040d
12 changed files with 176 additions and 62 deletions

View file

@ -4,7 +4,7 @@
# materials are made available under the terms of the
# Common Public License v1.0 which accompanies this distribution.
INCLUDEDIR = -I.
INCLUDEDIR = -I. -I/usr/include/ncurses
CC = gcc
include version.mk

View file

@ -30,7 +30,7 @@ start() {
if [ ! -d /sys/class/scsi_generic ] ; then
modprobe sg
fi
start_daemon $IPRDUMP
start_daemon $IPRDUMP --daemon
RETVAL=$?
if [ $RETVAL -eq 0 ]; then

View file

@ -30,7 +30,7 @@ start() {
if [ ! -d /sys/class/scsi_generic ] ; then
modprobe sg
fi
$IPRUPDATE --daemon
start_daemon $IPRUPDATE --daemon
RETVAL=$?
if [ $RETVAL -eq 0 ]; then

View file

@ -3551,7 +3551,7 @@ int confirm_raid_start(i_container *i_con)
rc = is_array_in_use(ioa, cur_raid_cmd->array_id);
if (rc != 0) {
/* "Start Parity Protection failed." */
rc = 19;
rc = RC_19_Create_Fail;
syslog(LOG_ERR, _("Devices may have changed state. Command cancelled,"
" please issue commands again if RAID still desired %s.\n"),
ioa->ioa.gen_name);
@ -3675,12 +3675,12 @@ int raid_start_complete()
if (done_bad)
/* Start Parity Protection failed. */
return 19;
return RC_19_Create_Fail;
check_current_config(false);
/* Start Parity Protection completed successfully */
return 18;
return RC_18_Array_Created;
}
not_done = 0;
sleep(1);
@ -5068,7 +5068,7 @@ int asym_access_menu(i_container *i_con)
start_row = i_con->y + 2;
num_menu_items = ipr_debug ? 3 : 2;
num_menu_items = 3;
menu_item = malloc(sizeof(ITEM **) * (num_menu_items + 1));
userptr = malloc(sizeof(int) * num_menu_items);
@ -5084,13 +5084,11 @@ int asym_access_menu(i_container *i_con)
set_item_userptr(menu_item[menu_index],
(char *)&userptr[menu_index]);
if (ipr_debug) {
menu_index++;
menu_item[menu_index] = new_item("Not Set","");
userptr[menu_index] = 2;
set_item_userptr(menu_item[menu_index],
(char *)&userptr[menu_index]);
}
menu_index++;
menu_item[menu_index] = new_item("Not Set","");
userptr[menu_index] = 2;
set_item_userptr(menu_item[menu_index],
(char *)&userptr[menu_index]);
menu_index++;
menu_item[menu_index] = NULL;
@ -5102,7 +5100,7 @@ int asym_access_menu(i_container *i_con)
sprintf(i_con->field_data, "Optimized");
else if (*new_state == IPR_ACTIVE_NON_OPTIMIZED)
sprintf(i_con->field_data, "Non-Optimized");
else if (ipr_debug && *new_state == IPR_ACTIVE_STANDBY)
else if (*new_state == IPR_ACTIVE_STANDBY)
sprintf(i_con->field_data, "Not Set");
/* only issue the command if the state selection changed */
if (acd->dev->array_rcd->saved_asym_access_state != *new_state)
@ -5136,9 +5134,8 @@ int asym_access_menu(i_container *i_con)
* Returns:
* 0 if success / non-zero on failure
**/
int configure_asym_access(i_container *i_con)
int configure_asym_access(struct array_cmd_data *acd)
{
struct array_cmd_data *acd;
i_container *new_i_con, *i_con_head_saved;
int header_lines = 0;
char pref_str[20];
@ -5150,8 +5147,6 @@ int configure_asym_access(i_container *i_con)
i_con_head_saved = i_con_head;
i_con_head = new_i_con = NULL;
acd = i_con->data;
body = body_init(n_change_array_asym_access.header, &header_lines);
sprintf(buffer, "Array: %s", acd->dev->dev_name);
body = add_line_to_body(body, buffer, NULL);
@ -5195,11 +5190,8 @@ int configure_asym_access(i_container *i_con)
state = IPR_ACTIVE_OPTIMIZED;
else if (!strncmp(new_i_con->field_data, "Non-Optimized", 8))
state = IPR_ACTIVE_NON_OPTIMIZED;
else if (ipr_debug)
state = IPR_ACTIVE_STANDBY;
else
/* We should never get here. */
break;
state = IPR_ACTIVE_STANDBY;
acd->dev->array_rcd->issue_cmd = 1;
acd->dev->array_rcd->saved_asym_access_state = state;
@ -5229,7 +5221,7 @@ int process_asym_access(char *buffer[], int header_lines)
struct screen_output *s_out;
int found = 0;
int toggle = 1;
i_container *i_con, *temp_i_con;
i_container *i_con;
char *input;
int rc;
struct array_cmd_data *acd;
@ -5240,7 +5232,7 @@ int process_asym_access(char *buffer[], int header_lines)
do {
n_asym_access.body = buffer[toggle&1];
/* display array selection screen */
s_out = screen_driver(&n_asym_access, header_lines, i_con);
s_out = screen_driver(&n_asym_access, header_lines, NULL);
rc = s_out->rc;
free(s_out);
toggle++;
@ -5251,9 +5243,9 @@ int process_asym_access(char *buffer[], int header_lines)
found = 0;
/* do one at a time */
for_each_icon(temp_i_con) {
acd = temp_i_con->data;
input = temp_i_con->field_data;
for_each_icon(i_con) {
acd = i_con->data;
input = i_con->field_data;
if (acd && strcmp(input, "1") == 0) {
found++;
@ -5263,7 +5255,7 @@ int process_asym_access(char *buffer[], int header_lines)
if (found) {
/* Go to asymmetric access selection screen */
rc = configure_asym_access(temp_i_con);
rc = configure_asym_access(acd);
/* Done on success or exit */
if (rc == RC_SUCCESS || rc & EXIT_FLAG)
@ -5275,7 +5267,6 @@ int process_asym_access(char *buffer[], int header_lines)
s_status.index = INVALID_OPTION_STATUS;
}
check_current_config(false);
return rc;
}
@ -5301,11 +5292,13 @@ int asym_access(i_container *i_con)
/* make sure the i_con list is empty */
i_con = free_i_con(i_con);
check_current_config(false);
rc = RC_SUCCESS;
body_init_status(buffer, n_asym_access.header, &header_lines);
for_each_ioa(ioa) {
for_each_primary_ioa(ioa) {
if (!ioa->asymmetric_access || !ioa->asymmetric_access_enabled)
continue;
for_each_vset(ioa, vset) {
@ -12196,7 +12189,11 @@ static int raid_create(char **args, int num_args)
if (rc)
return rc;
return raid_start_complete();
rc = raid_start_complete();
if (rc == RC_18_Array_Created)
return 0;
else
return -EIO;
}
/**
@ -15352,6 +15349,13 @@ static int set_array_asymmetric_access(char **args, int num_args)
return -EINVAL;
}
/* Check that the adapter is a primary adapter. */
if (vset->ioa->is_secondary) {
ioa_err(vset->ioa, "Asymmetric access commands must be issued "
"for arrays on the primary IOA");
return -EINVAL;
}
/* Check that asymmetric access is supported by the adapter. */
if (!vset->ioa->asymmetric_access) {
ioa_err(vset->ioa, "Asymmetric access is not supported.");

View file

@ -296,6 +296,11 @@ s_node n_asym_access_fail = {
.header = {
__("There are no arrays eligible for the selected operation "
"due to one or more of the following reasons:\n\n"),
__("o Active/Active mode is not enabled on the IOAs.\n"),
__("o An IOA needs updated microcode in order to support "
"active/active configurations.\n"),
__("o None of the disk arrays in the system are capable of "
"changing asymmetric access attributes.\n"),
__("o There are no disk arrays in the system.\n"),
__("o An IOA is in a condition that makes the disks attached to "
"it read/write protected. Examine the kernel messages log "
@ -304,10 +309,6 @@ s_node n_asym_access_fail = {
"code to correct the problem, if necessary.\n"),
__("o Not all disks attached to an advanced function IOA have "
"reported to the system. Retry the operation.\n"),
__("o None of the disk arrays in the system are capable of "
"changing asymmetric access attributes.\n"),
__("o An IOA needs updated microcode in order to support "
"active/active configurations.\n"),
"" }
};

110
iprdump.c
View file

@ -10,7 +10,7 @@
*/
/*
* $Header: /cvsroot/iprdd/iprutils/iprdump.c,v 1.18 2006/09/08 16:26:01 brking Exp $
* $Header: /cvsroot/iprdd/iprutils/iprdump.c,v 1.19 2008/11/20 01:20:20 wboyer Exp $
*/
#ifndef iprlib_h
@ -53,6 +53,13 @@ static char usr_dir[100];
static char *enable = "1\n";
static char *disable = "0\n";
/**
* enable_dump -
* @ioa: ipr_ioa struct
*
* Returns:
* nothing
**/
static void enable_dump(struct ipr_ioa *ioa)
{
struct sysfs_class_device *class_device;
@ -92,6 +99,13 @@ static void enable_dump(struct ipr_ioa *ioa)
sysfs_close_class_device(class_device);
}
/**
* disable_dump -
* @ioa: ipr_ioa struct
*
* Returns:
* nothing
**/
static void disable_dump(struct ipr_ioa *ioa)
{
struct sysfs_class_device *class_device;
@ -128,6 +142,13 @@ static void disable_dump(struct ipr_ioa *ioa)
sysfs_close_class_device(class_device);
}
/**
* read_dump -
* @ioa: ipr_ioa struct
*
* Returns:
* number of items read
**/
static int read_dump(struct ipr_ioa *ioa)
{
struct sysfs_class_device *class_device;
@ -162,6 +183,13 @@ static int read_dump(struct ipr_ioa *ioa)
return count;
}
/**
* select_dump_file -
* @dirent: dirent struct
*
* Returns:
* 1 if the string is found, else 0
**/
static int select_dump_file(const struct dirent *dirent)
{
if (strstr(dirent->d_name, DUMP_PREFIX))
@ -169,6 +197,14 @@ static int select_dump_file(const struct dirent *dirent)
return 0;
}
/**
* dump_sort -
* @a: void buffer
* @b: void buffer
*
* Returns:
*
**/
static int dump_sort(const void *a, const void *b)
{
const struct dirent **dumpa = (const struct dirent **)a;
@ -185,6 +221,12 @@ static int dump_sort(const void *a, const void *b)
return alphasort(dumpa, dumpb);
}
/**
* cleanup_old_dumps -
*
* Returns:
* Nothing
**/
static void cleanup_old_dumps()
{
struct dirent **dirent;
@ -205,6 +247,13 @@ static void cleanup_old_dumps()
}
}
/**
* get_dump_fname -
* @fname: file name
*
* Returns:
* -EIO on error, else 0
**/
static int get_dump_fname(char *fname)
{
struct dirent **dirent;
@ -235,6 +284,14 @@ static int get_dump_fname(char *fname)
return 0;
}
/**
* write_dump -
* @ioa: ipr_ioa struct
* @count: size to write
*
* Returns:
* Nothing
**/
static void write_dump(struct ipr_ioa *ioa, int count)
{
int f_dump;
@ -256,6 +313,13 @@ static void write_dump(struct ipr_ioa *ioa, int count)
ioa_err(ioa, "Dump of ipr IOA has completed to file: %s\n", dump_path);
}
/**
* handle_signal -
* @signal: signal value
*
* Returns:
* Nothing
**/
static void handle_signal(int signal)
{
struct ipr_ioa *ioa;
@ -266,6 +330,13 @@ static void handle_signal(int signal)
exit(0);
}
/**
* select_dump_file -
* @ioa: ipr_ioa struct
*
* Returns:
* Nothing
**/
static void dump_ioa(struct ipr_ioa *ioa)
{
int count;
@ -278,6 +349,12 @@ static void dump_ioa(struct ipr_ioa *ioa)
enable_dump(ioa);
}
/**
* poll_for_dump -
*
* Returns:
* Nothing
**/
static void poll_for_dump()
{
struct ipr_ioa *ioa;
@ -290,16 +367,27 @@ static void poll_for_dump()
dump_ioa(ioa);
}
/**
* kevent_handler -
* @buf: character buffer
*
* Returns:
* Nothing
**/
static void kevent_handler(char *buf)
{
struct ipr_ioa *ioa;
int host, i;
char *index;
if (strncmp(buf, "change@/class/scsi_host", 23))
if (!strncmp(buf, "change@/class/scsi_host", 23)) {
host = strtoul(&buf[28], NULL, 10);
} else if (!strncmp(buf, "change@/devices/pci", 19) && strstr(buf, "scsi_host")) {
index = strrchr(buf, '/');
host = strtoul(index + 5, NULL, 10);
} else
return;
host = strtoul(&buf[28], NULL, 10);
for (i = 0; i < 10; i++) {
tool_init(0);
ioa = find_ioa(host);
@ -317,6 +405,14 @@ static void kevent_handler(char *buf)
dump_ioa(ioa);
}
/**
* main -
* @argc: argument count
* @argv: argument string
*
* Returns:
* return value of handle_events() call
**/
int main(int argc, char *argv[])
{
struct ipr_ioa *ioa;
@ -338,13 +434,15 @@ int main(int argc, char *argv[])
} else {
printf("Usage: "TOOL_NAME" [options]\n");
printf(" Options: --version Print iprdump version\n");
printf(" --daemon Run as a daemon\n");
printf(" --debug Print extra debugging information\n");
printf(" -d <usr_dir>\n");
exit(1);
}
}
ipr_daemonize();
if (daemonize)
ipr_daemonize();
signal(SIGINT, handle_signal);
signal(SIGQUIT, handle_signal);
@ -356,5 +454,3 @@ int main(int argc, char *argv[])
return handle_events(poll_for_dump, 60, kevent_handler);
}

View file

@ -1,7 +1,7 @@
/**
* IBM IPR adapter initialization utility
*
* (C) Copyright 2004
* (C) Copyright 2004, 2008
* International Business Machines Corporation and others.
* All Rights Reserved. This program and the accompanying
* materials are made available under the terms of the
@ -10,7 +10,7 @@
*/
/*
* $Header: /cvsroot/iprdd/iprutils/iprinit.c,v 1.21 2005/03/07 17:20:16 brking Exp $
* $Header: /cvsroot/iprdd/iprutils/iprinit.c,v 1.22 2008/11/20 01:20:20 wboyer Exp $
*/
#include <unistd.h>
@ -41,9 +41,11 @@ static void kevent_handler(char *buf)
{
polling_mode = 0;
if (!strncmp(buf, "change@/class/scsi_host", 23))
if (!strncmp(buf, "change@/class/scsi_host", 23) ||
(!strncmp(buf, "change@/devices/pci", 19) && strstr(buf, "scsi_host")))
scsi_host_kevent(buf, ipr_init_ioa);
else if (!strncmp(buf, "add@/class/scsi_generic", 23))
else if (!strncmp(buf, "add@/class/scsi_generic", 23) ||
(!strncmp(buf, "add@/devices/pci", 16) && strstr(buf, "scsi_generic")))
scsi_dev_kevent(buf, find_gen_dev, ipr_init_dev);
else if (!strncmp(buf, "add@/block/sd", 13))
scsi_dev_kevent(buf, find_blk_dev, ipr_init_dev);

View file

@ -10,7 +10,7 @@
*/
/*
* $Header: /cvsroot/iprdd/iprutils/iprlib.c,v 1.121 2008/10/23 17:11:20 wboyer Exp $
* $Header: /cvsroot/iprdd/iprutils/iprlib.c,v 1.122 2008/11/20 01:20:20 wboyer Exp $
*/
#ifndef iprlib_h
@ -5087,6 +5087,8 @@ static void get_ioa_cap(struct ipr_ioa *ioa)
if (page24->dual_adapter_af == ENABLE_DUAL_IOA_ACTIVE_ACTIVE) {
ioa->dual_raid_support = 1;
ioa->asymmetric_access_enabled = 1;
} else {
ioa->asymmetric_access_enabled = 0;
}
}
}
@ -6148,6 +6150,7 @@ int ipr_set_ioa_attr(struct ipr_ioa *ioa, struct ipr_ioa_attr *attr, int save)
/* FIXME - preferred_primary and active_active may change at the same
* time. This code may need to change.
*/
if (attr->preferred_primary != old_attr.preferred_primary)
if (ipr_change_multi_adapter_assignment(ioa, attr->preferred_primary, IPR_PRESERVE_ASYMMETRIC_STATE))
return -EIO;
@ -6171,15 +6174,17 @@ int ipr_set_ioa_attr(struct ipr_ioa *ioa, struct ipr_ioa_attr *attr, int save)
if (attr->active_active) {
if (ipr_set_active_active_mode(ioa))
return -EIO;
if (save)
ipr_save_ioa_attr(ioa, IPR_DUAL_ADAPTER_ACTIVE_ACTIVE, temp, 1);
} else {
if (save)
ipr_save_ioa_attr(ioa, IPR_DUAL_ADAPTER_ACTIVE_ACTIVE, temp, 1);
ipr_reset_adapter(ioa);
if (ipr_change_multi_adapter_assignment(ioa,
attr->preferred_primary,
attr->active_active))
return -EIO;
}
if (save)
ipr_save_ioa_attr(ioa, IPR_DUAL_ADAPTER_ACTIVE_ACTIVE, temp, 1);
}
get_dual_ioa_state(ioa); /* for preferred_primary */
@ -8122,7 +8127,7 @@ void scsi_dev_kevent(char *buf, struct ipr_dev *(*find_device)(char *),
}
/**
* scsi_host_kevent - Start array protection for an array
* scsi_host_kevent -
* @buf: data buffer
* @func: funtion pointer
*

View file

@ -12,7 +12,7 @@
*/
/*
* $Header: /cvsroot/iprdd/iprutils/iprlib.h,v 1.104 2008/10/23 17:11:20 wboyer Exp $
* $Header: /cvsroot/iprdd/iprutils/iprlib.h,v 1.105 2008/11/20 01:20:20 wboyer Exp $
*/
#include <stdarg.h>
@ -185,7 +185,7 @@
#define IPR_ACTIVE_NON_OPTIMIZED 0x1
#define IPR_ACTIVE_STANDBY 0x2
#define IPR_CLEAR_ASYMMETRIC_STATE 0x0
#define IPR_PRESERVE_ASYMMETRIC_STATE 0x1
#define IPR_PRESERVE_ASYMMETRIC_STATE 0x80
#define IPR_IS_DASD_DEVICE(std_inq_data) \
((((std_inq_data).peri_dev_type) == TYPE_DISK) && !((std_inq_data).removeable_medium))

View file

@ -1,7 +1,7 @@
/**
* IBM IPR adapter microcode update utility
*
* (C) Copyright 2000, 2004
* (C) Copyright 2000, 2008
* International Business Machines Corporation and others.
* All Rights Reserved. This program and the accompanying
* materials are made available under the terms of the
@ -10,7 +10,7 @@
*/
/*
* $Header: /cvsroot/iprdd/iprutils/iprupdate.c,v 1.22 2006/01/05 20:20:48 brking Exp $
* $Header: /cvsroot/iprdd/iprutils/iprupdate.c,v 1.23 2008/11/20 01:20:20 wboyer Exp $
*/
#include <unistd.h>
@ -182,9 +182,11 @@ static void kevent_handler(char *buf)
{
polling_mode = 0;
if (!strncmp(buf, "change@/class/scsi_host", 23))
if (!strncmp(buf, "change@/class/scsi_host", 23) ||
(!strncmp(buf, "change@/devices/pci", 19) && strstr(buf, "scsi_host")))
scsi_host_kevent(buf, update_ioa);
else if (!strncmp(buf, "add@/class/scsi_generic", 23))
else if (!strncmp(buf, "add@/class/scsi_generic", 23) ||
(!strncmp(buf, "add@/devices/pci", 16) && strstr(buf, "scsi_generic")))
scsi_dev_kevent(buf, find_gen_dev, update_disk_fw);
else if (!strncmp(buf, "add@/block/sd", 13))
scsi_dev_kevent(buf, find_blk_dev, update_disk_fw);

View file

@ -1,6 +1,6 @@
Summary: Utilities for the IBM Power Linux RAID adapters
Name: iprutils
Version: 2.2.12
Version: 2.2.13
Release: 1
License: CPL
Group: System Environment/Base
@ -81,6 +81,10 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/ha.d/resource.d/iprha
%changelog
* Mon Nov 17 2008 Wayne Boyer <wayneb@linux.vnet.ibm.com> 2.2.13
- Release 2.2.13
- Additional fixes for the active-active functionality.
- Fixes for iprdump to recognize a /sys/devices path.
* Thu Oct 23 2008 Wayne Boyer <wayneb@linux.vnet.ibm.com> 2.2.12
- Release 2.2.12
- Additional GUI support and fixes for the active-active functionality.

View file

@ -1,4 +1,4 @@
# (C) Copyright 2000, 2001
# (C) Copyright 2000, 2008
# International Business Machines Corporation and others.
# All Rights Reserved. This program and the accompanying
# materials are made available under the terms of the
@ -6,9 +6,9 @@
IPR_MAJOR_RELEASE=2
IPR_MINOR_RELEASE=2
IPR_FIX_LEVEL=12
IPR_FIX_LEVEL=13
IPR_RELEASE=1
IPR_FIX_DATE=(October 23, 2008)
IPR_FIX_DATE=(November 17, 2008)
IPR_VERSION_STR=$(IPR_MAJOR_RELEASE).$(IPR_MINOR_RELEASE).$(IPR_FIX_LEVEL) $(IPR_FIX_DATE)