def _resize_btrfs(mount_point, devpth): # If "/" is ro resize will fail. However it should be allowed since resize # makes everything bigger and subvolumes that are not ro will benefit. # Use a subvolume that is not ro to trick the resize operation to do the # "right" thing. The use of ".snapshot" is specific to "snapper" a generic # solution would be walk the subvolumes and find a rw mounted subvolume. if (not util.mount_is_read_write(mount_point) and os.path.isdir("%s/.snapshots" % mount_point)): return ('btrfs', 'filesystem', 'resize', 'max', '%s/.snapshots' % mount_point) else: return ('btrfs', 'filesystem', 'resize', 'max', mount_point)
def test_mount_is_ro(self, m_mount_info): m_mount_info.return_value = ('/dev/sda1', 'btrfs', '/', 'ro,relatime') is_rw = util.mount_is_read_write('/') self.assertEqual(is_rw, False)