Hi, When I try to import a pool that has already been imported, I get, what I think is an incorrect error message. Here is what I see. -bash-3.00# zpool import zdg1 -bash-3.00# zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT zdg1 25.2G 954K 25.2G 0% ONLINE / -bash-3.00# zpool import zdg1 cannot import ''zdg1'': no such pool available -bash-3.00# echo $? 1 -bash-3.00# zpool import nonexistantpool cannot import ''nonexistantpool'': no such pool available -bash-3.00# echo $? 1 Yes, I could do a ''zpool list'' first. But this still is an incorrect error message. Maybe a different return code would also be appropriate. Can this be fixed? Regards, Manoj
On Thu, Dec 29, 2005 at 09:42:15AM +0530, Manoj Joseph wrote:> Hi, > > When I try to import a pool that has already been imported, I get, what > I think is an incorrect error message. > > Here is what I see. > > -bash-3.00# zpool import zdg1 > -bash-3.00# zpool list > NAME SIZE USED AVAIL CAP HEALTH ALTROOT > zdg1 25.2G 954K 25.2G 0% ONLINE / > -bash-3.00# zpool import zdg1 > cannot import ''zdg1'': no such pool available > -bash-3.00# echo $? > 1 > -bash-3.00# zpool import nonexistantpool > cannot import ''nonexistantpool'': no such pool available > -bash-3.00# echo $? > 1 > > Yes, I could do a ''zpool list'' first. But this still is an incorrect > error message. Maybe a different return code would also be appropriate. > Can this be fixed?How so? There is no such pool by the name ''zdg1'' available for import. If you run ''zpool import'', you will see no such pool available to import (because you just imported it). This error is very distinct from the error ''pool already exists'', which means that there _is_ a pool named ''zdg'' available for import, but another one with the same name already exists. I think the error message is accurately describing the situation, no? And on UNIX, the traditional error codes are 0 for success, 2 for usage error, and 1 for all other error codes. Very rarely do you see utilities returning different codes for different types of errors. - Eric -- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock
Hi Eric, Eric Schrock wrote:> On Thu, Dec 29, 2005 at 09:42:15AM +0530, Manoj Joseph wrote: > >>Hi, >> >>When I try to import a pool that has already been imported, I get, what >>I think is an incorrect error message. >> >>Here is what I see. >> >>-bash-3.00# zpool import zdg1 >>-bash-3.00# zpool list >>NAME SIZE USED AVAIL CAP HEALTH ALTROOT >>zdg1 25.2G 954K 25.2G 0% ONLINE / >>-bash-3.00# zpool import zdg1 >>cannot import ''zdg1'': no such pool available >>-bash-3.00# echo $? >>1 >>-bash-3.00# zpool import nonexistantpool >>cannot import ''nonexistantpool'': no such pool available >>-bash-3.00# echo $? >>1 >> >>Yes, I could do a ''zpool list'' first. But this still is an incorrect >>error message. Maybe a different return code would also be appropriate. >>Can this be fixed? > > > How so? There is no such pool by the name ''zdg1'' available for import. > If you run ''zpool import'', you will see no such pool available to import > (because you just imported it). This error is very distinct from the > error ''pool already exists'', which means that there _is_ a pool named > ''zdg'' available for import, but another one with the same name already > exists. I think the error message is accurately describing the > situation, no?I guess I disagree. To me it seems the error message should be ''pool already imported'' and not ''no such pool available''. IMHO, the error message suggests that there is no such pool available at all. But that''s just my $0.02. :) Cheers Manoj
On Fri, Dec 30, 2005 at 03:18:11AM +0530, Manoj Joseph wrote:> > I guess I disagree. To me it seems the error message should be ''pool > already imported'' and not ''no such pool available''.But what if you have another pool with the same name available to import? Does the error now change? Note that once a pool is exported, uniqueness of name is not guaranteed. I suppose we could guess that your already imported this pool, but it''s not necessarily true. There''s no way to know for sure that ''zdg1'' you''re expecting to find is really the same as the ''zdg1'' you currently have on your system. You basic have a matrix of these conditions: 1. Pool with name exists on system 2. Single pool with name available for import 3. Multiple pools with name available for import Maybe we can come up with some coherent terminology to cover all these cases?> IMHO, the error message suggests that there is no such pool available at > all.There isn''t, at least not for import. This is why ''zpool import'' doesn''t show you active pools. Maybe a better message is "no such pool available for import" ? - Eric -- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock