Skip to content

Commit

Permalink
Merge pull request #59 from baude/thinout1
Browse files Browse the repository at this point in the history
Removing unneeded code
  • Loading branch information
openshift-ci[bot] authored Nov 2, 2023
2 parents 247732c + c9dc4a3 commit ec23538
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 325 deletions.
33 changes: 0 additions & 33 deletions cmd/dumpsummary/main.go

This file was deleted.

58 changes: 49 additions & 9 deletions cmd/dumpvms/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,63 @@ import (
"github.com/containers/libhvee/pkg/hypervctl"
)

func main() {
var err error
const (
summary = "summary"
vms = "vms"
)

func getVms() (string, error) {
vmms := hypervctl.VirtualMachineManager{}

vms, err := vmms.GetAll()
if err != nil {
fmt.Printf("Could not retrieve virtual machines : %s\n", err.Error())
os.Exit(1)
return "", fmt.Errorf("Could not retrieve virtual machines : %s\n", err.Error())
}

b, err := json.MarshalIndent(vms, "", "\t")
if err != nil {
return "", err
}
return string(b), nil
}

func dumpSummary() (string, error) {
vmms := hypervctl.VirtualMachineManager{}
summs, err := vmms.GetSummaryInformation(hypervctl.SummaryRequestNearAll)
if err != nil {
fmt.Println("Failed to generate output")
os.Exit(1)
return "", fmt.Errorf("Could not retrieve virtual machine summaries: %v\n", err)
}
b, err := json.MarshalIndent(summs, "", "\t")
if err != nil {
return "", err
}
return string(b), nil
}

func printHelp() {
fmt.Printf("argument must be one of %q or %q", summary, vms)
}

fmt.Println(string(b))
func main() {
var (
err error
result string
)
args := os.Args
if len(args) != 2 {
printHelp()
os.Exit(1)
}
if arg := args[1]; arg != summary && arg != vms {
printHelp()
os.Exit(1)
}
if args[1] == summary {
result, err = dumpSummary()
} else {
result, err = getVms()
}
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(result)
}
34 changes: 0 additions & 34 deletions cmd/dumpvs/main.go

This file was deleted.

79 changes: 0 additions & 79 deletions cmd/keycreate/main.go

This file was deleted.

52 changes: 0 additions & 52 deletions cmd/wmigen/main.go

This file was deleted.

118 changes: 0 additions & 118 deletions pkg/machine/machine.go

This file was deleted.

0 comments on commit ec23538

Please sign in to comment.