зеркало из https://github.com/microsoft/lisa.git
Move get_resource_disk_mount_point to Features.Disks so testsuites can call it
This commit is contained in:
Родитель
fd10d583d2
Коммит
88ade7a262
|
@ -61,6 +61,9 @@ class Disk(Feature):
|
|||
def _initialize(self, *args: Any, **kwargs: Any) -> None:
|
||||
self.disks: List[str] = []
|
||||
|
||||
def get_resource_disk_mount_point(self) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
DiskEphemeral = partial(schema.DiskOptionSettings, disk_type=schema.DiskType.Ephemeral)
|
||||
DiskPremiumSSDLRS = partial(
|
||||
|
|
|
@ -41,7 +41,7 @@ from lisa.features.gpu import ComputeSDK
|
|||
from lisa.features.resize import ResizeAction
|
||||
from lisa.features.security_profile import SecurityProfileSettings, SecurityProfileType
|
||||
from lisa.node import Node, RemoteNode
|
||||
from lisa.operating_system import Redhat, Suse, Ubuntu
|
||||
from lisa.operating_system import CentOs, Redhat, Suse, Ubuntu
|
||||
from lisa.search_space import RequirementMethod
|
||||
from lisa.tools import Dmesg, Lspci, Modprobe
|
||||
from lisa.util import (
|
||||
|
@ -86,6 +86,7 @@ from .common import (
|
|||
save_console_log,
|
||||
wait_operation,
|
||||
)
|
||||
from .tools import Waagent
|
||||
|
||||
|
||||
class AzureFeatureMixin:
|
||||
|
@ -1221,6 +1222,26 @@ class Disk(AzureFeatureMixin, features.Disk):
|
|||
self._node.capability.disk.data_disk_count -= len(names)
|
||||
self._node.close()
|
||||
|
||||
def get_resource_disk_mount_point(self) -> str:
|
||||
# by default, cloudinit will use /mnt as mount point of resource disk
|
||||
# in CentOS, cloud.cfg.d/91-azure_datasource.cfg customize mount point as
|
||||
# /mnt/resource
|
||||
if (
|
||||
not isinstance(self._node.os, CentOs)
|
||||
and self._node.shell.exists(
|
||||
self._node.get_pure_path("/var/log/cloud-init.log")
|
||||
)
|
||||
and self._node.shell.exists(
|
||||
self._node.get_pure_path("/var/lib/cloud/instance")
|
||||
)
|
||||
):
|
||||
self._log.debug("Disk handled by cloud-init.")
|
||||
mount_point = "/mnt"
|
||||
else:
|
||||
self._log.debug("Disk handled by waagent.")
|
||||
mount_point = self._node.tools[Waagent].get_resource_disk_mount_point()
|
||||
return mount_point
|
||||
|
||||
|
||||
def get_azure_disk_type(disk_type: schema.DiskType) -> str:
|
||||
assert isinstance(disk_type, schema.DiskType), (
|
||||
|
|
|
@ -8,7 +8,6 @@ from typing import List, Pattern, cast
|
|||
from assertpy.assertpy import assert_that
|
||||
|
||||
from lisa import (
|
||||
Logger,
|
||||
Node,
|
||||
RemoteNode,
|
||||
TestCaseMetadata,
|
||||
|
@ -45,8 +44,6 @@ from lisa.util import (
|
|||
get_matched_str,
|
||||
)
|
||||
|
||||
from .common import get_resource_disk_mount_point
|
||||
|
||||
|
||||
@TestSuiteMetadata(
|
||||
area="azure_image_standard",
|
||||
|
@ -932,8 +929,8 @@ class AzureImageStandard(TestSuite):
|
|||
supported_platform_type=[AZURE],
|
||||
),
|
||||
)
|
||||
def verify_resource_disk_readme_file(self, log: Logger, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = get_resource_disk_mount_point(log, node)
|
||||
def verify_resource_disk_readme_file(self, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = node.features[Disk].get_resource_disk_mount_point()
|
||||
|
||||
# verify that resource disk is mounted
|
||||
# function returns successfully if disk matching mount point is present
|
||||
|
@ -973,8 +970,8 @@ class AzureImageStandard(TestSuite):
|
|||
supported_platform_type=[AZURE],
|
||||
),
|
||||
)
|
||||
def verify_resource_disk_file_system(self, log: Logger, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = get_resource_disk_mount_point(log, node)
|
||||
def verify_resource_disk_file_system(self, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = node.features[Disk].get_resource_disk_mount_point()
|
||||
node.features[Disk].get_partition_with_mount_point(resource_disk_mount_point)
|
||||
disk_info = node.tools[Lsblk].find_disk_by_mountpoint(resource_disk_mount_point)
|
||||
for partition in disk_info.partitions:
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
from pathlib import PurePosixPath
|
||||
|
||||
from lisa import Logger, RemoteNode
|
||||
from lisa.operating_system import CentOs
|
||||
from lisa.sut_orchestrator.azure.tools import Waagent
|
||||
|
||||
|
||||
def get_resource_disk_mount_point(
|
||||
log: Logger,
|
||||
node: RemoteNode,
|
||||
) -> str:
|
||||
# by default, cloudinit will use /mnt as mount point of resource disk
|
||||
# in CentOS, cloud.cfg.d/91-azure_datasource.cfg customize mount point as
|
||||
# /mnt/resource
|
||||
if (
|
||||
node.shell.exists(PurePosixPath("/var/log/cloud-init.log"))
|
||||
and node.shell.exists(PurePosixPath("/var/lib/cloud/instance"))
|
||||
and not isinstance(node.os, CentOs)
|
||||
):
|
||||
log.debug("Disk handled by cloud-init.")
|
||||
mount_point = "/mnt"
|
||||
else:
|
||||
log.debug("Disk handled by waagent.")
|
||||
mount_point = node.tools[Waagent].get_resource_disk_mount_point()
|
||||
return mount_point
|
|
@ -29,8 +29,6 @@ from lisa.tools import Blkid, Cat, Dmesg, Echo, Lsblk, NFSClient, Swap
|
|||
from lisa.util import BadEnvironmentStateException, LisaException, get_matched_str
|
||||
from lisa.util.perf_timer import create_timer
|
||||
|
||||
from .common import get_resource_disk_mount_point
|
||||
|
||||
|
||||
@TestSuiteMetadata(
|
||||
area="storage",
|
||||
|
@ -106,8 +104,8 @@ class Storage(TestSuite):
|
|||
supported_platform_type=[AZURE],
|
||||
),
|
||||
)
|
||||
def verify_resource_disk_mtab_entry(self, log: Logger, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = get_resource_disk_mount_point(log, node)
|
||||
def verify_resource_disk_mtab_entry(self, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = node.features[Disk].get_resource_disk_mount_point()
|
||||
# os disk(root disk) is the entry with mount point `/' in the output
|
||||
# of `mount` command
|
||||
os_disk = (
|
||||
|
@ -163,8 +161,8 @@ class Storage(TestSuite):
|
|||
supported_platform_type=[AZURE],
|
||||
),
|
||||
)
|
||||
def verify_resource_disk_io(self, log: Logger, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = get_resource_disk_mount_point(log, node)
|
||||
def verify_resource_disk_io(self, node: RemoteNode) -> None:
|
||||
resource_disk_mount_point = node.features[Disk].get_resource_disk_mount_point()
|
||||
|
||||
# verify that resource disk is mounted
|
||||
# function returns successfully if disk matching mount point is present
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
import time
|
||||
from pathlib import Path, PurePosixPath
|
||||
from pathlib import Path
|
||||
from random import randint
|
||||
from typing import cast
|
||||
|
||||
|
@ -19,9 +19,8 @@ from lisa import (
|
|||
schema,
|
||||
search_space,
|
||||
)
|
||||
from lisa.features import SerialConsole
|
||||
from lisa.features import Disk, SerialConsole
|
||||
from lisa.operating_system import Redhat
|
||||
from lisa.sut_orchestrator.azure.tools import Waagent
|
||||
from lisa.tools import Dmesg, Echo, KdumpBase, KernelConfig, Lscpu, Stat
|
||||
from lisa.tools.free import Free
|
||||
from lisa.util.perf_timer import create_timer
|
||||
|
@ -238,13 +237,7 @@ class KdumpCrash(TestSuite):
|
|||
raise SkippedException("crashkernel=auto doesn't work for the distro.")
|
||||
|
||||
def _get_resource_disk_dump_path(self, node: Node) -> str:
|
||||
if node.shell.exists(
|
||||
PurePosixPath("/var/log/cloud-init.log")
|
||||
) and node.shell.exists(PurePosixPath("/var/lib/cloud/instance")):
|
||||
mount_point = "/mnt"
|
||||
else:
|
||||
mount_point = node.tools[Waagent].get_resource_disk_mount_point()
|
||||
|
||||
mount_point = node.features[Disk].get_resource_disk_mount_point()
|
||||
dump_path = mount_point + "/crash"
|
||||
node.execute(
|
||||
f"mkdir -p {dump_path}",
|
||||
|
|
Загрузка…
Ссылка в новой задаче