def get_osd_tree(): try: cluster_name, config, config_file = Ceph._get_ceph_config() output = run_cmd('ceph osd tree --connect-timeout %s -f json ' '--cluster %s' % (Ceph.COMMAND_TIMEOUT_SECS, cluster_name)) return json.loads(output) except (exc.ShellCommandException, ValueError) as e: raise exc.CephCommandException(str(e)) except exc.ShellCommandTimeoutException as e: raise exc.CephCommandTimeoutException(str(e))
def _fetch_radosgw_ip_port(): """ Read the RADOSGW_SITE_CONF and fetch the IP and port of the apache site :return: string of ip:port on success, raises exception on failure. """ if not (os.path.isfile(Radosgw.RADOSGW_SITE_CONF) or os.access(Radosgw.RADOSGW_SITE_CONF, os.R_OK)): raise CephLMException("Configuration file %s for Radosgw apache " "site not found or cannot be read" % Radosgw.RADOSGW_SITE_CONF) cmd = 'grep Listen %s' % Radosgw.RADOSGW_SITE_CONF err_msg = "Failed to run command '%s'" % cmd output = run_cmd(cmd) m = re.search('Listen (\S+)', output) if m: return m.groups()[0] else: raise CephCommandException(err_msg)
def get_ceph_disk_list(): try: output = run_cmd('ceph-disk list') return Ceph._process_ceph_disk_list(output) except (exc.ShellCommandException, ValueError) as e: raise exc.CephCommandException(str(e))