How to use perf_disk method in lisa

Best Python code snippet using lisa_python

storageperf.py

Source:storageperf.py Github

copy

Full Screen

...217 origin_value: Dict[str, str] = {}218 for node in [server, client]:219 origin_value[node.name] = node.tools[Sysctl].get("fs.aio-max-nr")220 node.tools[Sysctl].write("fs.aio-max-nr", "1048576")221 perf_disk(222 client,223 start_iodepth,224 max_iodepth,225 filename,226 test_name=inspect.stack()[1][3],227 core_count=core_count,228 disk_count=server_data_disk_count,229 disk_setup_type=DiskSetupType.raid0,230 disk_type=DiskType.premiumssd,231 num_jobs=num_jobs,232 block_size=block_size,233 size_mb=256,234 overwrite=True,235 cwd=PurePosixPath(client_nfs_mount_dir),236 test_result=test_result,237 )238 for node in [server, client]:239 node.tools[Sysctl].write("fs.aio-max-nr", origin_value[node.name])240 def _perf_nfs(241 self,242 test_result: TestResult,243 server_raid_disk_name: str = "/dev/md0",244 server_raid_disk_mount_dir: str = "/mnt/nfs_share",245 client_nfs_mount_dir: str = "/mnt/nfs_client_share",246 protocol: str = "tcp",247 filename: str = "fiodata",248 block_size: int = 4,249 start_iodepth: int = 1,250 max_iodepth: int = 1024,251 ) -> None:252 environment = test_result.environment253 assert environment, "fail to get environment from testresult"254 server_node = cast(RemoteNode, environment.nodes[0])255 client_node = cast(RemoteNode, environment.nodes[1])256 # Run test only on Debian, SLES and Redhat distributions257 if (258 not isinstance(server_node.os, Redhat)259 and not isinstance(server_node.os, Debian)260 and not isinstance(server_node.os, SLES)261 ):262 raise SkippedException(f"{server_node.os.name} not supported")263 # refer below link, in RHEL 8, NFS over UDP is no longer supported.264 # https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/deploying_different_types_of_servers/exporting-nfs-shares_deploying-different-types-of-servers#the-tcp-and-udp-protocols-in-nfsv3-and-nfsv4_exporting-nfs-shares # noqa: E501265 if (266 "udp" == protocol267 and isinstance(server_node.os, Redhat)268 and server_node.os.information.version >= "8.0.0"269 ):270 raise SkippedException(271 f"udp mode not supported on {server_node.os.information.vendor} "272 f"{server_node.os.information.release}"273 )274 # Each fio process start jobs equal to the iodepth to read/write from275 # the disks. The max number of jobs can be equal to the core count of276 # the node.277 # Examples:278 # iodepth = 4, core count = 8 => max_jobs = 4279 # iodepth = 16, core count = 8 => max_jobs = 8280 num_jobs = []281 iodepth_iter = start_iodepth282 core_count = client_node.tools[Lscpu].get_core_count()283 while iodepth_iter <= max_iodepth:284 num_jobs.append(min(iodepth_iter, core_count))285 iodepth_iter = iodepth_iter * 2286 # setup raid on server287 server_data_disks = server_node.features[Disk].get_raw_data_disks()288 server_data_disk_count = len(server_data_disks)289 server_partition_disks = reset_partitions(server_node, server_data_disks)290 reset_raid(server_node, server_partition_disks)291 try:292 self._configure_nfs(293 server_node,294 client_node,295 server_raid_disk_name=server_raid_disk_name,296 server_raid_disk_mount_dir=server_raid_disk_mount_dir,297 client_nfs_mount_dir=client_nfs_mount_dir,298 protocol=protocol,299 )300 # run fio test301 self._run_fio_on_nfs(302 test_result,303 server_node,304 client_node,305 server_data_disk_count,306 client_nfs_mount_dir,307 core_count,308 num_jobs,309 start_iodepth=start_iodepth,310 max_iodepth=max_iodepth,311 filename=filename,312 block_size=block_size,313 )314 finally:315 # clean up316 # stop nfs server and client317 server_node.tools[NFSServer].stop()318 client_node.tools[NFSClient].stop(mount_dir=client_nfs_mount_dir)319 server_node.tools[Mount].umount(320 server_raid_disk_name, server_raid_disk_mount_dir321 )322 def _perf_premium_datadisks(323 self,324 node: Node,325 test_result: TestResult,326 block_size: int = 4,327 max_iodepth: int = 256,328 filename: str = "/dev/md0",329 ) -> None:330 disk = node.features[Disk]331 data_disks = disk.get_raw_data_disks()332 disk_count = len(data_disks)333 assert_that(disk_count).described_as(334 "At least 1 data disk for fio testing."335 ).is_greater_than(0)336 partition_disks = reset_partitions(node, data_disks)337 reset_raid(node, partition_disks)338 cpu = node.tools[Lscpu]339 core_count = cpu.get_core_count()340 start_iodepth = 1341 perf_disk(342 node,343 start_iodepth,344 max_iodepth,345 filename,346 test_name=inspect.stack()[1][3],347 core_count=core_count,348 disk_count=disk_count,349 disk_setup_type=DiskSetupType.raid0,350 disk_type=DiskType.premiumssd,351 numjob=core_count,352 block_size=block_size,353 size_mb=8192,354 overwrite=True,355 test_result=test_result,...

Full Screen

Full Screen

nvmeperf.py

Source:nvmeperf.py Github

copy

Full Screen

...55 cpu = node.tools[Lscpu]56 core_count = cpu.get_core_count()57 start_iodepth = 158 max_iodepth = 25659 perf_disk(60 node,61 start_iodepth,62 max_iodepth,63 filename,64 core_count=core_count,65 disk_count=disk_count,66 numjob=core_count,67 disk_setup_type=DiskSetupType.raw,68 disk_type=DiskType.nvme,69 test_result=result,...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

1from node.api_func import Indb_func...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful