Skip to content

Commit

Permalink
OVA: remove synchronization for firmware detection scanner
Browse files Browse the repository at this point in the history
Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy committed May 21, 2024
1 parent b7c2898 commit 151a1b8
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions virt-v2v/cold/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,16 @@ func executeVirtV2v(source string, args []string) error {
v2vCmd.Stderr = writer
defer writer.Close()

done := make(chan error, 1)
if source == OVA {
monitorStdoutPipe, err := monitorCmd.StdoutPipe()
if err != nil {
fmt.Printf("Error setting up stdout pipe: %v\n", err)
return err
}
monitorOut := io.TeeReader(monitorStdoutPipe, os.Stdout)
go parseFirmware(monitorOut, done)
go parseFirmware(monitorOut)
} else {
monitorCmd.Stdout = os.Stdout
done <- nil
}

if err := monitorCmd.Start(); err != nil {
Expand All @@ -236,15 +234,10 @@ func executeVirtV2v(source string, args []string) error {
return err
}

if err := <-done; err != nil {
fmt.Printf("Error getting output from monitor command: %v\n", err)
return err
}

return nil
}

func parseFirmware(reader io.Reader, done chan error) {
func parseFirmware(reader io.Reader) {
scanner := bufio.NewScanner(reader)
const maxCapacity = 1024 * 1024
buf := make([]byte, 0, 64*1024)
Expand All @@ -257,8 +250,6 @@ func parseFirmware(reader io.Reader, done chan error) {
firmware = "efi"
}
}

done <- scanner.Err()
}

func getXMLFile(dir, fileExtension string) (string, error) {
Expand Down

0 comments on commit 151a1b8

Please sign in to comment.