Revision 3361ab37

b/lib/backend.py
1199 1199

  
1200 1200

  
1201 1201
def GetInstanceMigratable(instance):
1202
  """Gives whether an instance can be migrated.
1202
  """Computes whether an instance can be migrated.
1203 1203

  
1204 1204
  @type instance: L{objects.Instance}
1205 1205
  @param instance: object representing the instance to be checked.
......
1212 1212
  """
1213 1213
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
1214 1214
  iname = instance.name
1215
  if iname not in hyper.ListInstances():
1215
  if iname not in hyper.ListInstances(instance.hvparams):
1216 1216
    _Fail("Instance %s is not running", iname)
1217 1217

  
1218 1218
  for idx in range(len(instance.disks)):
......
1455 1455
  @rtype: None
1456 1456

  
1457 1457
  """
1458
  running_instances = GetInstanceList([instance.hypervisor])
1458
  running_instances = GetInstanceListForHypervisor(instance.hypervisor,
1459
                                                   instance.hvparams)
1459 1460

  
1460 1461
  if instance.name in running_instances:
1461 1462
    logging.info("Instance %s already running, not starting", instance.name)
......
1494 1495
  hyper = hypervisor.GetHypervisor(hv_name)
1495 1496
  iname = instance.name
1496 1497

  
1497
  if instance.name not in hyper.ListInstances():
1498
  if instance.name not in hyper.ListInstances(instance.hvparams):
1498 1499
    logging.info("Instance %s not running, doing nothing", iname)
1499 1500
    return
1500 1501

  
......
1503 1504
      self.tried_once = False
1504 1505

  
1505 1506
    def __call__(self):
1506
      if iname not in hyper.ListInstances():
1507
      if iname not in hyper.ListInstances(instance.hvparams):
1507 1508
        return
1508 1509

  
1509 1510
      try:
......
1511 1512
        if store_reason:
1512 1513
          _StoreInstReasonTrail(instance.name, reason)
1513 1514
      except errors.HypervisorError, err:
1514
        if iname not in hyper.ListInstances():
1515
        if iname not in hyper.ListInstances(instance.hvparams):
1515 1516
          # if the instance is no longer existing, consider this a
1516 1517
          # success and go to cleanup
1517 1518
          return
......
1531 1532
    try:
1532 1533
      hyper.StopInstance(instance, force=True)
1533 1534
    except errors.HypervisorError, err:
1534
      if iname in hyper.ListInstances():
1535
      if iname in hyper.ListInstances(instance.hvparams):
1535 1536
        # only raise an error if the instance still exists, otherwise
1536 1537
        # the error could simply be "instance ... unknown"!
1537 1538
        _Fail("Failed to force stop instance %s: %s", iname, err)
1538 1539

  
1539 1540
    time.sleep(1)
1540 1541

  
1541
    if iname in hyper.ListInstances():
1542
    if iname in hyper.ListInstances(instance.hvparams):
1542 1543
      _Fail("Could not shutdown instance %s even by destroy", iname)
1543 1544

  
1544 1545
  try:
......
1572 1573
  @rtype: None
1573 1574

  
1574 1575
  """
1575
  running_instances = GetInstanceList([instance.hypervisor])
1576
  running_instances = GetInstanceListForHypervisor(instance.hypervisor,
1577
                                                   instance.hvparams)
1576 1578

  
1577 1579
  if instance.name not in running_instances:
1578 1580
    _Fail("Cannot reboot instance %s that is not running", instance.name)
......
1606 1608

  
1607 1609
  """
1608 1610
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
1609
  running = hyper.ListInstances()
1611
  running = hyper.ListInstances(instance.hvparams)
1610 1612
  if instance.name not in running:
1611 1613
    logging.info("Instance %s is not running, cannot balloon", instance.name)
1612 1614
    return
b/lib/constants.py
2124 2124
  HV_MIGRATION_PORT,
2125 2125
  HV_MIGRATION_BANDWIDTH,
2126 2126
  HV_MIGRATION_MODE,
2127
  HV_XEN_CMD,
2127 2128
  ])
2128 2129

  
2129 2130
BEC_DEFAULTS = {

Also available in: Unified diff