@@ -1645,21 +1645,22 @@ def verify_omi_version(self, node: Node) -> None:
16451645
16461646 @TestCaseMetadata (
16471647 description = """
1648- This test verifies that there is no swap partition on the OS disk.
1648+ This test verifies that there is no swap partition or swap file on the OS disk
16491649
16501650 Azure's policy 200.3.3 Linux:
16511651 No swap partition on the OS disk. Swap can be requested for creation on the
16521652 local resource disk by the Linux Agent. It is recommended that a single root
16531653 partition is created for the OS disk.
16541654
1655- There should be no Swap Partition on OS Disk. OS disk has IOPS limit. When
1656- memory pressure causes swapping, IOPS limit may be reached easily and cause VM
1657- performance to go down disastrously, because aside from memory issues in now
1658- also has IO issues.
1655+ There should be no Swap Partition or swap file on OS Disk. OS disk has IOPS
1656+ limit. When memory pressure causes swapping, IOPS limit may be reached easily
1657+ and cause VM performance to go down disastrously, because aside from memory
1658+ issues it now also has IO issues.
16591659
16601660 Steps:
1661- 1. Use 'cat /proc/swaps' or 'swapon -s' to list all swap devices
1662- Note: For FreeBSD, use 'swapinfo -k'.
1661+ 1. Use 'cat /proc/swaps' or 'swapon -s' to list all swap devices and swap files
1662+ If it is a swap file, use 'df <swap_file>' to get the partition name.
1663+ Note: For FreeBSD, use 'swapinfo -k'. FreeBSD only supports swap partition.
16631664 2. Use 'lsblk <swap_part> -P -o NAME' to get the real block device name for
16641665 each swap partition. If there is no swap partition, pass the case.
16651666 3. Use 'lsblk' to identify the OS disk and get all its partitions and logical
@@ -1685,12 +1686,15 @@ def verify_no_swap_on_osdisk(self, node: Node) -> None:
16851686 lsblk = node .tools [Lsblk ]
16861687 os_disk = lsblk .find_disk_by_mountpoint ("/" )
16871688 for swap_part in swap_parts :
1688- block_name = lsblk .get_block_name (swap_part )
1689+ block_name = lsblk .get_block_name (swap_part . partition )
16891690 if block_name == "" :
16901691 raise LisaException (
1691- f"Failed to get the device name for swap partition '{ swap_part } '."
1692+ "Failed to get the device name for swap partition/file "
1693+ f"'{ swap_part .filename } '."
16921694 )
1693- node .log .info (f"Swap partition '{ swap_part } ' is on device '{ block_name } '." )
1695+ node .log .info (
1696+ f"Swap partition '{ swap_part .filename } ' is on device '{ block_name } '."
1697+ )
16941698 for part in os_disk .partitions :
16951699 # e.g. 'sda1', 'vg-root', 'vg-home'
16961700 parts = [part ] + part .logical_devices
@@ -1700,13 +1704,13 @@ def verify_no_swap_on_osdisk(self, node: Node) -> None:
17001704 # "Swap partition .* is found on OS disk" is a failure triage
17011705 # pattern. Please be careful when changing this string.
17021706 raise LisaException (
1703- f"Swap partition '{ swap_part } ' is found on OS disk "
1704- f"partition or logical device '{ p .name } '. There should be "
1705- "no Swap Partition on OS Disk. OS disk has IOPS limit. "
1706- "When memory pressure causes swapping, IOPS limit may be "
1707- "reached easily and cause VM performance to go down "
1708- "disastrously, as aside from memory issues in now also has "
1709- " IO issues."
1707+ f"Swap partition/file '{ swap_part . filename } ' is found on "
1708+ f"OS disk partition or logical device '{ p .name } '. There "
1709+ "should be no Swap Partition on OS Disk. OS disk has IOPS"
1710+ " limit. When memory pressure causes swapping, IOPS limit"
1711+ " may be reached easily and cause VM performance to go "
1712+ "down disastrously, as aside from memory issues it now "
1713+ "also has IO issues."
17101714 )
17111715
17121716 @TestCaseMetadata (
0 commit comments