Skip to content

Commit 520bb5f

Browse files
committed
Delete outdated Phase 1 implementation summary, apply minor improvements to guest-agent reboot logic, and enhance vsock availability checks in E2E tests.
1 parent 191f983 commit 520bb5f

File tree

3 files changed

+13
-241
lines changed

3 files changed

+13
-241
lines changed

PHASE1_IMPLEMENTATION.md

Lines changed: 0 additions & 237 deletions
This file was deleted.

guest-agent/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ fn handle_connection(fd: RawFd) -> Result<(), String> {
602602
// Shutdown
603603
eprintln!("Shutdown requested");
604604
unsafe {
605-
libc::reboot(libc::LINUX_REBOOT_CMD_POWER_OFF as i32);
605+
libc::reboot(libc::LINUX_REBOOT_CMD_POWER_OFF);
606606
}
607607
return Ok(());
608608
}
@@ -1223,8 +1223,7 @@ fn read_netdev() -> (u64, u64) {
12231223
};
12241224
for line in content.lines() {
12251225
let trimmed = line.trim();
1226-
if trimmed.starts_with("eth0:") {
1227-
let after_colon = &trimmed["eth0:".len()..];
1226+
if let Some(after_colon) = trimmed.strip_prefix("eth0:") {
12281227
let fields: Vec<&str> = after_colon.split_whitespace().collect();
12291228
let rx = fields
12301229
.first()

tests/e2e/telemetry.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ fn kvm_available() -> bool {
3838
}
3939

4040
fn vsock_available() -> bool {
41-
std::path::Path::new("/dev/vhost-vsock").exists()
41+
let path = std::path::Path::new("/dev/vhost-vsock");
42+
// Check existence and that we can actually open it (not just EACCES)
43+
match std::fs::File::open(path) {
44+
Ok(_) => true,
45+
Err(e) if e.kind() == std::io::ErrorKind::NotFound => false,
46+
Err(e) if e.raw_os_error() == Some(libc::EACCES) => {
47+
eprintln!("skipping: /dev/vhost-vsock exists but is not accessible: {e}");
48+
false
49+
}
50+
Err(_) => false,
51+
}
4252
}
4353

4454
fn kvm_artifacts_from_env() -> Option<(PathBuf, Option<PathBuf>)> {

0 commit comments

Comments
 (0)