@@ -5503,6 +5503,24 @@ def command_ceph_volume(ctx):
55035503##################################
55045504
55055505
5506+ def command_unit_install (ctx ):
5507+ # type: (CephadmContext) -> int
5508+ if not ctx .fsid :
5509+ raise Error ('must pass --fsid to specify cluster' )
5510+
5511+ fsid = ctx .fsid
5512+ install_base_units (ctx , fsid )
5513+ unit = get_unit_file (ctx , fsid )
5514+ unit_file = 'ceph-%[email protected] ' % (
fsid )
5515+ with open (ctx .unit_dir + '/' + unit_file + '.new' , 'w' ) as f :
5516+ f .write (unit )
5517+ os .rename (ctx .unit_dir + '/' + unit_file + '.new' ,
5518+ ctx .unit_dir + '/' + unit_file )
5519+ call_throws (ctx , ['systemctl' , 'daemon-reload' ])
5520+
5521+ return 0
5522+
5523+
55065524@infer_fsid
55075525def command_unit (ctx ):
55085526 # type: (CephadmContext) -> int
@@ -7237,6 +7255,10 @@ def _get_parser():
72377255 required = True ,
72387256 help = 'daemon name (type.id)' )
72397257
7258+ parser_unit_install = subparsers .add_parser (
7259+ 'unit-install' , help = "Install the daemon's systemd unit" )
7260+ parser_unit_install .set_defaults (func = command_unit_install )
7261+
72407262 parser_logs = subparsers .add_parser (
72417263 'logs' , help = 'print journald logs for a daemon container' )
72427264 parser_logs .set_defaults (func = command_logs )
0 commit comments