diff options
author | Andy Grover <agrover@redhat.com> | 2013-04-30 10:07:01 -0700 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2013-04-30 10:07:01 -0700 |
commit | 88e7bf56a9e1601773500193f2e1faafddf1b151 (patch) | |
tree | 1cdc4303ed900b75e32cc37e1a97c30326616936 /rtslib/utils.py | |
parent | ade61bb19364c1d8bb28a0e3636445915b9c87ba (diff) | |
download | rtslib-fb-88e7bf56a9e1601773500193f2e1faafddf1b151.tar.gz |
Add fileio.is_block and fix size calcs
Don't just return 0 for size if a blockdev, use get_disk_size to get it.
get_disk_size returns sectors, make sure to multiply by sectorsize.
Add is_block property to fileiostorageobject
Signed-off-by: Andy Grover <agrover@redhat.com>
Diffstat (limited to 'rtslib/utils.py')
-rw-r--r-- | rtslib/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rtslib/utils.py b/rtslib/utils.py index 788b2f1..6b40211 100644 --- a/rtslib/utils.py +++ b/rtslib/utils.py @@ -112,9 +112,9 @@ def is_dev_in_use(path): def get_disk_size(path): ''' - Returns the size in bytes of a disk-type block device. + Returns the size in blocks of a disk-type block device. ''' - return int(fread("/sys/block/%s/size" % os.path.realpath(path))) + return int(fread("/sys/block/%s/size" % os.path.basename(os.path.realpath(path)))) def get_block_numbers(path): ''' |