How to use _run_fio_on_nfs method in lisa

Best Python code snippet using lisa_python

storageperf.py

Source:storageperf.py Github

copy

Full Screen

...199 server_raid_disk_mount_dir,200 client_nfs_mount_dir,201 f"proto={protocol},vers=3",202 )203 def _run_fio_on_nfs(204 self,205 test_result: TestResult,206 server: RemoteNode,207 client: RemoteNode,208 server_data_disk_count: int,209 client_nfs_mount_dir: str,210 core_count: int,211 num_jobs: List[int],212 start_iodepth: int = 1,213 max_iodepth: int = 1024,214 filename: str = "fiodata",215 block_size: int = 4,216 ) -> None: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 up...

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