How to use _perf_premium_datadisks method in lisa

Best Python code snippet using lisa_python

storageperf.py

Source:storageperf.py Github

copy

Full Screen

...53 supported_features=[IsolatedResource],54 ),55 )56 def perf_premium_datadisks_4k(self, node: Node, result: TestResult) -> None:57 self._perf_premium_datadisks(node, result)58 @TestCaseMetadata(59 description="""60 This test case uses fio to test data disk performance using 1024K block size.61 """,62 priority=3,63 timeout=TIME_OUT,64 requirement=simple_requirement(65 disk=schema.DiskOptionSettings(66 disk_type=schema.DiskType.PremiumSSDLRS,67 data_disk_iops=search_space.IntRange(min=5000),68 data_disk_count=search_space.IntRange(min=16),69 ),70 supported_features=[IsolatedResource],71 ),72 )73 def perf_premium_datadisks_1024k(self, node: Node, result: TestResult) -> None:74 self._perf_premium_datadisks(node, result, block_size=1024)75 @TestCaseMetadata(76 description="""77 This test case uses fio to test vm with 24 data disks.78 """,79 priority=3,80 timeout=TIME_OUT,81 requirement=simple_requirement(82 disk=schema.DiskOptionSettings(83 disk_type=schema.DiskType.PremiumSSDLRS,84 data_disk_iops=search_space.IntRange(min=5000),85 data_disk_count=search_space.IntRange(min=24),86 ),87 supported_features=[IsolatedResource],88 ),89 )90 def perf_premium_datadisks_io(self, node: Node, result: TestResult) -> None:91 self._perf_premium_datadisks(92 node,93 result,94 max_iodepth=64,95 filename="/dev/sdc",96 )97 @TestCaseMetadata(98 description="""99 This test case uses fio to test performance of nfs server over TCP with100 VM's initialized with SRIOV network interface.101 """,102 priority=3,103 timeout=TIME_OUT,104 requirement=simple_requirement(105 min_count=2,106 disk=schema.DiskOptionSettings(107 disk_type=schema.DiskType.PremiumSSDLRS,108 data_disk_iops=search_space.IntRange(min=5000),109 data_disk_count=search_space.IntRange(min=12),110 data_disk_size=search_space.IntRange(min=10),111 ),112 network_interface=Sriov(),113 ),114 )115 def perf_storage_over_nfs_sriov_tcp_4k(self, result: TestResult) -> None:116 self._perf_nfs(result)117 @TestCaseMetadata(118 description="""119 This test case uses fio to test performance of nfs server over UDP with120 VM's initialized with SRIOV network interface.121 """,122 priority=3,123 timeout=TIME_OUT,124 requirement=simple_requirement(125 min_count=2,126 disk=schema.DiskOptionSettings(127 disk_type=schema.DiskType.PremiumSSDLRS,128 data_disk_iops=search_space.IntRange(min=5000),129 data_disk_count=search_space.IntRange(min=12),130 data_disk_size=search_space.IntRange(min=10),131 ),132 network_interface=Sriov(),133 ),134 )135 def perf_storage_over_nfs_sriov_udp_4k(self, result: TestResult) -> None:136 self._perf_nfs(result, protocol="udp")137 @TestCaseMetadata(138 description="""139 This test case uses fio to test performance of nfs server over TCP with140 VM's initialized with synthetic network interface.141 """,142 priority=3,143 timeout=TIME_OUT,144 requirement=simple_requirement(145 min_count=2,146 disk=schema.DiskOptionSettings(147 disk_type=schema.DiskType.PremiumSSDLRS,148 data_disk_iops=search_space.IntRange(min=5000),149 data_disk_count=search_space.IntRange(min=12),150 data_disk_size=search_space.IntRange(min=10),151 ),152 network_interface=Synthetic(),153 ),154 )155 def perf_storage_over_nfs_synthetic_tcp_4k(self, result: TestResult) -> None:156 self._perf_nfs(result)157 @TestCaseMetadata(158 description="""159 This test case uses fio to test performance of nfs server over UDP with160 VM's initialized with synthetic network interface.161 """,162 priority=3,163 timeout=TIME_OUT,164 requirement=simple_requirement(165 min_count=2,166 disk=schema.DiskOptionSettings(167 disk_type=schema.DiskType.PremiumSSDLRS,168 data_disk_iops=search_space.IntRange(min=5000),169 data_disk_count=search_space.IntRange(min=12),170 data_disk_size=search_space.IntRange(min=10),171 ),172 network_interface=Synthetic(),173 ),174 )175 def perf_storage_over_nfs_synthetic_udp_4k(self, result: TestResult) -> None:176 self._perf_nfs(result, protocol="udp")177 def _configure_nfs(178 self,179 server: RemoteNode,180 client: RemoteNode,181 server_raid_disk_name: str = "/dev/md0",182 server_raid_disk_mount_dir: str = "/mnt",183 client_nfs_mount_dir: str = "/mnt/nfs_client_share",184 protocol: str = "tcp",185 ) -> None:186 # mount raid disk on server187 server.shell.mkdir(PurePosixPath(server_raid_disk_mount_dir), exist_ok=True)188 server.tools[Mkfs].format_disk(server_raid_disk_name, FileSystem.ext4)189 server.tools[Mount].mount(190 server_raid_disk_name, server_raid_disk_mount_dir, options="nobarrier"191 )192 # setup nfs on server193 server.tools[NFSServer].create_shared_dir(194 [client.internal_address], server_raid_disk_mount_dir195 )196 # setup raid on client197 client.tools[NFSClient].setup(198 server.internal_address,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 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)...

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