mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-22 13:38:26 +00:00
qmp: add migrate set arguments
It allows to set migration arguments so that callers can control how migration is done. Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
parent
a03d4968e1
commit
8aeca15388
@ -837,3 +837,12 @@ func (q *QMP) ExecSetMigrationCaps(ctx context.Context, caps []map[string]interf
|
||||
|
||||
return q.executeCommand(ctx, "migrate-set-capabilities", args, nil)
|
||||
}
|
||||
|
||||
// ExecSetMigrateArguments sets the command line used for migration
|
||||
func (q *QMP) ExecSetMigrateArguments(ctx context.Context, url string) error {
|
||||
args := map[string]interface{}{
|
||||
"uri": url,
|
||||
}
|
||||
|
||||
return q.executeCommand(ctx, "migrate", args, nil)
|
||||
}
|
||||
|
@ -910,3 +910,20 @@ func TestExecSetMigrationCaps(t *testing.T) {
|
||||
q.Shutdown()
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
||||
// Checks that migrate arguments can be set
|
||||
func TestExecSetMigrateArguments(t *testing.T) {
|
||||
connectedCh := make(chan *QMPVersion)
|
||||
disconnectedCh := make(chan struct{})
|
||||
buf := newQMPTestCommandBuffer(t)
|
||||
buf.AddCommand("migrate", nil, "return", nil)
|
||||
cfg := QMPConfig{Logger: qmpTestLogger{}}
|
||||
q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh)
|
||||
checkVersion(t, connectedCh)
|
||||
err := q.ExecSetMigrateArguments(context.Background(), "exec:foobar")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v\n", err)
|
||||
}
|
||||
q.Shutdown()
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user