v1.14.6
This commit is contained in:
@@ -26,17 +26,17 @@ func NewMigrator(cfg *Config, c decortsdk.ClientInterface) Migrator {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, stackID uint64) (bool, error) {
|
||||
func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, nodeID uint64) (bool, error) {
|
||||
req := compute.MigrateRequest{
|
||||
ComputeID: dxVMID,
|
||||
TargetStackID: stackID,
|
||||
Force: false,
|
||||
ComputeID: dxVMID,
|
||||
TargetNodeID: nodeID,
|
||||
Force: false,
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout)
|
||||
ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req)
|
||||
cancel()
|
||||
if err != nil {
|
||||
return false, errors.Join(err, fmt.Errorf("Migrate VM %d to Node %d", dxVMID, stackID))
|
||||
return false, errors.Join(err, fmt.Errorf("Migrate VM %d to Node %d", dxVMID, nodeID))
|
||||
}
|
||||
return ok, nil
|
||||
}
|
||||
|
||||
@@ -60,17 +60,17 @@ func TestMigrator(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
dxVMID := uint64(100500)
|
||||
stackID := uint64(100501)
|
||||
nodeID := uint64(100501)
|
||||
|
||||
// Записываем поведение клиента
|
||||
mockCaller.EXPECT().DecortApiCall(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Eq(compute.AsyncWrapperMigrateRequest{
|
||||
MigrateRequest: compute.MigrateRequest{
|
||||
ComputeID: dxVMID,
|
||||
TargetStackID: stackID,
|
||||
ComputeID: dxVMID,
|
||||
TargetNodeID: nodeID,
|
||||
},
|
||||
SyncMode: true})).Return(b, nil).AnyTimes()
|
||||
|
||||
ok, err := migrator.Migrate(context.Background(), dxVMID, stackID)
|
||||
ok, err := migrator.Migrate(context.Background(), dxVMID, nodeID)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, ok)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user