Skip to content

Commit

Permalink
Update features.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SRIKKANTH committed Jun 6, 2024
1 parent d0842e2 commit aa2c490
Showing 1 changed file with 37 additions and 38 deletions.
75 changes: 37 additions & 38 deletions lisa/sut_orchestrator/azure/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,44 +1625,43 @@ def _get_scsi_data_disks(self) -> List[str]:
files = ls_tools.list("/dev/disk/azure/scsi1", sudo=True)

azure_scsi_disks = []
# assert self._node.capability.disk
# assert isinstance(self._node.capability.disk.max_data_disk_count, int)
# if len(files) == 0 and self._node.capability.disk.data_disk_count != 0:
if len(files) == 0:
os = self._node.os
# https://docs.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-device-names-problems#get-the-latest-azure-storage-rules # noqa: E501
# there are known issues on ubuntu 16.04 and rhel 9.0
# try to workaround it
if (isinstance(os, Ubuntu) and os.information.release <= "16.04") or (
isinstance(os, Redhat) and os.information.release >= "9.0"
):
self._log.debug(
"download udev rules to construct a set of "
"symbolic links under the /dev/disk/azure path"
)
if ls_tools.is_file(
self._node.get_pure_path("/dev/disk/azure"), sudo=True
):
self._node.tools[Rm].remove_file("/dev/disk/azure", sudo=True)
self._node.tools[Curl].fetch(
arg="-o /etc/udev/rules.d/66-azure-storage.rules",
execute_arg="",
url="https://raw.githubusercontent.com/Azure/WALinuxAgent/master/config/66-azure-storage.rules", # noqa: E501
sudo=True,
cwd=self._node.get_pure_path("/etc/udev/rules.d/"),
)
cmd_result = self._node.execute(
"udevadm trigger --settle --subsystem-match=block", sudo=True
)
if get_matched_str(cmd_result.stdout, self.UN_SUPPORT_SETTLE):
self._node.execute(
"udevadm trigger --subsystem-match=block", sudo=True
)
check_till_timeout(
lambda: len(ls_tools.list("/dev/disk/azure/scsi1", sudo=True)) > 0,
timeout_message="wait for dev rule take effect",
)
files = ls_tools.list("/dev/disk/azure/scsi1", sudo=True)
#assert self._node.capability.disk
#assert isinstance(self._node.capability.disk.max_data_disk_count, int)
#if len(files) == 0 and self._node.capability.disk.data_disk_count != 0:
# os = self._node.os
# # https://docs.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-device-names-problems#get-the-latest-azure-storage-rules # noqa: E501
# # there are known issues on ubuntu 16.04 and rhel 9.0
# # try to workaround it
# if (isinstance(os, Ubuntu) and os.information.release <= "16.04") or (
# isinstance(os, Redhat) and os.information.release >= "9.0"
# ):
# self._log.debug(
# "download udev rules to construct a set of "
# "symbolic links under the /dev/disk/azure path"
# )
# if ls_tools.is_file(
# self._node.get_pure_path("/dev/disk/azure"), sudo=True
# ):
# self._node.tools[Rm].remove_file("/dev/disk/azure", sudo=True)
# self._node.tools[Curl].fetch(
# arg="-o /etc/udev/rules.d/66-azure-storage.rules",
# execute_arg="",
# url="https://raw.githubusercontent.com/Azure/WALinuxAgent/master/config/66-azure-storage.rules", # noqa: E501
# sudo=True,
# cwd=self._node.get_pure_path("/etc/udev/rules.d/"),
# )
# cmd_result = self._node.execute(
# "udevadm trigger --settle --subsystem-match=block", sudo=True
# )
# if get_matched_str(cmd_result.stdout, self.UN_SUPPORT_SETTLE):
# self._node.execute(
# "udevadm trigger --subsystem-match=block", sudo=True
# )
# check_till_timeout(
# lambda: len(ls_tools.list("/dev/disk/azure/scsi1", sudo=True)) > 0,
# timeout_message="wait for dev rule take effect",
# )
# files = ls_tools.list("/dev/disk/azure/scsi1", sudo=True)
azure_scsi_disks = [
x for x in files if get_matched_str(x, self.SCSI_PATTERN) != ""
]
Expand Down

0 comments on commit aa2c490

Please sign in to comment.