MCPcopy Index your code
hub / github.com/apache/cloudstack-go / MigrateSystemVm

Method MigrateSystemVm

cloudstack/SystemVMService.go:1259–1291  ·  view source on GitHub ↗

Attempts Migration of a system virtual machine to the host specified.

(p *MigrateSystemVmParams)

Source from the content-addressed store, hash-verified

1257
1258// Attempts Migration of a system virtual machine to the host specified.
1259func (s *SystemVMService) MigrateSystemVm(p *MigrateSystemVmParams) (*MigrateSystemVmResponse, error) {
1260 resp, err := s.cs.newPostRequest("migrateSystemVm", p.toURLValues())
1261 if err != nil {
1262 return nil, err
1263 }
1264
1265 var r MigrateSystemVmResponse
1266 if err := json.Unmarshal(resp, &r); err != nil {
1267 return nil, err
1268 }
1269
1270 // If we have a async client, we need to wait for the async result
1271 if s.cs.async {
1272 b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
1273 if err != nil {
1274 if err == AsyncTimeoutErr {
1275 return &r, err
1276 }
1277 return nil, err
1278 }
1279
1280 b, err = getRawValue(b)
1281 if err != nil {
1282 return nil, err
1283 }
1284
1285 if err := json.Unmarshal(b, &r); err != nil {
1286 return nil, err
1287 }
1288 }
1289
1290 return &r, nil
1291}
1292
1293type MigrateSystemVmResponse struct {
1294 Activeviewersessions int `json:"activeviewersessions"`

Callers

nothing calls this directly

Calls 4

newPostRequestMethod · 0.80
GetAsyncJobResultMethod · 0.80
getRawValueFunction · 0.70
toURLValuesMethod · 0.45

Tested by

no test coverage detected