#NEWLINE# def mon_create( distro , args , monitor_keyring , hostname ) : #NEWLINE# #INDENT# logger = distro . conn . logger #NEWLINE# logger . debug ( ( 'remote hostname: %s' % hostname ) ) #NEWLINE# path = paths . mon . path ( args . cluster , hostname ) #NEWLINE# uid = distro . conn . remote_module . path_getuid ( constants . base_path ) #NEWLINE# gid = distro . conn . remote_module . path_getgid ( constants . base_path ) #NEWLINE# done_path = paths . mon . done ( args . cluster , hostname ) #NEWLINE# init_path = paths . mon . init ( args . cluster , hostname , distro . init ) #NEWLINE# configuration = conf . ceph . load ( args ) #NEWLINE# conf_data = StringIO ( ) #NEWLINE# configuration . write ( conf_data ) #NEWLINE# distro . conn . remote_module . write_conf ( args . cluster , conf_data . getvalue ( ) , args . overwrite_conf ) #NEWLINE# distro . conn . remote_module . create_mon_path ( path , uid , gid ) #NEWLINE# logger . debug ( ( 'checking for done path: %s' % done_path ) ) #NEWLINE# if ( not distro . conn . remote_module . path_exists ( done_path ) ) : #NEWLINE# #INDENT# logger . debug ( ( 'done path does not exist: %s' % done_path ) ) #NEWLINE# if ( not distro . conn . remote_module . path_exists ( paths . mon . constants . tmp_path ) ) : #NEWLINE# #INDENT# logger . info ( ( 'creating tmp path: %s' % paths . mon . constants . tmp_path ) ) #NEWLINE# distro . conn . remote_module . makedir ( paths . mon . constants . tmp_path ) #NEWLINE# #UNINDENT# keyring = paths . mon . keyring ( args . cluster , hostname ) #NEWLINE# logger . info ( ( 'creating keyring file: %s' % keyring ) ) #NEWLINE# distro . conn . remote_module . write_monitor_keyring ( keyring , monitor_keyring , uid , gid ) #NEWLINE# user_args = [ ] #NEWLINE# if ( uid != 0 ) : #NEWLINE# #INDENT# user_args = ( user_args + [ '--setuser' , str ( uid ) ] ) #NEWLINE# #UNINDENT# if ( gid != 0 ) : #NEWLINE# #INDENT# user_args = ( user_args + [ '--setgroup' , str ( gid ) ] ) #NEWLINE# #UNINDENT# remoto . process . run ( distro . conn , ( [ 'ceph-mon' , '--cluster' , args . cluster , '--mkfs' , '-i' , hostname , '--keyring' , keyring ] + user_args ) ) #NEWLINE# logger . info ( ( 'unlinking keyring file %s' % keyring ) ) #NEWLINE# distro . conn . remote_module . unlink ( keyring ) #NEWLINE# #UNINDENT# distro . conn . remote_module . create_done_path ( done_path , uid , gid ) #NEWLINE# distro . conn . remote_module . create_init_path ( init_path , uid , gid )