Beispiel #1
0
def device_report_keys(device_info):
    device_info(devices={
        # example output of disk.get_devices()
        '/dev/sdb': {'human_readable_size': '1.82 TB',
                     'locked': 0,
                     'model': 'PERC H700',
                     'nr_requests': '128',
                     'partitions': {},
                     'path': '/dev/sdb',
                     'removable': '0',
                     'rev': '2.10',
                     'ro': '0',
                     'rotational': '1',
                     'sas_address': '',
                     'sas_device_handle': '',
                     'scheduler_mode': 'cfq',
                     'sectors': 0,
                     'sectorsize': '512',
                     'size': 1999844147200.0,
                     'support_discard': '',
                     'vendor': 'DELL'}
    }
 )
    report = Devices().json_report()[0]
    return list(report.keys())
Beispiel #2
0
def device_sys_api_keys(device_info):
    device_info(
        devices={
            # example output of disk.get_devices()
            '/dev/sdb': {
                'human_readable_size': '1.82 TB',
                'locked': 0,
                'model': 'PERC H700',
                'nr_requests': '128',
                'partitions': {},
                'path': '/dev/sdb',
                'removable': '0',
                'rev': '2.10',
                'ro': '0',
                'rotational': '1',
                'sas_address': '',
                'sas_device_handle': '',
                'scheduler_mode': 'cfq',
                'sectors': 0,
                'sectorsize': '512',
                'size': 1999844147200.0,
                'support_discard': '',
                'vendor': 'DELL'
            }
        })
    report = Devices().json_report()[0]
    return list(report['sys_api'].keys())
Beispiel #3
0
 def main(self):
     parser = argparse.ArgumentParser(
         prog='ceph-volume inventory',
         formatter_class=argparse.RawDescriptionHelpFormatter,
         description=self.help,
     )
     parser.add_argument(
         'path',
         nargs='?',
         default=None,
         help=('Report on specific disk'),
     )
     parser.add_argument(
         '--format',
         choices=['plain', 'json', 'json-pretty'],
         default='plain',
         help='Output format',
     )
     parser.add_argument(
         '--filter-for-batch',
         action='store_true',
         help=('Filter devices unsuitable to pass to an OSD service spec, '
               'no effect when <path> is passed'),
         default=False,
     )
     self.args = parser.parse_args(self.argv)
     if self.args.path:
         self.format_report(Device(self.args.path))
     else:
         self.format_report(Devices(self.args.filter_for_batch))
Beispiel #4
0
def device_data(device_info):
    device_info(
        devices={
            # example output of disk.get_devices()
            '/dev/sdb': {
                'human_readable_size': '1.82 TB',
                'locked': 0,
                'model': 'PERC H700',
                'nr_requests': '128',
                'partitions': {},
                'path': '/dev/sdb',
                'removable': '0',
                'rev': '2.10',
                'ro': '0',
                'rotational': '1',
                'sas_address': '',
                'sas_device_handle': '',
                'scheduler_mode': 'cfq',
                'sectors': 0,
                'sectorsize': '512',
                'size': 1999844147200.0,
                'support_discard': '',
                'vendor': 'DELL',
            }
        }
    )

    dev = Devices().devices[0]
    dev.lsm_data = {
        "serialNum": 'S2X9NX0H935283',
        "transport": 'SAS',
        "mediaType": 'HDD',
        "rpm": 10000,
        "linkSpeed": 6000,
        "health": 'Good',
        "ledSupport": {
            "IDENTsupport": 'Supported',
            "IDENTstatus": 'Off',
            "FAILsupport": 'Supported',
            "FAILstatus": 'Off',
        },
        "errors": [],
    }
    return dev.json_report()
Beispiel #5
0
def load_ceph_volume_devices():
    """ To simplify import mocking in the tests

    ceph-volume is not present during unittesting.
    """
    try:
        from ceph_volume.util.device import Devices
        return Devices()
    except ImportError:
        log.error("Could not import from ceph_volume.util.device.")
Beispiel #6
0
 def main(self):
     parser = argparse.ArgumentParser(
         prog='ceph-volume inventory',
         formatter_class=argparse.RawDescriptionHelpFormatter,
         description=self.help,
     )
     parser.add_argument(
         'path',
         nargs='?',
         default=None,
         help=('Report on specific disk'),
     )
     parser.add_argument(
         '--format',
         choices=['plain', 'json', 'json-pretty'],
         default='plain',
         help='Output format',
     )
     self.args = parser.parse_args(self.argv)
     if self.args.path:
         self.format_report(Device(self.args.path))
     else:
         self.format_report(Devices())
Beispiel #7
0
 def get_report(self):
     if self.args.path:
         return Device(self.args.path).json_report()
     else:
         return Devices(
             filter_for_batch=self.args.filter_for_batch).json_report()
Beispiel #8
0
 def __init__(self, **kwargs) -> None:
     self.kwargs: dict = kwargs
     self.devices = Devices()
Beispiel #9
0
def device_report_keys():
    report = Devices().json_report()[0]
    return list(report.keys())
Beispiel #10
0
def device_sys_api_keys():
    report = Devices().json_report()[0]
    return list(report['sys_api'].keys())
Beispiel #11
0
 def get_report(self):
     if self.args.path:
         return Device(self.args.path).json_report()
     else:
         return Devices().json_report()