Skip to content

Commit

Permalink
Handle the case where /mnt/daos is mounted, but empty.
Browse files Browse the repository at this point in the history
Signed-off-by: Ashley Pittman <[email protected]>
  • Loading branch information
ashleypittman committed Dec 23, 2020
1 parent 00a6d70 commit 8fd7878
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions utils/node_local_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,25 +381,33 @@ def start(self):
self.conf.agent_dir = self.agent_dir
self.running = True

# Use dmg to block until the server is ready to respond to requests.
# Configure the storage. DAOS wants to mount /mnt/daos itself if not
# already mounted, so let it do that.
# This code supports three modes of operation:
# /mnt/daos is not mounted. It will be mounted and formatted.
# /mnt/daos is mounted but empty. It will be remounted and formatted
# /mnt/daos exists and has data in. It will be used as is.
start = time.time()

cmd = ['storage', 'format']
while True:
time.sleep(0.5)
rc = self.run_dmg(['storage', 'format'])
rc = self.run_dmg(cmd)
ready = False
if rc.returncode == 1:
for line in rc.stdout.decode('utf-8').splitlines():
if 'format storage of running instance' in line:
ready = True

if 'format request for already-formatted storage and reformat not specified' in line:
cmd = ['storage', 'format', '--reformat']
if ready:
break
if time.time() - start > 20:
raise Exception("Failed to format")

print('Format completion in {:.2f} seconds'.format(time.time() - start))

# How wait until the system is up, basically the format to happen.
while True:
time.sleep(0.5)
rc = self.run_dmg(['system', 'query'])
Expand Down

0 comments on commit 8fd7878

Please sign in to comment.