aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed/agents
diff options
context:
space:
mode:
authorSydney Vanda <[email protected]>2017-03-02 09:47:26 -0700
committerBrian Behlendorf <[email protected]>2017-04-05 16:18:19 -0700
commit7a4500a10102c00a67442628df2ac2395484757e (patch)
tree39eed4a62156f55f1e7911dd0df78d149e805a5b /cmd/zed/agents
parent6ba1ce9ee9741b1ce65f4a71549099d94392012e (diff)
Added auto-replace FMA test for the ZFS Test Suite
Also included are updates to auto-online test Automated auto-replace test to go along with ZED FMA integration (PR 4673) auto-replace_001.pos works using a scsi_debug device (the only usable virtual device currently due to whole_disk var needing to be set) Functionality for automated FMA auto-replace test to work with scsi_debug devs: Some functionality/exceptions needed to be added for automation of auto-replace to work correctly. In the test an alias vdev_id rule is added for any scsi_debug device which sets the phys_path="scsidebug" after a udevadm trigger command. A symlink is created for the vdev_id.conf file (in /etc/zfs/ by default) to be used in-tree for the test suite (/var/tmp/zfs/vdev_id.conf). "./scripts/zfs-helpers.sh -i" needs to be run before fault tests in the ZTS (to use udev rules in-tree) Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Don Brady <[email protected]> Reviewed-by: David Quigley <[email protected]> Signed-off-by: Sydney Vanda <[email protected]> Closes #5944
Diffstat (limited to 'cmd/zed/agents')
-rw-r--r--cmd/zed/agents/zfs_mod.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd/zed/agents/zfs_mod.c b/cmd/zed/agents/zfs_mod.c
index d297ab294..7ebf708ae 100644
--- a/cmd/zed/agents/zfs_mod.c
+++ b/cmd/zed/agents/zfs_mod.c
@@ -22,7 +22,7 @@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2016, Intel Corporation.
+ * Copyright (c) 2016, 2017, Intel Corporation.
*/
/*
@@ -89,6 +89,7 @@
#define DEV_BYID_PATH "/dev/disk/by-id/"
#define DEV_BYPATH_PATH "/dev/disk/by-path/"
+#define DEV_BYVDEV_PATH "/dev/disk/by-vdev/"
typedef void (*zfs_process_func_t)(zpool_handle_t *, nvlist_t *, boolean_t);
@@ -190,6 +191,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
char devpath[PATH_MAX];
int ret;
int is_dm = 0;
+ int is_sd = 0;
uint_t c;
vdev_stat_t *vs;
@@ -259,6 +261,13 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
}
/*
+ * vdev_id alias rule for using scsi_debug devices (FMA automated
+ * testing)
+ */
+ if (strcmp("scsidebug", physpath) == 0)
+ is_sd = 1;
+
+ /*
* If the pool doesn't have the autoreplace property set, then use
* vdev online to trigger a FMA fault by posting an ereport.
*/
@@ -272,10 +281,13 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
}
/*
- * convert physical path into its current device node
+ * Convert physical path into its current device node. Rawpath
+ * needs to be /dev/disk/by-vdev for a scsi_debug device since
+ * /dev/disk/by-path will not be present.
*/
- (void) snprintf(rawpath, sizeof (rawpath), "%s%s", DEV_BYPATH_PATH,
- physpath);
+ (void) snprintf(rawpath, sizeof (rawpath), "%s%s",
+ is_sd ? DEV_BYVDEV_PATH : DEV_BYPATH_PATH, physpath);
+
if (realpath(rawpath, devpath) == NULL && !is_dm) {
zed_log_msg(LOG_INFO, " realpath: %s failed (%s)",
rawpath, strerror(errno));