All of lore.kernel.org
 help / color / mirror / Atom feed
* Hitachi prioritizer ?
@ 2006-02-09 23:21 Christophe Varoqui
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe Varoqui @ 2006-02-09 23:21 UTC (permalink / raw)
  To: device-mapper development

Funny to learn from this article the existence of a new prioritizer from
Hitachi : pp_hds_modular.

Is there Hitachi people hanging here and willing to comment on the
general availability of this tool ?

Regards,
cvaroqui

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Hitachi prioritizer ?
@ 2006-04-18 10:26 Matthias Rudolph
  2006-04-21 21:38 ` Christophe Varoqui
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Rudolph @ 2006-04-18 10:26 UTC (permalink / raw)
  To: dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 330 bytes --]

I have written this prioritizer. It is for Hitachi Modular Storage
Arrays with Active/Passive design (9200=DF500, 9500V=DF600,
AMS,WMS=DF700). The code is Opene Source - GPL. Suse is interested in
including this modul in one of the next SLES releases.

Send me an email for getting the source...

Regards, Matthias

 


[-- Attachment #1.2: Type: text/html, Size: 2177 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Hitachi prioritizer ?
  2006-04-18 10:26 Hitachi prioritizer ? Matthias Rudolph
@ 2006-04-21 21:38 ` Christophe Varoqui
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe Varoqui @ 2006-04-21 21:38 UTC (permalink / raw)
  To: device-mapper development

Matthias Rudolph a écrit :
>
> I have written this prioritizer. It is for Hitachi Modular Storage 
> Arrays with Active/Passive design (9200=DF500, 9500V=DF600, 
> AMS,WMS=DF700). The code is Opene Source – GPL. Suse is interested in 
> including this modul in one of the next SLES releases.
>
> Send me an email for getting the source…
>
> Regards, Matthias
>
I confirm interest in reviewing and eventually merging this prioritizer 
in the upstream multipath tools package.

Please post the code.

Thanks for your work,
cvaroqui

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Hitachi prioritizer ?
@ 2006-04-24 12:27 Matthias Rudolph
  2006-04-24 15:30 ` Christophe Varoqui
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Rudolph @ 2006-04-24 12:27 UTC (permalink / raw)
  To: dm-devel; +Cc: christophe varoqui, Long Tran

[-- Attachment #1: Type: text/plain, Size: 7527 bytes --]

Hi all,
here is the source. Feel free with it:



/*
 * (C) Copyright HDS GmbH 2006. All Rights Reserved.
 *
 * pp_hds_modular.c
 * Version 1.12
 *
 * Prioritizer for multipath tools device mapper and HDS Storage
 *
 * Hitachis Modular Storage contains two controllers for redundancy. The
Storage internal LUN (LDEV)
 * will normally allocated via two pathes to the server (one path per
controller). For performance
 * reasons should the server access to a LDEV only via one controller.
The other path to the other
 * controller is stand-by. It is also possible to allocate more as one
path for a LDEV per controller.
 * Here is active/active access allowed. The other pathes via the other
controller are stand-by.
 *
 * This prioritizer checks with inquiry commands the represented LDEV
and Controller number and gives
 * back a priority followed by this scheme:
 *
 * CONTROLLER ODD  and LDEV  ODD: PRIORITY 1
 * CONTROLLER ODD  and LDEV EVEN: PRIORITY 0
 * CONTROLLER EVEN and LDEV  ODD: PRIORITY 0
 * CONTROLLER EVEN and LDEV EVEN: PRIORITY 1
 *
 * In the storage you can define for each LDEV a owner controller. If
the server makes IOs via the
 * other controller the storage will switch the ownership automatically.
In this case you can see
 * in the storage that the current controller is different from the
default controller, but this is
 * absolutely no problem.
 *
 * With this prioritizer it is possible to establish a static load
balancing. Half of the LUNs are
 * accessed via one HBA/storage controller and the other half via the
other HBA/storage controller.
 *
 * In cluster environmemnts (RAC) it also guarantees that all cluster
nodes have access to the LDEVs
 * via the same controller.
 * 
 * You can run the prioritizer manually in verbose mode:
 * # pp_hds_modular -v 8:224
 * VENDOR:  HITACHI
 * PRODUCT: DF600F-CM
 * SERIAL:  0x0105
 * LDEV:    0x00C6
 * CTRL:    1
 * PORT:    B
 * CTRL ODD, LDEV EVEN, PRIO 0
 *
 * The items VENDOR and PRODUCT helps you to make the correct entries in
file /etc/multipath.conf:
 * # cat /etc/multipath.conf
 * ...
 * devices {
 *        device {
 *                vendor                  "HITACHI"
 *                product                 "DF600F"
 *                path_grouping_policy    group_by_prio
 *                prio_callout            "/sbin/pp_hds_modular %d"
 *                path_checker            readsector0
 *                getuid_callout          "/sbin/scsi_id -g -u -s
/block/%n"
 *                failback                immediate
 *        }
 *        device {
 *                vendor                  "HITACHI"
 *                product                 "DF600F-CM"
 *                path_grouping_policy    group_by_prio
 *                prio_callout            "/sbin/pp_hds_modular %d"
 *                path_checker            readsector0
 *                getuid_callout          "/sbin/scsi_id -g -u -s
/block/%n"
 *                failback                immediate
 *
 *
 * Author: Matthias Rudolph <matthias.rudolph@hds.com>
 *
 * This file is released under the GPL.
 *
 */

#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <libdevmapper.h>
#include <memory.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <scsi/sg.h> /* take care: fetches glibc's
/usr/include/scsi/sg.h */

#define INQ_REPLY_LEN 255
#define INQ_CMD_CODE 0x12
#define INQ_CMD_LEN 6
#define FILE_NAME_SIZE 255
#define safe_sprintf(var, format, args...)	\
	snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
#define safe_snprintf(var, size, format, args...)      \
	snprintf(var, size, format, ##args) >= size

int verbose;

int hds_modular_prio(char * major_minor) {

	int sg_fd, k, i;
	char vendor[32];
	char product[32];
	char serial[32];
	char ldev[32];
	char ctrl[32];
	char port[32];
	char devpath[FILE_NAME_SIZE];
	unsigned int major;
	unsigned int minor;
	unsigned char inqCmdBlk[INQ_CMD_LEN] = {INQ_CMD_CODE, 0, 0, 0,
INQ_REPLY_LEN, 0};
	unsigned char inqBuff[INQ_REPLY_LEN];
	unsigned char sense_buffer[32];
	sg_io_hdr_t io_hdr;

	sscanf(major_minor, "%u:%u", &major, &minor);
	memset(devpath, 0, FILE_NAME_SIZE);

	if (safe_sprintf(devpath, "/tmp/.pp_balance.%u.%u.devnode",
major, minor)) exit(1);

	unlink (devpath);
	mknod(devpath, S_IFBLK|S_IRUSR|S_IWUSR, makedev(major, minor));

	if ((sg_fd = open(devpath, O_RDONLY)) < 0) exit(1);
	if ((ioctl(sg_fd, SG_GET_VERSION_NUM, &k) < 0) || (k < 30000))
exit(1);

	memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
	io_hdr.interface_id = 'S';
	io_hdr.cmd_len = sizeof(inqCmdBlk);
	io_hdr.mx_sb_len = sizeof(sense_buffer);
	io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
	io_hdr.dxfer_len = INQ_REPLY_LEN;
	io_hdr.dxferp = inqBuff;
	io_hdr.cmdp = inqCmdBlk;
	io_hdr.sbp = sense_buffer;
	io_hdr.timeout = 2000;     /* TimeOut = 2 seconds */

        if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) exit(1);
	if ((io_hdr.info & SG_INFO_OK_MASK) != SG_INFO_OK) exit(1);

	for (i = 0; i <  8 ; i++) vendor[i]  = inqBuff[i+8];
	vendor[8] = 0;
	for (i = 0; i < 16 ; i++) product[i] = inqBuff[i+16];
	product[16] = 0;
	for (i = 0; i <  4 ; i++) serial[i]  = inqBuff[i+40];
	serial[4] = 0;
	for (i = 0; i <  4 ; i++) ldev[i]    = inqBuff[i+44];
	ldev[4] = 0;
	ctrl[0] = inqBuff[49];
	ctrl[1] = 0;
	port[0] = inqBuff[50];
	port[1] = 0;

	close(sg_fd);

	if (1 == verbose) {
		printf("VENDOR:  %s\n", vendor);
		printf("PRODUCT: %s\n", product);
		printf("SERIAL:  0x%s\n", serial);
		printf("LDEV:    0x%s\n", ldev);
		printf("CTRL:    %s\n", ctrl);
		printf("PORT:    %s\n", port);
		}
	switch( ctrl[0] ) {
		case '0': case '2': case '4': case '6': case '8':
			switch( ldev[3] ) {
				case '0': case '2': case '4': case '6':
case '8': case 'A': case 'C': case 'E':
					if (1 == verbose) printf("CTRL
EVEN, LDEV EVEN, PRIO 1\n");
					return 1;
					break;
				case '1': case '3': case '5': case '7':
case '9': case 'B': case 'D': case 'F':
					if (1 == verbose) printf("CTRL
EVEN, LDEV ODD, PRIO 0\n");
					return 0;
					break;

				}
		case '1': case '3': case '5': case '7': case '9':
			switch( ldev[3] ) {
				case '0': case '2': case '4': case '6':
case '8': case 'A': case 'C': case 'E':
					if (1 == verbose) printf("CTRL
ODD, LDEV EVEN, PRIO 0\n");
					return 0;
					break;
				case '1': case '3': case '5': case '7':
case '9': case 'B': case 'D': case 'F':
					if (1 == verbose) printf("CTRL
ODD, LDEV ODD, PRIO 1\n");
					return 1;
					break;
				}
		}
	exit(1);
	}

print_help() {
	printf("\n");
	printf("Usage:       pp_hds_modular [-v]
<device_major:device_minor>\n");
	printf("Option:      -v verbose mode\n");
	printf("Description: Prioritizer for Multipath Tools and HDS
Storage\n");
	printf("Version:     1.12\n");
	printf("Author:      Matthias Rudolph
<matthias.rudolph@hds.com>\n");
	printf("\n");
	return;
	}

int main(int argc, char * argv[]) {

	int prio;

	if (2 == argc) {
		if (0 == strcmp(argv[1], "-h")) {
			print_help();
			exit(0);
			}
		else {
			verbose = 0;
			prio = hds_modular_prio(argv[1]);
			printf("%d\n", prio);
			exit(0);
			}
		}

	if ((3 == argc) && (0 == strcmp(argv[1], "-v"))) {
		verbose = 1;
		prio = hds_modular_prio(argv[2]);
		printf("%d\n", prio);
		exit(0);
		}
	print_help();
	exit(1);
	}


[-- Attachment #2: pp_hds_modular_v1.12.tar --]
[-- Type: application/x-tar, Size: 40960 bytes --]

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Hitachi prioritizer ?
  2006-04-24 12:27 Matthias Rudolph
@ 2006-04-24 15:30 ` Christophe Varoqui
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe Varoqui @ 2006-04-24 15:30 UTC (permalink / raw)
  To: device-mapper development

On Mon, Apr 24, 2006 at 01:27:39PM +0100, Matthias Rudolph wrote:
> Hi all,
> here is the source. Feel free with it:
> 
I merged this prioritizer.
Can you post a patch modifying the hwtable.c accordingly and announcing you as the maintainer for these defaults.

Regards,
cvaroqui

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Hitachi prioritizer ?
@ 2006-04-26 15:15 Matthias Rudolph
  0 siblings, 0 replies; 6+ messages in thread
From: Matthias Rudolph @ 2006-04-26 15:15 UTC (permalink / raw)
  To: dm-devel; +Cc: christophe varoqui


Hi Christopher,

sorry - the software development is not my daily business....

The file hwtable.c should be changed from:

...
r += store_hwe(hw, "HITACHI", "DF400", MULTIBUS, DEFAULT_GETUID);
r += store_hwe(hw, "HITACHI", "DF500", MULTIBUS, DEFAULT_GETUID);
r += store_hwe(hw, "HITACHI", "DF600", MULTIBUS, DEFAULT_GETUID);
...

to:

...
r += store_hwe(hw, "HITACHI", "DF", GROUP_BY_PRIO, DEFAULT_GETUID,
"/sbin/pp_hds_modular %d", "0", "0", "readsector0", FAILBACK_IMMEDIATE);
r += store_hwe(hw, "HITACHI", "OPEN-", MULTIBUS, DEFAULT_GETUID);
...

First entry is for Hitachi Modular Storage Active/Passive. The Product
inquiry always begins with "DF".
Second entry is for Hitachi Enterprise Storage Active/Active. The
Product inquiry always begins with "OPEN-".

Regards, Matthias

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-04-26 15:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-18 10:26 Hitachi prioritizer ? Matthias Rudolph
2006-04-21 21:38 ` Christophe Varoqui
  -- strict thread matches above, loose matches on Subject: below --
2006-04-26 15:15 Matthias Rudolph
2006-04-24 12:27 Matthias Rudolph
2006-04-24 15:30 ` Christophe Varoqui
2006-02-09 23:21 Christophe Varoqui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.