Best Python code snippet using lisa_python
nestedperf.py
Source:nestedperf.py  
...614            NESTED_VM_REQUIRED_DISK_SIZE_IN_GB615        )616        image_download_disk = (617            node.tools[Lsblk]618            .find_disk_by_mountpoint(image_download_location, force_run=True)619            .device_name620        )621        log.debug(f"image_download_disk: {image_download_disk}")622        if image_download_disk in l1_data_disks:623            l1_data_disks.remove(image_download_disk)624        l1_data_disk_count = len(l1_data_disks)625        try:626            # setup raid on l1 data disks627            if setup_raid:628                disks = ["/dev/md0"]629                l1_partition_disks = reset_partitions(node, l1_data_disks)630                stop_raid(node)631                reset_raid(node, l1_partition_disks)632            else:...lsblk.py
Source:lsblk.py  
...146                    partitions=disk_partition_map.get(lsblk_entry["name"], []),147                )148            )149        return disks150    def find_disk_by_mountpoint(151        self, mountpoint: str, force_run: bool = False152    ) -> DiskInfo:153        disks = self.get_disks(force_run=force_run)154        for disk in disks:155            # check if disk is mounted and moutpoint matches156            if disk.mountpoint == mountpoint:157                return disk158            # check if any of the partitions is mounted and moutpoint matches159            for partition in disk.partitions:160                if partition.mountpoint == mountpoint:161                    return disk162        raise LisaException(f"Could not find disk with mountpoint {mountpoint}")163    def find_mountpoint_by_volume_name(164        self, volume_name: str, force_run: bool = False...ltpsuite.py
Source:ltpsuite.py  
...64        # get drive name for running ltp tests65        mountpoint = node.find_partition_with_freespace(66            self.LTP_REQUIRED_DISK_SIZE_IN_GB67        )68        drive_name = node.tools[Lsblk].find_disk_by_mountpoint(mountpoint).device_name69        # run ltp lite tests70        node.tools[Ltp].run_test(71            result,72            environment,73            test_list,74            skip_test_list,75            log_path,76            drive_name=drive_name,77        )78    def after_case(self, log: Logger, **kwargs: Any) -> None:79        # remove swap file created by ltp run since80        # can interfere with other tests81        node: Node = kwargs.pop("node")82        node.tools[Swap].delete_swap()Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
