Revision 9f0e6b37
b/daemons/ganeti-noded | ||
---|---|---|
362 | 362 |
|
363 | 363 |
""" |
364 | 364 |
instance, target, live = params |
365 |
instance = objects.Instance.FromDict(instance) |
|
365 | 366 |
return backend.MigrateInstance(instance, target, live) |
366 | 367 |
|
367 | 368 |
@staticmethod |
b/lib/backend.py | ||
---|---|---|
771 | 771 |
def MigrateInstance(instance, target, live): |
772 | 772 |
"""Migrates an instance to another node. |
773 | 773 |
|
774 |
@type instance: C{objects.Instance} |
|
775 |
@param instance: the instance definition |
|
776 |
@type target: string |
|
777 |
@param target: the target node name |
|
778 |
@type live: boolean |
|
779 |
@param live: whether the migration should be done live or not (the |
|
780 |
interpretation of this parameter is left to the hypervisor) |
|
781 |
@rtype: tuple |
|
782 |
@return: a tuple of (success, msg) where: |
|
783 |
- succes is a boolean denoting the success/failure of the operation |
|
784 |
- msg is a string with details in case of failure |
|
785 |
|
|
774 | 786 |
""" |
775 | 787 |
hyper = hypervisor.GetHypervisor(_GetConfig()) |
776 | 788 |
|
777 | 789 |
try: |
778 |
hyper.MigrateInstance(instance, target, live) |
|
790 |
hyper.MigrateInstance(instance.name, target, live)
|
|
779 | 791 |
except errors.HypervisorError, err: |
780 | 792 |
msg = "Failed to migrate instance: %s" % str(err) |
781 | 793 |
logging.error(msg) |
b/lib/rpc.py | ||
---|---|---|
209 | 209 |
|
210 | 210 |
This is a single-node call. |
211 | 211 |
|
212 |
""" |
|
213 |
c = Client("instance_migrate", [instance.name, target, live]) |
|
212 |
@type node: string |
|
213 |
@param node: the node on which the instance is currently running |
|
214 |
@type instance: instance object |
|
215 |
@param instance: the instance definition |
|
216 |
@type target: string |
|
217 |
@param target: the target node name |
|
218 |
@type live: boolean |
|
219 |
@param live: whether the migration should be done live or not (the |
|
220 |
interpretation of this parameter is left to the hypervisor) |
|
221 |
|
|
222 |
""" |
|
223 |
c = Client("instance_migrate", [instance.ToDict(), target, live]) |
|
214 | 224 |
c.connect(node) |
215 | 225 |
c.run() |
216 | 226 |
return c.getresult().get(node, False) |
Also available in: Unified diff