staging-nixos merge for 2025-12-18 (#472073)

This commit is contained in:
K900
2025-12-18 15:19:09 +00:00
committed by GitHub
3 changed files with 50 additions and 12 deletions
@@ -292,12 +292,18 @@ class Machine:
return self.booted and self.connected
def log(self, msg: str) -> None:
"""
Log a message to console.
"""
self.logger.log(msg, {"machine": self.name})
def log_serial(self, msg: str) -> None:
self.logger.log_serial(msg, self.name)
def nested(self, msg: str, attrs: dict[str, str] = {}) -> _GeneratorContextManager:
"""
Get nested logger, optionally with extra attributes.
"""
my_attrs = {"machine": self.name}
my_attrs.update(attrs)
return self.logger.nested(msg, my_attrs)
@@ -357,6 +363,9 @@ class Machine:
retry(check_active, timeout)
def get_unit_info(self, unit: str, user: str | None = None) -> dict[str, str]:
"""
Get a dictionary of systemd unit properties, as obtained via `systemctl show`.
"""
status, lines = self.systemctl(f'--no-pager show "{unit}"', user)
if status != 0:
raise RequestedAssertionFailed(
@@ -384,6 +393,9 @@ class Machine:
property: str,
user: str | None = None,
) -> str:
"""
Get the string value of a single systemd unit property
"""
status, lines = self.systemctl(
f'--no-pager show "{unit}" --property="{property}"',
user,
@@ -431,6 +443,9 @@ class Machine:
return self.execute(f"systemctl {q}")
def require_unit_state(self, unit: str, require_state: str = "active") -> None:
"""
Assert that the current state of a unit has a specific value. The default state is "active".
"""
with self.nested(
f"checking if unit '{unit}' has reached state '{require_state}'"
):
@@ -648,6 +663,10 @@ class Machine:
return output
def wait_for_shutdown(self) -> None:
"""
Wait for the VM to power off. This does *not* initiate a shutdown;
that's usually done via `shutdown()`.
"""
if not self.booted:
return
@@ -687,6 +706,9 @@ class Machine:
raise TimeoutError
def get_tty_text(self, tty: str) -> str:
"""
Get the output printed to a given TTY.
"""
status, output = self.execute(
f"fold -w$(stty -F /dev/tty{tty} size | awk '{{print $2}}') /dev/vcs{tty}"
)
@@ -785,12 +807,22 @@ class Machine:
retry(port_is_closed, timeout)
def start_job(self, jobname: str, user: str | None = None) -> tuple[int, str]:
"""
Start systemd service.
"""
return self.systemctl(f"start {jobname}", user)
def stop_job(self, jobname: str, user: str | None = None) -> tuple[int, str]:
"""
Stop systemd service.
"""
return self.systemctl(f"stop {jobname}", user)
def connect(self) -> None:
"""
Wait for a connection to the guest root shell
"""
def shell_ready(timeout_secs: int) -> bool:
"""We sent some data from the backdoor service running on the guest
to indicate that the backdoor shell is ready.
@@ -561,16 +561,17 @@ let
# Enable CEC over DisplayPort
DRM_DP_CEC = whenOlder "6.10" yes;
DRM_DISPLAY_DP_AUX_CEC = whenAtLeast "6.10" yes;
# Required for Nova
# FIXME: remove after https://gitlab.freedesktop.org/drm/rust/kernel/-/commit/3d3352e73a55a4ccf110f8b3419bbe2fbfd8a030 lands
RUST_FW_LOADER_ABSTRACTIONS = whenAtLeast "6.12" yes;
}
//
lib.optionalAttrs
(stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux")
{
# Enable Hyper-V guest stuff
HYPERV = lib.mkMerge [
(whenOlder "6.18" module)
(whenAtLeast "6.18" yes)
];
HYPERV = whenAtLeast "6.18" yes;
# Enable Hyper-V Synthetic DRM Driver
DRM_HYPERV = whenAtLeast "5.14" module;
# And disable the legacy framebuffer driver when we have the new one
@@ -931,6 +932,7 @@ let
BPF_EVENTS = yes;
FUNCTION_PROFILER = yes;
RING_BUFFER_BENCHMARK = no;
FUNCTION_GRAPH_RETVAL = whenAtLeast "6.5" yes;
};
perf = {
@@ -1407,6 +1409,10 @@ let
# Enable generic kernel watch queues
# See https://docs.kernel.org/core-api/watch_queue.html
WATCH_QUEUE = yes;
# Enable coreboot firmware drivers.
# While these are called CONFIG_GOOGLE_*, they apply to coreboot systems in general.
GOOGLE_FIRMWARE = yes;
}
//
lib.optionalAttrs
@@ -1,7 +1,7 @@
{
"testing": {
"version": "6.18-rc7",
"hash": "sha256:03k1kj4bqg3bn0p4lzkbz0yqj1p50v2yr94lrld8rrkbwdawxx3r",
"version": "6.19-rc1",
"hash": "sha256:1jfcm4m2xbglirn8qdvhb3675fln9cjfva3v9hhs6a4qqqx2396f",
"lts": false
},
"6.1": {
@@ -25,18 +25,18 @@
"lts": true
},
"6.12": {
"version": "6.12.62",
"hash": "sha256:04rcnr7bgrqqfj62l31mxx553bjdalr5f46xjbcmvawgmj2wdqhk",
"version": "6.12.63",
"hash": "sha256:1cvxvwlmnqw71nf6nizf0hpp710a8dsczz5bjwy3i55qwkzwa0lm",
"lts": true
},
"6.17": {
"version": "6.17.12",
"hash": "sha256:1mlqirjzyx3zvvm87gf7slj2d5gdpp13vw91dgbfk54iz6b08y22",
"version": "6.17.13",
"hash": "sha256:1fgdy9j90yfd4c2yqdciasdhda14pbfrpzkgriin2r6i7bf04s0i",
"lts": false
},
"6.18": {
"version": "6.18.1",
"hash": "sha256:1m955svk1sfmhpw5wpkhg1dpnxmwsnpdqnivmw8alaniy3rqp9yh",
"version": "6.18.2",
"hash": "sha256:0smrmbnlhfivw2kx689wd52aff80gf0gw9wqz4s2nja9nyx6p32m",
"lts": false
}
}