Revision e14ddb6e

b/lib/cmdlib.py
7451 7451
    self.needed_locks[locking.LEVEL_NODE] = []
7452 7452
    self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE
7453 7453

  
7454
    self._migrater = TLMigrateInstance(self, self.op.instance_name,
7455
                                       cleanup=self.op.cleanup,
7456
                                       failover=False,
7457
                                       fallback=self.op.allow_failover,
7458
                                       ignore_ipolicy=self.op.ignore_ipolicy)
7454
    self._migrater = \
7455
      TLMigrateInstance(self, self.op.instance_name,
7456
                        cleanup=self.op.cleanup,
7457
                        failover=False,
7458
                        fallback=self.op.allow_failover,
7459
                        allow_runtime_changes=self.op.allow_runtime_changes,
7460
                        ignore_ipolicy=self.op.ignore_ipolicy)
7459 7461
    self.tasklets = [self._migrater]
7460 7462

  
7461 7463
  def DeclareLocks(self, level):
......
7490 7492
      "MIGRATE_CLEANUP": self.op.cleanup,
7491 7493
      "OLD_PRIMARY": source_node,
7492 7494
      "NEW_PRIMARY": target_node,
7495
      "ALLOW_RUNTIME_CHANGES": self.op.allow_runtime_changes,
7493 7496
      })
7494 7497

  
7495 7498
    if instance.disk_template in constants.DTS_INT_MIRROR:
......
7733 7736
    """
7734 7737
    return {
7735 7738
      "NODE_NAME": self.op.node_name,
7739
      "ALLOW_RUNTIME_CHANGES": self.op.allow_runtime_changes,
7736 7740
      }
7737 7741

  
7738 7742
  def BuildHooksNodes(self):
......
7747 7751

  
7748 7752
  def Exec(self, feedback_fn):
7749 7753
    # Prepare jobs for migration instances
7754
    allow_runtime_changes = self.op.allow_runtime_changes
7750 7755
    jobs = [
7751 7756
      [opcodes.OpInstanceMigrate(instance_name=inst.name,
7752 7757
                                 mode=self.op.mode,
7753 7758
                                 live=self.op.live,
7754 7759
                                 iallocator=self.op.iallocator,
7755 7760
                                 target_node=self.op.target_node,
7761
                                 allow_runtime_changes=allow_runtime_changes,
7756 7762
                                 ignore_ipolicy=self.op.ignore_ipolicy)]
7757 7763
      for inst in _GetNodePrimaryInstances(self.cfg, self.op.node_name)
7758 7764
      ]
......
7802 7808
  def __init__(self, lu, instance_name, cleanup=False,
7803 7809
               failover=False, fallback=False,
7804 7810
               ignore_consistency=False,
7811
               allow_runtime_changes=True,
7805 7812
               shutdown_timeout=constants.DEFAULT_SHUTDOWN_TIMEOUT,
7806 7813
               ignore_ipolicy=False):
7807 7814
    """Initializes this class.
......
7818 7825
    self.ignore_consistency = ignore_consistency
7819 7826
    self.shutdown_timeout = shutdown_timeout
7820 7827
    self.ignore_ipolicy = ignore_ipolicy
7828
    self.allow_runtime_changes = allow_runtime_changes
7821 7829

  
7822 7830
  def CheckPrereq(self):
7823 7831
    """Check prerequisites.
......
8226 8234
                                 " aborting migration" % dev.iv_name)
8227 8235

  
8228 8236
    if self.current_mem > self.tgt_free_mem:
8237
      if not self.allow_runtime_changes:
8238
        raise errors.OpExecError("Memory ballooning not allowed and not enough"
8239
                                 " free memory to fit instance %s on target"
8240
                                 " node %s (have %dMB, need %dMB)" %
8241
                                 (instance.name, target_node,
8242
                                  self.tgt_free_mem, self.current_mem))
8229 8243
      self.feedback_fn("* setting instance memory to %s" % self.tgt_free_mem)
8230 8244
      rpcres = self.rpc.call_instance_balloon_memory(instance.primary_node,
8231 8245
                                                     instance,

Also available in: Unified diff