Merge PR #33747 into master

* refs/pull/33747/head:
	doc/mgr/telemetry: add 'send' command
	mgr/telemetry: force --license when sending while opted-out

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2020-03-07 07:07:41 -06:00
commit a9bb16b40f
2 changed files with 16 additions and 2 deletions

View File

@ -114,6 +114,16 @@ The see the current configuration::
ceph telemetry status
Manually sending telemetry
--------------------------
To ad hoc send telemetry data::
ceph telemetry send
In case telemetry is not enabled (with 'ceph telemetry on'), you need to add
'--license sharing-1-0' to 'ceph telemetry send' command.
Sending telemetry through a proxy
---------------------------------

View File

@ -159,7 +159,8 @@ class Module(MgrModule):
},
{
"cmd": "telemetry send "
"name=endpoint,type=CephChoices,strings=ceph|device,n=N,req=false",
"name=endpoint,type=CephChoices,strings=ceph|device,n=N,req=false "
"name=license,type=CephString,req=false",
"desc": "Force sending data to Ceph telemetry",
"perm": "rw"
},
@ -744,9 +745,12 @@ class Module(MgrModule):
return 0, '', ''
elif command['prefix'] == 'telemetry off':
self.set_module_option('enabled', False)
self.set_module_option('last_opt_revision', REVISION)
self.set_module_option('last_opt_revision', 1)
return 0, '', ''
elif command['prefix'] == 'telemetry send':
if self.last_opt_revision < LAST_REVISION_RE_OPT_IN and command.get('license') != LICENSE:
self.log.debug('A telemetry send attempt while opted-out. Asking for license agreement')
return -errno.EPERM, '', "Telemetry data is licensed under the " + LICENSE_NAME + " (" + LICENSE_URL + ").\nTo manually send telemetry data, add '--license " + LICENSE + "' to the 'ceph telemetry send' command.\nPlease consider enabling the telemetry module with 'ceph telemetry on'."
self.last_report = self.compile_report()
return self.send(self.last_report, command.get('endpoint'))