Module Import alias Import alias Import alias ImportFrom alias ImportFrom alias identifier ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore TupleLoad Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Num Assign NameStore Call NameLoad ListLoad Str Str Str Str Str Str Str Str Str Str Str Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Assign NameStore Str Assign NameStore Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Str NameLoad Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Assign NameStore ListLoad Assign NameStore NameLoad Assign NameStore Num For NameStore NameLoad body If BoolOpAnd CompareNotEq Call NameLoad NameLoad Num CompareEq Call NameLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Dict Assign NameStore BinOpSub Call NameLoad NameLoad Num TryExcept body Assign TupleStore NameStore NameStore GeneratorExp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr Str Num handlers ExceptHandler type NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Assign NameStore NameLoad If NameLoad body Expr Call AttributeLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad attr NameLoad orelse If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index NameLoad ListLoad orelse Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Str Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Assign NameStore ListLoad Dict Assign NameStore Num For NameStore SubscriptLoad NameLoad Slice Num body TryExcept body Assign TupleStore NameStore NameStore GeneratorExp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr Str Num handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Dict AugAssignAdd NameStore Num orelse Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults vararg body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Assign NameStore Dict For NameStore SubscriptLoad NameLoad Slice Num body TryExcept body Assign TupleStore NameStore NameStore GeneratorExp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr Str Num handlers ExceptHandler type NameLoad body Break orelse Assign SubscriptStore NameLoad Index Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad If CompareEq Call AttributeLoad NameLoad attr Str Str body Return NameLoad If CompareEq Call AttributeLoad NameLoad attr Str Str body Return NameLoad If BoolOpAnd CompareIn Str NameLoad CompareNotIn Call NameLoad SubscriptLoad NameLoad Index Str NameLoad body Return NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad If CompareEq Call AttributeLoad NameLoad attr Str Str body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Str Str Str Call AttributeLoad Str attr NameLoad keyword ListLoad Num Index Num Assign NameStore Dict For NameStore ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Num Assign NameStore Call AttributeLoad NameLoad attr Str If CompareEq NameLoad Str body Assign SubscriptStore NameLoad Index Str Call AttributeLoad NameLoad attr If CompareIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad Str Str Str Str Str Str Str Str Str Str Str NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Slice Num comprehension NameStore NameLoad Call AttributeLoad NameLoad attr Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr keyword ListLoad Num NameLoad Index Num Return Call NameLoad Call NameLoad NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad TryExcept body With Call NameLoad Call AttributeLoad Str attr NameLoad NameStore body Assign SubscriptStore NameLoad Index Str Call AttributeLoad Call AttributeLoad NameLoad attr attr handlers ExceptHandler type NameLoad body Pass For NameStore TupleLoad Str Str Str body TryExcept body With Call NameLoad Call AttributeLoad Str attr NameLoad NameLoad NameStore body Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr handlers ExceptHandler type NameLoad body Pass Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore Str TryExcept body Assign NameStore Call AttributeLoad Call AttributeLoad Call NameLoad BinOpAdd NameLoad Str attr attr handlers ExceptHandler type NameLoad body Return ListLoad orelse Return ListComp Call AttributeLoad Str attr SubscriptLoad Call AttributeLoad NameLoad attr Slice Num comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults body For NameStore Call NameLoad body Assign NameStore BinOpMod Str NameLoad If CompareEq NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index Num body Return NameLoad decorator_list FunctionDef arguments args defaults body Return Call NameLoad Str decorator_list FunctionDef arguments args defaults body Return Call NameLoad Str decorator_list FunctionDef arguments args defaults body Return Call NameLoad Str keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If BoolOpAnd CompareIn Str NameLoad CompareNotIn Call NameLoad SubscriptLoad NameLoad Index Str NameLoad body Return NameLoad If Call NameLoad GeneratorExp Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str attr NameLoad comprehension NameStore TupleLoad Str Str Str body Return NameLoad If CompareNotIn Str NameLoad body Return NameLoad If BoolOpOr BoolOpAnd NameLoad CompareIn Str NameLoad BoolOpAnd UnaryOpNot NameLoad CompareNotIn Str NameLoad body Return NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign NameStore ListLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Str Str Index Num For NameStore Call AttributeLoad NameLoad attr Str body If BoolOpAnd CompareIn Str NameLoad CompareIn BinOpMod Str NameLoad NameLoad body Assign NameStore Call NameLoad GeneratorExp TupleLoad SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num comprehension NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Call NameLoad For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad NameLoad If CompareNotIn Str NameLoad body Return NameLoad Assign NameStore ListLoad For NameStore SubscriptLoad NameLoad Index Str body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad Return Dict Str Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body TryExcept body Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad NameLoad AttributeLoad NameLoad attr name NameStore body Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad Return If BoolOpAnd NameLoad UnaryOpNot Call NameLoad NameLoad keyword NameLoad keyword NameLoad body Return Assign NameStore Dict Str Str Str Str NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If BoolOpAnd CompareIn Str NameLoad CompareIn Str NameLoad CompareNotEq SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str body Return NameLoad If BoolOpAnd CompareIn Str NameLoad CompareIn Str NameLoad CompareNotEq SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str body Return NameLoad If BoolOpAnd CompareIn Str NameLoad CompareIn Str NameLoad Call NameLoad GeneratorExp Call AttributeLoad NameLoad attr Str comprehension NameStore BinOpBitAnd Call NameLoad SubscriptLoad NameLoad Index Str Call NameLoad SubscriptLoad NameLoad Index Str body Return NameLoad If BoolOpAnd CompareEqIsNot Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str NameLoad CompareEqEq Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str body Return NameLoad If BoolOpAnd CompareEqIsNot Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str NameLoad CompareEqEq Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str CompareEqIsNot Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str NameLoad body Return NameLoad If BoolOpAnd CompareEqIsNot Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str NameLoad CompareEqEq Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str body Return NameLoad If CompareEqIsNot Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str NameLoad body Return NameLoad Return NameLoad decorator_list
N/A N/A os N/A re N/A stat bareon errors bareon.openstack.common log logging bareon.utils utils N/A LOG N/A N/A logging getLogger __name__ N/A VALID_MAJORS N/A 3 8 9 65 66 67 68 69 70 71 104 105 106 107 108 109 110 111 202 252 253 254 259 N/A UDEV_PROPERTIES N/A set N/A MAJOR MINOR DEVNAME DEVTYPE DEVPATH ID_BUS ID_MODEL ID_SERIAL_SHORT ID_WWN ID_CDROM ID_VENDOR N/A SMBIOS_TYPES N/A bios base_board processor memory_array memory_device 0 2 4 16 17 N/A DISK disk N/A PARTITION partition parse_dmidecode N/A N/A type N/A N/A N/A Parses `dmidecode` output.

    :param type: A string with type of entity to display.

    :returns: A list with dictionaries of entities for specified type.
     N/A output N/A N/A utils execute dmidecode -q --type type N/A lines N/A N/A N/A output N/A 0 split N/A info N/A N/A multiline_values None N/A section 0 N/A line lines N/A N/A N/A N/A N/A len line 0 N/A N/A len N/A N/A line strip N/A len line N/A N/A N/A N/A info append N/A N/A section N/A N/A len info 1 N/A N/A N/A N/A k v N/A N/A N/A l strip N/A l N/A N/A line split : 1 N/A N/A N/A ValueError N/A N/A k N/A N/A line strip N/A N/A k N/A N/A multiline_values None N/A multiline_values N/A N/A N/A N/A N/A N/A info N/A section N/A multiline_values append k N/A N/A N/A v N/A N/A multiline_values N/A N/A k lower N/A N/A N/A info N/A section N/A multiline_values N/A N/A N/A N/A N/A info N/A section N/A N/A N/A k lower v N/A info N/A parse_lspci N/A N/A N/A N/A N/A Parses `lspci` output.

    :returns: A list of dicts containing PCI devices information
     N/A output N/A N/A utils execute lspci -vmm -D N/A lines N/A N/A N/A output N/A 0 split N/A info N/A N/A N/A section 0 N/A line N/A lines N/A -2 N/A N/A N/A N/A N/A k v N/A N/A N/A l strip N/A l N/A N/A line split : 1 N/A N/A N/A ValueError N/A N/A N/A N/A info append N/A N/A section 1 N/A N/A N/A N/A info N/A section N/A N/A N/A k lower v N/A info N/A parse_simple_kv N/A N/A N/A command N/A N/A Parses simple key:value output from specified command.

    :param command: A command to execute

    :returns: A dict of parsed key-value data
     N/A output N/A N/A utils execute command N/A lines N/A N/A N/A output N/A 0 split N/A info N/A N/A line N/A lines N/A -1 N/A N/A N/A N/A N/A k v N/A N/A N/A l strip N/A l N/A N/A line split : 1 N/A N/A N/A ValueError N/A N/A N/A N/A N/A info N/A N/A N/A k lower v N/A info N/A is_disk N/A N/A dev bspec uspec N/A None None N/A N/A Checks if given device is a disk.

    :param dev: A device file, e.g. /dev/sda.
    :param bspec: A dict of properties which we get from blockdev.
    :param uspec: A dict of properties which we get from udevadm.

    :returns: True if device is disk else False.
     N/A N/A uspec None N/A N/A uspec N/A udevreport dev N/A N/A N/A N/A uspec get ID_CDROM 1 N/A N/A False N/A N/A N/A N/A uspec get DEVTYPE partition N/A N/A False N/A N/A N/A MAJOR uspec N/A N/A int N/A uspec N/A MAJOR VALID_MAJORS N/A N/A False N/A N/A bspec None N/A N/A bspec N/A blockdevreport dev N/A N/A N/A N/A bspec get ro 1 N/A N/A False N/A True N/A udevreport N/A N/A dev N/A N/A N/A Builds device udevadm report.

    :param dev: A device file, e.g. /dev/sda.

    :returns: A dict of udev device properties.
     N/A report N/A N/A N/A utils execute udevadm info --query=property --export N/A N/A --name={0} format dev check_exit_code N/A 0 N/A 0 N/A spec N/A N/A line N/A l N/A l N/A N/A report splitlines l N/A N/A N/A key value N/A N/A line split = 1 N/A value N/A N/A value strip ' N/A N/A key DEVLINKS N/A N/A N/A spec N/A DEVLINKS N/A N/A value split N/A N/A key UDEV_PROPERTIES N/A N/A N/A spec N/A key value N/A spec N/A blockdevreport N/A N/A blockdev N/A N/A N/A Builds device blockdev report.

    :param blockdev: A block device file, e.g. /dev/sda.

    :returns: A dict of blockdev properties.
     N/A cmd N/A blockdev --getsz --getro --getss --getpbsz --getsize64 --getiomin --getioopt --getra --getalignoff --getmaxsect blockdev N/A opts N/A N/A o N/A 5 N/A o cmd N/A N/A o startswith --get N/A report N/A N/A N/A utils execute check_exit_code N/A 0 cmd N/A 0 N/A N/A dict N/A zip opts N/A N/A report splitlines N/A extrareport N/A N/A dev N/A N/A N/A Builds device report using some additional sources.

    :param dev: A device file, e.g. /dev/sda.

    :returns: A dict of properties.
     N/A spec N/A N/A name N/A N/A N/A os path basename dev N/A N/A N/A N/A open N/A N/A /sys/block/{0}/removable format name file N/A N/A N/A spec N/A removable N/A N/A N/A N/A file read strip N/A N/A N/A Exception N/A N/A N/A key N/A state timeout vendor N/A N/A N/A N/A N/A open N/A N/A /sys/block/{0}/device/{1} format name key file N/A N/A N/A spec N/A key N/A N/A N/A N/A file read strip N/A N/A N/A Exception N/A N/A N/A spec N/A is_block_device N/A N/A filepath N/A N/A N/A Check whether `filepath` is a block device. N/A mode N/A N/A N/A os stat filepath st_mode N/A N/A N/A stat S_ISBLK mode N/A scsi_address_list N/A N/A N/A N/A N/A scsi_sg_path /proc/scsi/sg/ N/A N/A N/A scsi_devices N/A N/A N/A N/A N/A open N/A scsi_sg_path devices read splitlines N/A N/A N/A IOError N/A N/A N/A N/A N/A N/A N/A N/A : join N/A N/A N/A dev split N/A 4 N/A dev scsi_devices N/A scsi_address N/A N/A dev N/A N/A N/A address N/A scsi_address_list N/A N/A scsi_path N/A /sys/class/scsi_device/%s/device/block/ address N/A N/A dev N/A N/A N/A os path join /dev N/A N/A N/A os listdir scsi_path N/A 0 N/A N/A address N/A get_block_devices_from_udev_db N/A N/A N/A N/A N/A N/A get_block_data_from_udev disk N/A get_partitions_from_udev_db N/A N/A N/A N/A N/A N/A get_block_data_from_udev partition N/A get_vg_devices_from_udev_db N/A N/A N/A N/A N/A N/A get_block_data_from_udev disk vg True N/A _is_valid_dev_type N/A N/A device_info vg N/A N/A N/A Returns bool value if we should use device based on different rules:

    1. Should have approved MAJOR number
    2. Shouldn't be nbd/ram/loop device
    3. Should contain DEVNAME itself
    4. Should be compared with vg value

    :param device_info: A dict of properties which we get from udevadm.
    :param vg: determine if we need LVM devices or not.
    :returns: bool if we should use this device.
     N/A N/A N/A E: MAJOR device_info N/A N/A int N/A device_info N/A E: MAJOR VALID_MAJORS N/A N/A False N/A N/A any N/A N/A N/A N/A N/A N/A os path basename N/A device_info N/A E: DEVNAME startswith n N/A n N/A nbd ram loop N/A N/A False N/A N/A E: DEVNAME device_info N/A N/A False N/A N/A N/A vg N/A E: DM_VG_NAME device_info N/A N/A vg N/A E: DM_VG_NAME device_info N/A N/A True N/A N/A False N/A get_block_data_from_udev N/A N/A devtype vg N/A False N/A N/A devs N/A N/A output N/A N/A N/A utils execute udevadm info --export-db N/A 0 N/A device N/A N/A output split N/A N/A N/A N/A SUBSYSTEM=block device N/A N/A DEVTYPE=%s devtype device N/A N/A device_info N/A dict N/A N/A N/A N/A N/A line partition = N/A 0 N/A N/A N/A line partition = N/A 2 N/A line N/A N/A device split N/A N/A line startswith E: N/A N/A _is_valid_dev_type device_info vg N/A N/A N/A N/A devs append N/A device_info N/A E: DEVNAME N/A devs N/A list_block_devices N/A N/A disks N/A True N/A N/A Gets list of block devices

    Tries to guess which of them are disks
    and returns list of dicts representing those disks.

    :returns: A list of dict representing disks available on a node.
     N/A bdevs N/A N/A devs N/A get_block_devices_from_udev_db N/A device devs N/A N/A bdev N/A get_device_info device disks N/A bdev N/A N/A N/A N/A bdevs append bdev N/A bdevs N/A get_device_ids N/A N/A device N/A N/A N/A uspec N/A udevreport device N/A N/A DEVLINKS uspec N/A N/A None N/A paths N/A N/A element N/A uspec N/A DEVLINKS N/A N/A regex N/A N/A re search disk/by.* element N/A regex N/A N/A val N/A N/A regex group 0 N/A N/A N/A paths append val N/A N/A name paths device paths N/A get_device_info N/A N/A device disks N/A True N/A N/A N/A N/A uspec N/A udevreport device N/A espec N/A extrareport device N/A bspec N/A blockdevreport device N/A N/A N/A N/A KeyError ValueError TypeError N/A errors ProcessExecutionError N/A e N/A N/A N/A N/A LOG warning Skipping block device %s. Failed to get all information about the device: %s device e N/A N/A N/A disks N/A N/A is_disk device bspec bspec uspec uspec N/A N/A N/A bdev N/A device uspec bspec espec device uspec bspec espec N/A bdev N/A match_device N/A N/A uspec1 uspec2 N/A N/A N/A Tries to find out if uspec1 and uspec2 are uspecs from the same device

    It compares only some fields in uspecs (not all of them) which, we believe,
    is enough to say exactly whether uspecs belong to the same device or not.

    :param uspec1: A dict of properties which we get from udevadm.
    :param uspec1: A dict of properties which we get from udevadm.

    :returns: True if uspecs match each other else False.
     N/A N/A N/A ID_WWN uspec1 N/A ID_WWN uspec2 N/A N/A uspec1 N/A ID_WWN N/A uspec2 N/A ID_WWN N/A N/A False N/A N/A N/A ID_SERIAL_SHORT uspec1 N/A ID_SERIAL_SHORT uspec2 N/A N/A uspec1 N/A ID_SERIAL_SHORT N/A uspec2 N/A ID_SERIAL_SHORT N/A N/A False N/A N/A N/A DEVLINKS uspec1 N/A DEVLINKS uspec2 N/A any N/A N/A N/A x startswith /dev/disk/by-id N/A x N/A N/A set N/A uspec1 N/A DEVLINKS N/A set N/A uspec2 N/A DEVLINKS N/A N/A True N/A N/A N/A N/A N/A uspec1 get ID_WWN N/A N/A uspec2 get ID_WWN None N/A N/A N/A uspec1 get DEVTYPE N/A N/A uspec2 get DEVTYPE disk N/A N/A True N/A N/A N/A N/A N/A uspec1 get ID_WWN N/A N/A uspec2 get ID_WWN None N/A N/A N/A uspec1 get DEVTYPE N/A N/A uspec2 get DEVTYPE partition N/A N/A N/A uspec1 get MINOR N/A N/A uspec2 get MINOR None N/A N/A True N/A N/A N/A N/A N/A uspec1 get ID_SERIAL_SHORT N/A N/A uspec2 get ID_SERIAL_SHORT None N/A N/A N/A uspec1 get DEVTYPE N/A N/A uspec2 get DEVTYPE disk N/A N/A True N/A N/A N/A N/A uspec1 get DEVPATH N/A N/A uspec2 get DEVPATH None N/A N/A True N/A False N/A