Skip to content

Commit

Permalink
Move lm operations to separate command
Browse files Browse the repository at this point in the history
  • Loading branch information
kevpar committed Nov 21, 2024
1 parent ed9e75d commit 8e70c9b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
File renamed without changes.
47 changes: 47 additions & 0 deletions cmd/lm/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//go:build windows

package main

import (
"context"
"fmt"
"os"

"github.com/Microsoft/hcsshim/internal/shimdiag"
"github.com/urfave/cli"
)

func main() {
app := cli.NewApp()
app.Name = "lm"
app.Usage = "Interact with runhcs shim live migration interface"
app.Commands = []cli.Command{
lmPrepareCommand,
lmListenCommand,
lmAcceptCommand,
lmDialCommand,
lmTransferCommand,
lmFinalizeCommand,
json2pbCommand,
pb2jsonCommand,
}
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}

func getPid(shimName string) (int32, error) {
shim, err := shimdiag.GetShim(shimName)
if err != nil {
return 0, err
}
defer shim.Close()

svc := shimdiag.NewShimDiagClient(shim)
resp, err := svc.DiagPid(context.Background(), &shimdiag.PidRequest{})
if err != nil {
return 0, err
}
return resp.Pid, nil
}
8 changes: 0 additions & 8 deletions cmd/shimdiag/shimdiag.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ func main() {
stacksCommand,
tasksCommand,
shareCommand,
lmPrepareCommand,
lmListenCommand,
lmAcceptCommand,
lmDialCommand,
lmTransferCommand,
lmFinalizeCommand,
json2pbCommand,
pb2jsonCommand,
}
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
Expand Down

0 comments on commit 8e70c9b

Please sign in to comment.