@@ -10,6 +10,7 @@ import os.path
1010import random
1111import re
1212import shlex
13+ import shutil
1314import socket
1415import subprocess
1516import 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