Revision 6a1434d7 lib/backend.py

b/lib/backend.py
1280 1280
    _Fail("Failed to accept instance: %s", err, exc=True)
1281 1281

  
1282 1282

  
1283
def FinalizeMigration(instance, info, success):
1283
def FinalizeMigrationDst(instance, info, success):
1284 1284
  """Finalize any preparation to accept an instance.
1285 1285

  
1286 1286
  @type instance: L{objects.Instance}
......
1293 1293
  """
1294 1294
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
1295 1295
  try:
1296
    hyper.FinalizeMigration(instance, info, success)
1296
    hyper.FinalizeMigrationDst(instance, info, success)
1297 1297
  except errors.HypervisorError, err:
1298
    _Fail("Failed to finalize migration: %s", err, exc=True)
1298
    _Fail("Failed to finalize migration on the target node: %s", err, exc=True)
1299 1299

  
1300 1300

  
1301 1301
def MigrateInstance(instance, target, live):
......
1319 1319
    _Fail("Failed to migrate instance: %s", err, exc=True)
1320 1320

  
1321 1321

  
1322
def FinalizeMigrationSource(instance, success, live):
1323
  """Finalize the instance migration on the source node.
1324

  
1325
  @type instance: L{objects.Instance}
1326
  @param instance: the instance definition of the migrated instance
1327
  @type success: bool
1328
  @param success: whether the migration succeeded or not
1329
  @type live: bool
1330
  @param live: whether the user requested a live migration or not
1331
  @raise RPCFail: If the execution fails for some reason
1332

  
1333
  """
1334
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
1335

  
1336
  try:
1337
    hyper.FinalizeMigrationSource(instance, success, live)
1338
  except Exception, err:  # pylint: disable=W0703
1339
    _Fail("Failed to finalize the migration on the source node: %s", err,
1340
          exc=True)
1341

  
1342

  
1343
def GetMigrationStatus(instance):
1344
  """Get the migration status
1345

  
1346
  @type instance: L{objects.Instance}
1347
  @param instance: the instance that is being migrated
1348
  @rtype: L{objects.MigrationStatus}
1349
  @return: the status of the current migration (one of
1350
           L{constants.HV_MIGRATION_VALID_STATUSES}), plus any additional
1351
           progress info that can be retrieved from the hypervisor
1352
  @raise RPCFail: If the migration status cannot be retrieved
1353

  
1354
  """
1355
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
1356
  try:
1357
    return hyper.GetMigrationStatus(instance)
1358
  except Exception, err:  # pylint: disable=W0703
1359
    _Fail("Failed to get migration status: %s", err, exc=True)
1360

  
1361

  
1322 1362
def BlockdevCreate(disk, size, owner, on_primary, info):
1323 1363
  """Creates a block device for an instance.
1324 1364

  

Also available in: Unified diff