On Tue, Jun 28, 2011 at 5:40 AM, Lucas Meneghel Rodrigues <[email protected]>wrote:
> On Tue, Jun 28, 2011 at 6:52 AM, Shrirang Phansalkar > <[email protected]> wrote: > > Hi, > > Sorry guys I forgot mention subject line in the last mail, so resending > the mail. > > > > I am having problem while using get_disk_list ( ) in bin/fsdev_disks.py > > The problem I am facing is it does not return the disk if it has no > partitions on it. It only returns the device which is partitioned. > > > > For example: > > /dev/sda5 --> this is partition of /dev/sda5 is not mounted > > /dev/sdb --> this is a free disk > > > > sda5 is listed but sdb is not listed. > > > > I tried to debug this problem and it found to be in the following 'if' > statement > > > >> if not partname[-1:].isdigit(): > >> continue > > > > Is there any specific reason why get_disk_list( ) return disks which are > partitioned and not which are not partitioned? > > As I didn't write the code, the only reason that occurs to me is that > unpartitioned disks can't be used right away, they need to be > partitioned to be effectively used (in fact, they can but it's not > good practice to create filesystems on unpartitioned disks). > > Possible ways to resolve this would be: > > 1) Just remove the if statement and document the behavior on the > function's docstring > 2) Create another function with a slightly different name, > get_full_disk_list() that has the same base implementation, but > doesn't have the if statement. Some refactoring would be necessary but > it's a better solution. > > You might want to send a patch for that, if not please open a ticket > and I'll work on it. > Yeah there is a lot of room for improvement in that code and it doesn't have much in the way of unit tests to serve as documentation for why it behaves the way it does. :/ My _guess_ is that when it was written we wanted to avoid ever seeing an unpartitioned device in the list or seeing the whole device in the list in addition to partitions on the same device with filesystems. Adding an optional parameter to get_disk_list to change this behavior or a new version of the function that has the behavior you want makes sense. -gps > > Cheers, > > Lucas > > > Please can anyone tell me that if I need device/disk which is not > partitioned as well then can this if statement be removed or is there any > other way? > > > > > > Thanks and regards, > > Shrirang > > > > PROPRIETARY-CONFIDENTIAL INFORMATION INCLUDED > > > > This electronic transmission, and any documents attached hereto, may > contain confidential, proprietary and/or legally privileged information. The > information is intended only for use by the recipient named above. If you > received this electronic message in error, please notify the sender and > delete the electronic message. Any disclosure, copying, distribution, or use > of the contents of information received in error is strictly prohibited, and > violators will be pursued legally. > > _______________________________________________ > > Autotest mailing list > > [email protected] > > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > > > > > > -- > Lucas > _______________________________________________ > Autotest mailing list > [email protected] > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest >
_______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
