Skip to content

infra: Reuse libvirt-based console grabber#525

Draft
frhuelsz wants to merge 3 commits intomainfrom
user/frhuelsz/e2e-test-console
Draft

infra: Reuse libvirt-based console grabber#525
frhuelsz wants to merge 3 commits intomainfrom
user/frhuelsz/e2e-test-console

Conversation

@frhuelsz
Copy link
Contributor

🔍 Description

Reuse the libvirt-connection-based vm console grabber.

@frhuelsz
Copy link
Contributor Author

/AzurePipelines run [GITHUB]-trident-pr

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@frhuelsz frhuelsz changed the title test: Reuse libvirt-based console grabber infra: Reuse libvirt-based console grabber Feb 20, 2026
@frhuelsz
Copy link
Contributor Author

/AzurePipelines run [GITHUB]-trident-pr-e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@frhuelsz
Copy link
Contributor Author

/AzurePipelines run [GITHUB]-trident-pr-e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@frhuelsz frhuelsz marked this pull request as ready for review February 20, 2026 01:31
@frhuelsz frhuelsz requested a review from a team as a code owner February 20, 2026 01:31
Copilot AI review requested due to automatic review settings February 20, 2026 01:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the libvirt-based VM console monitoring code by extracting it into a reusable utilities package. The change eliminates code duplication and improves maintainability by consolidating the console grabbing logic that was previously embedded in tools/storm/e2e/scenario/monitoring.go.

Changes:

  • Extracted libvirt console monitoring utilities into tools/storm/utils/libvirtutils package
  • Created reusable Connect() function for establishing libvirt connections
  • Created reusable WaitForVmSerialLogLoginLibvirt() function for monitoring VM console output
  • Updated direct_streaming.go to use the new libvirt console utilities instead of file-based serial log monitoring
  • Updated monitoring.go to use the centralized console monitoring function

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tools/storm/utils/libvirtutils/open.go New file providing Connect() function to establish libvirt connections to qemu:///system
tools/storm/utils/libvirtutils/console.go New file containing WaitForVmSerialLogLoginLibvirt() and readerLoop() functions extracted from monitoring.go for console monitoring with login detection
tools/storm/helpers/direct_streaming.go Updated to use new libvirt console utilities instead of file-based WaitForLoginMessageInSerialLog; creates temp file for console output
tools/storm/e2e/scenario/monitoring.go Removed duplicated waitForVmSerialLogLoginLibvirt() and readerLoop() functions, now calls libvirtutils.WaitForVmSerialLogLoginLibvirt()

return fmt.Errorf("failed to remove existing VM serial log file: %w", removeErr)
}
}
defer tc.ArtifactBroker().PublishLogFile("vm-serial.log", vmSerialLog)
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are conflicting deferred calls to publish "vm-serial.log": this line publishes vmSerialLog (the VM's serial log file path from libvirt domain XML), while lines 122-124 publish logFile.Name() (a newly created temp file). Since the new libvirt console approach writes to a new temp file instead of using the existing VM serial log file, this defer statement should be removed. The VM serial log file at vmSerialLog path is no longer being used or written to in the new implementation.

Suggested change
defer tc.ArtifactBroker().PublishLogFile("vm-serial.log", vmSerialLog)

Copilot uses AI. Check for mistakes.
Comment on lines 67 to 79
// Get the VM serial log file path
vmSerialLog, err := h.findVmSerialLogFile()
if err != nil {
tc.FailFromError(err)
return err
}
// For local runs, if serial log already exists, delete it.
if _, err := os.Stat(vmSerialLog); err == nil {
logrus.Infof("VM serial log file (%s) already exists, delete it.", vmSerialLog)
if removeErr := os.Remove(vmSerialLog); removeErr != nil {
return fmt.Errorf("failed to remove existing VM serial log file: %w", removeErr)
}
}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vmSerialLog file path detection, deletion logic (lines 68-79), and the findVmSerialLogFile() function are no longer needed since the new libvirt console approach creates its own temp file for logging (line 117). This code should be removed as it serves no purpose in the new implementation and may cause confusion.

Copilot uses AI. Check for mistakes.
@frhuelsz
Copy link
Contributor Author

/AzurePipelines run [GITHUB]-trident-pr-e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@frhuelsz frhuelsz marked this pull request as draft February 20, 2026 21:11
@frhuelsz frhuelsz marked this pull request as ready for review February 20, 2026 21:12
@frhuelsz frhuelsz marked this pull request as draft February 25, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants