Skip to content

Commit

Permalink
update pool import mechanism to by-id device name type rockstor#1320
Browse files Browse the repository at this point in the history
  • Loading branch information
phillxnet committed May 23, 2016
1 parent c007d2e commit 05a8d8e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/rockstor/fs/btrfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import shutil
import collections
from system.osi import (run_command, create_tmp_dir, is_share_mounted,
is_mounted, get_disk_serial, get_md_members)
is_mounted, get_disk_serial, get_md_members,
get_dev_byid_name)
from system.exceptions import (CommandException, NonBTRFSRootException)
from pool_scrub import PoolScrub
from django_ztask.decorators import task
Expand Down Expand Up @@ -77,7 +78,14 @@ def get_pool_info(disk):
pool_info['label'] = fields[1].strip("'")
pool_info['uuid'] = fields[3]
elif (re.match('\tdevid', l) is not None):
pool_info['disks'].append(l.split()[-1].split('/')[-1])
# We have a line starting wth <tab>devid, extract the dev name.
# Previously this would have been sda and used as is but we need
# it's by-id references as that is the new format for Disks.name.
# Original sda extraction:
# pool_info['disks'].append(l.split()[-1].split('/')[-1])
# Updated '/dev/sda' extraction to save on a split we no longer need
# and use this 'now' name to get our by-id name with path removed.
pool_info['disks'].append(get_dev_byid_name(l.split()[-1], True))
return pool_info

def pool_raid(mnt_pt):
Expand Down

0 comments on commit 05a8d8e

Please sign in to comment.