Skip to content

Commit

Permalink
avoid detached device use in bootstrap rockstor#1422
Browse files Browse the repository at this point in the history
Includes skipping pool/share update attempts on
pools with only detached devices as members. This
reduces false bootstrap retry attempts and enables
greater robustness on boot.
Logging added in cases where a pool mount is
circumvented (ie pools with no attached members).
Plus additional comments.
  • Loading branch information
phillxnet committed Jun 27, 2017
1 parent 5d0b6dc commit 71649c3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/rockstor/storageadmin/views/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,22 @@ class CommandView(DiskMixin, NFSExportMixin, APIView):
@transaction.atomic
def _refresh_pool_state():
for p in Pool.objects.all():
# If our pool has no disks, detached included, then delete it.
# We leave pools with all detached members in place intentionally.
if (p.disk_set.count() == 0):
p.delete()
continue
# Log if no attached members are found, ie all devs are detached.
if p.disk_set.attached().count() == 0:
logger.error('Skipping Pool (%s) mount as there '
'are no attached devices. Moving on.' %
p.name)
continue
try:
mount_root(p)
first_dev = p.disk_set.first()
first_attached_dev = p.disk_set.attached().first()
# Observe any redirect role by using target_name.
pool_info = get_pool_info(first_dev.target_name)
pool_info = get_pool_info(first_attached_dev.target_name)
p.name = pool_info['label']
p.raid = pool_raid('%s%s' % (settings.MNT_PT, p.name))['data']
p.size = p.usage_bound()
Expand All @@ -82,9 +90,13 @@ def post(self, request, command, rtcepoch=None):
self._update_disk_state()
self._refresh_pool_state()
for p in Pool.objects.all():
if p.disk_set.attached().count() == 0:
continue
import_shares(p, request)

for share in Share.objects.all():
if share.pool.disk_set.attached().count() == 0:
continue
try:
if (share.pqgroup == settings.MODEL_DEFS['pqgroup']):
share.pqgroup = qgroup_create(share.pool)
Expand Down

0 comments on commit 71649c3

Please sign in to comment.