Skip to content

Commit

Permalink
Return early in VMConfig Validate() skipping networking checks if the…
Browse files Browse the repository at this point in the history
… VM is already up, as those checks will fail when trying to check if it has write privs to the tap devices
  • Loading branch information
bensallen committed Aug 12, 2019
1 parent e9b3448 commit 007e751
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions internal/config/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,17 @@ func (v *VMConfig) Validate() error {
return errors.New("RunDir not specified")
}

// Return here if the VM is already running, as the remaining checks will fail with a running VM.
if v.Status() == Running {
return nil
}

for _, net := range v.Network {
if err := net.validate(); err != nil {
return err
}
}

// for i, hdd := range v.HDD {
// args = append(args, "-s", fmt.Sprintf("3:%d,%s,file://%s,format=%s", i, hdd.Driver, hdd.Path, hdd.Format))
// }
//
// for i, cd := range v.CDROM {
// args = append(args, "-s", fmt.Sprintf("4:%d,%s,%s", i, cd.Driver, cd.Path))
// }
return nil
}

Expand Down

0 comments on commit 007e751

Please sign in to comment.