From: Wen Xiong <wenxi...@linux.vnet.ibm.com>

When creating the arrays with RI and non-RI ssd disks, this patch
improves the error message in GUI and command line.

Signed-off-by: Wen Xiong <wenxi...@linux.vnet.ibm.com>
---
 iprconfig.c |   27 ++++++++++++++++++++++++++-
 iprconfig.h |    2 ++
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/iprconfig.c b/iprconfig.c
index 5da12cc..7f37387 100644
--- a/iprconfig.c
+++ b/iprconfig.c
@@ -4102,6 +4102,7 @@ int confirm_raid_start(i_container *i_con)
        int header_lines;
        int toggle = 0;
        struct screen_output *s_out;
+       int is_ri_count = 0, non_ri_count = 0;
 
        rc = RC_SUCCESS;
 
@@ -4113,12 +4114,24 @@ int confirm_raid_start(i_container *i_con)
                        print_dev(k, cur_raid_cmd->dev, buffer, "1", k);
 
                        for_each_af_dasd(ioa, dev) {
-                               if (dev->dev_rcd->issue_cmd)
+                               if (dev->dev_rcd->issue_cmd) {
                                        print_dev(k, dev, buffer, "1", k);
+                                       if (dev->block_dev_class & IPR_SSD) {
+                                               if (dev->read_intensive & 
IPR_RI)
+                                                       is_ri_count++;
+                                               else
+                                                       non_ri_count++;
+                                       }
+                               }
                        }
                }
        }
 
+       if (is_ri_count > 0 && non_ri_count > 0) {
+               rc = RC_95_Mixed_RISSD_SSDs;
+               return rc;
+       }
+
        toggle_field = 0;
 
        do {
@@ -14115,6 +14128,7 @@ static int raid_create(char **args, int num_args)
 {
        int i, num_devs = 0, ssd_num_devs = 0, rc, prot_level;
        int non_4k_count = 0, is_4k_count = 0;
+       int non_ri_count = 0, is_ri_count = 0;
        int next_raid_level, next_stripe_size, next_qdepth, next_label;
        char *raid_level = IPR_DEFAULT_RAID_LVL;
        char label[8];
@@ -14210,6 +14224,12 @@ static int raid_create(char **args, int num_args)
                        is_4k_count++;
                else
                        non_4k_count++;
+
+               if (dev->block_dev_class & IPR_SSD)
+                       if (dev->read_intensive & IPR_RI)
+                               is_ri_count++;
+                       else
+                               non_ri_count++;
        }
 
        if (is_4k_count > 0 && non_4k_count > 0) {
@@ -14217,6 +14237,11 @@ static int raid_create(char **args, int num_args)
                return -EINVAL;
        }
 
+       if (is_ri_count > 0 && non_ri_count > 0) {
+               syslog(LOG_ERR, _("SSD disks and RI SSD disks can not be mixed 
in an array.\n"));
+               return -EINVAL;
+       }
+
        if (!ioa) {
                syslog(LOG_ERR, _("No valid devices specified.\n"));
                return -EINVAL;
diff --git a/iprconfig.h b/iprconfig.h
index a6f6e75..ff6dd02 100644
--- a/iprconfig.h
+++ b/iprconfig.h
@@ -1717,6 +1717,7 @@ const char *screen_status[] = {
        /* 92 */ __("Create disk array failed - can not build with read 
intensive disks only."),
        /* 93 */ __("All devices up to date"),
        /* 94 */ __("Temporary log file creation failed: %s"),
+       /* 95 */ __("Create disk array failed - can not mix SSDs and RI SSDs."),
 
       /* NOTE:  127 maximum limit */
 };
@@ -1818,6 +1819,7 @@ enum {
        RC_92_UNSUPT_REQ_BLK_DEV_CLASS,
        RC_93_All_Up_To_Date,
        RC_94_Tmp_Log_Fail,
+       RC_95_Mixed_RISSD_SSDs,
 
        /* NOTE:  127 maximum limit */
 };
-- 
1.6.0.2


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to