Skip to content

Commit 68f1de6

Browse files
committed
Add more ceph sanity checks
1 parent fa1a647 commit 68f1de6

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

staff/sys/makevm

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import os.path
1010
import random
1111
import re
1212
import shlex
13+
import shutil
1314
import socket
1415
import subprocess
1516
import sys
@@ -256,15 +257,22 @@ def _main(args):
256257
print('Cancelled.')
257258
sys.exit(2)
258259

260+
if agrs.ceph and not shutil.which('ceph'):
261+
print("Warning: You are trying to use Ceph but I couldn't find the `ceph` executable.")
262+
263+
if not confirm():
264+
print('Cancelled.')
265+
sys.exit(2)
266+
259267
if args.ceph and args.vg != 'vg':
260-
print("Warning: You have Ceph backing storage, but specified a non-default VG")
268+
print('Warning: You have Ceph backing storage, but specified a non-default VG.')
261269

262270
if not confirm():
263271
print('Cancelled.')
264272
sys.exit(2)
265273

266274
if not args.ceph and args.ceph_pool != 'vm':
267-
print("Warning: You have LVM backing storage, but specified a Ceph pool")
275+
print('Warning: You have LVM backing storage, but specified a Ceph pool.')
268276

269277
if not confirm():
270278
print('Cancelled.')
@@ -307,11 +315,11 @@ def _main(args):
307315
mac = generate_mac_addr()
308316

309317
disk_param = None
310-
if not args.ceph:
318+
if args.ceph:
319+
disk_param = gen_ceph_disk_param(args.ceph_pool, args.storage)
320+
else:
311321
create_disk(args.vg, args.hostname, args.storage)
312322
disk_param = gen_lvm_disk_param(args.hostname, args.vg)
313-
else:
314-
disk_param = gen_ceph_disk_param(args.ceph_pool, args.storage)
315323

316324
create_vm(args.hostname, args.memory, args.vcpus, disk_param, args.os_type,
317325
args.os_variant, args.network, mac, args.skip_config)

0 commit comments

Comments
 (0)