Revision bc0a2284

b/lib/backend.py
1789 1789
    _Fail("Failed to finalize migration on the target node: %s", err, exc=True)
1790 1790

  
1791 1791

  
1792
def MigrateInstance(instance, target, live):
1792
def MigrateInstance(cluster_name, instance, target, live):
1793 1793
  """Migrates an instance to another node.
1794 1794

  
1795
  @type cluster_name: string
1796
  @param cluster_name: name of the cluster
1795 1797
  @type instance: L{objects.Instance}
1796 1798
  @param instance: the instance definition
1797 1799
  @type target: string
......
1805 1807
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
1806 1808

  
1807 1809
  try:
1808
    hyper.MigrateInstance(instance, target, live)
1810
    hyper.MigrateInstance(cluster_name, instance, target, live)
1809 1811
  except errors.HypervisorError, err:
1810 1812
    _Fail("Failed to migrate instance: %s", err, exc=True)
1811 1813

  
b/lib/cmdlib/instance_migration.py
727 727
                               (instance.name, msg))
728 728

  
729 729
    self.feedback_fn("* migrating instance to %s" % target_node)
730
    result = self.rpc.call_instance_migrate(source_node, instance,
731
                                            self.nodes_ip[target_node],
732
                                            self.live)
730
    cluster = self.cfg.GetClusterInfo()
731
    result = self.rpc.call_instance_migrate(
732
        source_node, cluster.cluster_name, instance, self.nodes_ip[target_node],
733
        self.live)
733 734
    msg = result.fail_msg
734 735
    if msg:
735 736
      logging.error("Instance migration failed, trying to revert"
b/lib/hypervisor/hv_base.py
336 336
    """
337 337
    pass
338 338

  
339
  def MigrateInstance(self, instance, target, live):
339
  def MigrateInstance(self, cluster_name, instance, target, live):
340 340
    """Migrate an instance.
341 341

  
342
    @type cluster_name: string
343
    @param cluster_name: name of the cluster
342 344
    @type instance: L{objects.Instance}
343 345
    @param instance: the instance to be migrated
344 346
    @type target: string
b/lib/hypervisor/hv_chroot.py
310 310
    """
311 311
    cls.LinuxPowercycle()
312 312

  
313
  def MigrateInstance(self, instance, target, live):
313
  def MigrateInstance(self, cluster_name, instance, target, live):
314 314
    """Migrate an instance.
315 315

  
316
    @type cluster_name: string
317
    @param cluster_name: name of the cluster
316 318
    @type instance: L{objects.Instance}
317 319
    @param instance: the instance to be migrated
318 320
    @type target: string
b/lib/hypervisor/hv_fake.py
283 283
    if self._IsAlive(instance.name):
284 284
      raise errors.HypervisorError("Can't accept instance, already running")
285 285

  
286
  def MigrateInstance(self, instance, target, live):
286
  def MigrateInstance(self, cluster_name, instance, target, live):
287 287
    """Migrate an instance.
288 288

  
289
    @type cluster_name: string
290
    @param cluster_name: name of the cluster
289 291
    @type instance: L{objects.Instance}
290 292
    @param instance: the instance to be migrated
291 293
    @type target: string
b/lib/hypervisor/hv_kvm.py
1894 1894
    else:
1895 1895
      self.StopInstance(instance, force=True)
1896 1896

  
1897
  def MigrateInstance(self, instance, target, live):
1897
  def MigrateInstance(self, cluster_name, instance, target, live):
1898 1898
    """Migrate an instance to a target node.
1899 1899

  
1900 1900
    The migration will not be attempted if the instance is not
1901 1901
    currently running.
1902 1902

  
1903
    @type cluster_name: string
1904
    @param cluster_name: name of the cluster
1903 1905
    @type instance: L{objects.Instance}
1904 1906
    @param instance: the instance to be migrated
1905 1907
    @type target: string
b/lib/hypervisor/hv_lxc.py
458 458
    """
459 459
    cls.LinuxPowercycle()
460 460

  
461
  def MigrateInstance(self, instance, target, live):
461
  def MigrateInstance(self, cluster_name, instance, target, live):
462 462
    """Migrate an instance.
463 463

  
464
    @type cluster_name: string
465
    @param cluster_name: name of the cluster
464 466
    @type instance: L{objects.Instance}
465 467
    @param instance: the instance to be migrated
466 468
    @type target: string
b/lib/hypervisor/hv_xen.py
34 34
from ganeti import netutils
35 35
from ganeti import objects
36 36
from ganeti import pathutils
37
from ganeti import ssconf
38 37

  
39 38

  
40 39
XEND_CONFIG_FILE = utils.PathJoin(pathutils.XEN_CONFIG_DIR, "xend-config.sxp")
......
711 710
    if success:
712 711
      self._WriteConfigFile(instance.name, info)
713 712

  
714
  def MigrateInstance(self, instance, target, live):
713
  def MigrateInstance(self, cluster_name, instance, target, live):
715 714
    """Migrate an instance to a target node.
716 715

  
717 716
    The migration will not be attempted if the instance is not
......
727 726
    """
728 727
    port = instance.hvparams[constants.HV_MIGRATION_PORT]
729 728

  
730
    # TODO: Pass cluster name via RPC
731
    cluster_name = ssconf.SimpleStore().GetClusterName()
732

  
733 729
    return self._MigrateInstance(cluster_name, instance.name, target, port,
734 730
                                 live, instance.hvparams)
735 731

  
b/lib/rpc_defs.py
267 267
    ("success", None, "Whether the migration was a success or failure"),
268 268
    ], None, None, "Finalize any target-node migration specific operation"),
269 269
  ("instance_migrate", SINGLE, None, constants.RPC_TMO_SLOW, [
270
    ("cluster_name", None, "Cluster name"),
270 271
    ("instance", ED_INST_DICT, "Instance object"),
271 272
    ("target", None, "Target node name"),
272 273
    ("live", None, "Whether the migration should be done live or not"),
b/lib/server/noded.py
634 634
    """Migrates an instance.
635 635

  
636 636
    """
637
    instance, target, live = params
637
    cluster_name, instance, target, live = params
638 638
    instance = objects.Instance.FromDict(instance)
639
    return backend.MigrateInstance(instance, target, live)
639
    return backend.MigrateInstance(cluster_name, instance, target, live)
640 640

  
641 641
  @staticmethod
642 642
  def perspective_instance_finalize_migration_src(params):

Also available in: Unified diff