charmhelpers is_mounted() doesn't deal with root device check?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
swift-storage (Juju Charms Collection) |
Fix Released
|
Undecided
|
Chris Glass |
Bug Description
Full unit log: http://
In this case, charmhelpers seemed to have problems detecting that /dev/sdb* was mounted with the root filesystem. Perhaps this is why the following is specified in the swift_storage_
blacklist = ['sda', 'vda', 'cciss/c0d0']
It should probably be double checked to make sure it can deal with this situation.
ubuntu@bohr:~$ tail -30 /var/log/
2014-07-29 20:29:34 INFO install GPT data structures destroyed! You may now partition the disk using fdisk or
2014-07-29 20:29:34 INFO install other utilities.
2014-07-29 20:29:34 INFO install Warning: The kernel is still using the old partition table.
2014-07-29 20:29:34 INFO install The new table will be used at the next reboot.
2014-07-29 20:29:34 INFO install The operation has completed successfully.
2014-07-29 20:29:34 INFO install 1+0 records in
2014-07-29 20:29:34 INFO install 1+0 records out
2014-07-29 20:29:34 INFO install 1048576 bytes (1.0 MB) copied, 0.00211706 s, 495 MB/s
2014-07-29 20:29:34 INFO install 100+0 records in
2014-07-29 20:29:34 INFO install 100+0 records out
2014-07-29 20:29:34 INFO install 51200 bytes (51 kB) copied, 0.00456763 s, 11.2 MB/s
2014-07-29 20:29:34 INFO install mkfs.xfs: cannot open /dev/sdb: Device or resource busy
2014-07-29 20:29:34 INFO install <open file '/proc/partitions', mode 'r' at 0x7ffedc45fdb0>
2014-07-29 20:29:34 INFO install Traceback (most recent call last):
2014-07-29 20:29:34 INFO install File "/var/lib/
2014-07-29 20:29:34 INFO install main()
2014-07-29 20:29:34 INFO install File "/var/lib/
2014-07-29 20:29:34 INFO install hooks.execute(
2014-07-29 20:29:34 INFO install File "/var/lib/
2014-07-29 20:29:34 INFO install self._hooks[
2014-07-29 20:29:34 INFO install File "/var/lib/
2014-07-29 20:29:34 INFO install setup_storage()
2014-07-29 20:29:34 INFO install File "/var/lib/
2014-07-29 20:29:34 INFO install mkfs_xfs(dev)
2014-07-29 20:29:34 INFO install File "/var/lib/
2014-07-29 20:29:34 INFO install check_call(cmd)
2014-07-29 20:29:34 INFO install File "/usr/lib/
2014-07-29 20:29:34 INFO install raise CalledProcessEr
2014-07-29 20:29:34 INFO install subprocess.
2014-07-29 20:29:34 ERROR juju.worker.uniter uniter.go:486 hook failed: exit status 1
ubuntu@bohr:~$ ll /dev/sd*
brw-rw---- 1 root disk 8, 0 Jul 29 20:27 /dev/sda
brw-rw---- 1 root disk 8, 1 Jul 29 20:27 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jul 29 20:27 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jul 29 20:29 /dev/sdb
brw-rw---- 1 root disk 8, 17 Jul 29 20:27 /dev/sdb1
ubuntu@bohr:~$ ll /proc/partitions
-r--r--r-- 1 root root 0 Jul 29 20:34 /proc/partitions
ubuntu@bohr:~$ cat /proc/partitions
major minor #blocks name
8 0 119454720 sda
8 1 118405103 sda1
8 2 1047552 sda2
8 16 117220824 sdb
8 17 117219800 sdb1
# /dev/sdb is root (!)
ubuntu@bohr:~$ mount |grep sdb
/dev/sdb1 on / type ext4 (rw)
ubuntu@bohr:~$ mount |grep sda
ubuntu@bohr:~$ ll /dev/sda*
brw-rw---- 1 root disk 8, 0 Jul 29 20:27 /dev/sda
brw-rw---- 1 root disk 8, 1 Jul 29 20:27 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jul 29 20:27 /dev/sda2
# unsure why is_mounted() in charmhelpers didn't catch that:
#
ubuntu@bohr:~$ cat /proc/mounts
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,
proc /proc proc rw,nosuid,
udev /dev devtmpfs rw,relatime,
devpts /dev/pts devpts rw,nosuid,
tmpfs /run tmpfs rw,nosuid,
/dev/disk/
none /sys/fs/cgroup tmpfs rw,relatime,
none /sys/fs/
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/
none /run/lock tmpfs rw,nosuid,
none /run/shm tmpfs rw,nosuid,
none /run/user tmpfs rw,nosuid,
none /sys/fs/pstore pstore rw,relatime 0 0
systemd /sys/fs/
cgroup /sys/fs/
cgroup /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0
cgroup /sys/fs/
cgroup /sys/fs/
cgroup /sys/fs/
cgroup /sys/fs/
cgroup /sys/fs/
cgroup /sys/fs/
cgroup /sys/fs/
ubuntu@bohr:~$ cat /etc/mtab
/dev/sdb1 / ext4 rw 0 0
proc /proc proc rw,noexec,
sysfs /sys sysfs rw,noexec,
none /sys/fs/cgroup tmpfs rw 0 0
none /sys/fs/
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,
tmpfs /run tmpfs rw,noexec,
none /run/lock tmpfs rw,noexec,
none /run/shm tmpfs rw,nosuid,nodev 0 0
none /run/user tmpfs rw,noexec,
none /sys/fs/pstore pstore rw 0 0
systemd /sys/fs/
ubuntu@bohr:~$ mount
/dev/sdb1 on / type ext4 (rw)
proc on /proc type proc (rw,noexec,
sysfs on /sys type sysfs (rw,noexec,
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,
tmpfs on /run type tmpfs (rw,noexec,
none on /run/lock type tmpfs (rw,noexec,
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/
ubuntu@bohr:~$
Related branches
- Liam Young (community): Approve
-
Diff: 68 lines (+45/-1)2 files modifiedcharmhelpers/contrib/storage/linux/utils.py (+3/-0)
tests/contrib/storage/test_linux_storage_utils.py (+42/-1)
- OpenStack Charmers: Pending requested
-
Diff: 68 lines (+45/-1)2 files modifiedcharmhelpers/contrib/storage/linux/utils.py (+3/-0)
tests/contrib/storage/test_linux_storage_utils.py (+42/-1)
Changed in swift-storage (Juju Charms Collection): | |
assignee: | nobody → Chris Glass (tribaal) |
Changed in swift-storage (Juju Charms Collection): | |
status: | New → In Progress |
A fix was committed to chamr-helpers, along with more unit tests. I also changed the logic in swift-storage to use "disks that are not in use" rather than any disk not in a blacklist. It should make things more robust in this scenario.
Marking as fix released - it should propagate to other charms using the charm-helpers code as well in further updates.