storage.linux.util.is_device_mounted logic doesn't work for unpartitioned disks

Bug #1370053 reported by Robert C Jennings on 2014-09-16
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
Undecided
Dan Watkins

Bug Description

When passed a full disk device (e.g. /dev/sda) is_device_mounted() function checks the mount output for '/dev/sda[0-9]+'; this means it returns False if /dev/sda is mounted directly (rather than partitioned and mounted).

Related branches

Felipe Reyes (freyes) wrote :

Hi,

I cannot reproduce the problem described, using revno 368 I get the following:

$ python
Python 2.7.9 (default, Apr 2 2015, 15:33:21)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from charmhelpers.contrib.storage.linux.utils import *
>>> is_device_mounted(device='/dev/sda1')
True
>>> is_device_mounted(device='/dev/sda')
True
>>> is_device_mounted(device='/dev/sdf')
False
>>> is_device_mounted(device='/dev/sdf1')
False
>>>
$ bzr revno
368
$ mount|grep sda
/dev/sda6 on / type btrfs (rw,relatime,ssd,space_cache)
/dev/sda1 on /boot type ext4 (rw,relatime,data=ordered)
/dev/sda6 on /home type btrfs (rw,relatime,ssd,space_cache)
$ mount|grep sdf
# empty output

I'm setting this bug as 'incomplete', but please if you're still getting this error feel free to reopen it.

Best,

Changed in charm-helpers:
status: New → Incomplete
Changed in charm-helpers:
assignee: nobody → Dan Watkins (daniel-thewatkins)
summary: - storage.linux.util.is_device_mounted logic is swapped for
- device/partition
+ storage.linux.util.is_device_mounted logic doesn't work for
+ unpartitioned disks
description: updated
Changed in charm-helpers:
status: Incomplete → New
Changed in charm-helpers:
status: New → In Progress
Changed in charm-helpers:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers