diff --git a/cmd/virt-v2v-monitor/virt-v2v-monitor.go b/cmd/virt-v2v-monitor/virt-v2v-monitor.go index 28389569a..d16352aca 100644 --- a/cmd/virt-v2v-monitor/virt-v2v-monitor.go +++ b/cmd/virt-v2v-monitor/virt-v2v-monitor.go @@ -3,6 +3,7 @@ package main import ( "bufio" "flag" + "fmt" "net/http" "os" "regexp" @@ -15,7 +16,7 @@ import ( ) var COPY_DISK_RE = regexp.MustCompile(`^.*Copying disk (\d+)/(\d+)`) -var DISK_PROGRESS_RE = regexp.MustCompile(`^..\s*(\d+)% \[.*\]`) +var DISK_PROGRESS_RE = regexp.MustCompile(`\s+\((\d+).*|.+ (\d+)% \[[*-]+\]`) var FINISHED_RE = regexp.MustCompile(`^\[[ .0-9]*\] Finishing off`) // Here is a scan function that imposes limit on returned line length. virt-v2v @@ -64,6 +65,7 @@ func main() { // Start prometheus metrics HTTP handler klog.Info("Setting up prometheus endpoint :2112/metrics") + klog.Info("this is Bella test") http.Handle("/metrics", promhttp.Handler()) go http.ListenAndServe(":2112", nil) @@ -98,6 +100,8 @@ func main() { klog.Fatal("Output monitoring failed! ", err) } + fmt.Println("this is the line we scanning now ", string(line)) + if match := COPY_DISK_RE.FindSubmatch(line); match != nil { diskNumber, _ = strconv.ParseUint(string(match[1]), 10, 0) disks, _ = strconv.ParseUint(string(match[2]), 10, 0) @@ -105,6 +109,7 @@ func main() { progress = 0 err = updateProgress(progressCounter, diskNumber, progress) } else if match := DISK_PROGRESS_RE.FindSubmatch(line); match != nil { + klog.Info("we are here at progress ", line) progress, _ = strconv.ParseUint(string(match[1]), 10, 0) klog.Infof("Progress update, completed %d %%", progress) err = updateProgress(progressCounter, diskNumber, progress) @@ -116,7 +121,7 @@ func main() { err = updateProgress(progressCounter, disk, 100) } } else { - klog.V(1).Info("Ignoring line: ", string(line)) + klog.Infof("Ignoring line: ", string(line)) } if err != nil { // Don't make processing errors fatal. diff --git a/virt-v2v/cold/entrypoint.go b/virt-v2v/cold/entrypoint.go index 2198abff3..8dcd4da90 100644 --- a/virt-v2v/cold/entrypoint.go +++ b/virt-v2v/cold/entrypoint.go @@ -77,7 +77,7 @@ func main() { } func buildCommand() []string { - virtV2vArgs := []string{"virt-v2v", "-v", "-x"} + virtV2vArgs := []string{"virt-v2v"} source := os.Getenv("V2V_source") if !isValidSource(source) { @@ -199,7 +199,7 @@ func executeVirtV2v(source string, args []string) (err error) { fmt.Printf("Error setting up stdout pipe: %v\n", err) return } - teeOut := io.TeeReader(virtV2vStdoutPipe, os.Stdout) + //teeOut := io.TeeReader(virtV2vStdoutPipe, os.Stdout) var teeErr io.Reader if source == OVA { @@ -220,7 +220,7 @@ func executeVirtV2v(source string, args []string) (err error) { } virtV2vMonitorCmd := exec.Command("/usr/local/bin/virt-v2v-monitor") - virtV2vMonitorCmd.Stdin = teeOut + virtV2vMonitorCmd.Stdin = virtV2vStdoutPipe virtV2vMonitorCmd.Stdout = os.Stdout virtV2vMonitorCmd.Stderr = os.Stderr