Revision da4a52a3 lib/cmdlib/instance_migration.py
b/lib/cmdlib/instance_migration.py | ||
---|---|---|
30 | 30 |
from ganeti.masterd import iallocator |
31 | 31 |
from ganeti import utils |
32 | 32 |
from ganeti.cmdlib.base import LogicalUnit, Tasklet |
33 |
from ganeti.cmdlib.common import ExpandInstanceName, \ |
|
33 |
from ganeti.cmdlib.common import ExpandInstanceUuidAndName, \
|
|
34 | 34 |
CheckIAllocatorOrNode, ExpandNodeUuidAndName |
35 | 35 |
from ganeti.cmdlib.instance_storage import CheckDiskConsistency, \ |
36 | 36 |
ExpandCheckDisks, ShutdownInstanceDisks, AssembleInstanceDisks |
... | ... | |
72 | 72 |
if level == locking.LEVEL_NODE_ALLOC: |
73 | 73 |
assert lu.op.instance_name in lu.owned_locks(locking.LEVEL_INSTANCE) |
74 | 74 |
|
75 |
instance = lu.cfg.GetInstanceInfo(lu.op.instance_name)
|
|
75 |
instance = lu.cfg.GetInstanceInfo(lu.op.instance_uuid)
|
|
76 | 76 |
|
77 | 77 |
# Node locks are already declared here rather than at LEVEL_NODE as we need |
78 | 78 |
# the instance object anyway to declare the node allocation lock. |
... | ... | |
118 | 118 |
_ExpandNamesForMigration(self) |
119 | 119 |
|
120 | 120 |
self._migrater = \ |
121 |
TLMigrateInstance(self, self.op.instance_name, False, True, False,
|
|
122 |
self.op.ignore_consistency, True, |
|
121 |
TLMigrateInstance(self, self.op.instance_uuid, self.op.instance_name,
|
|
122 |
False, True, False, self.op.ignore_consistency, True,
|
|
123 | 123 |
self.op.shutdown_timeout, self.op.ignore_ipolicy) |
124 | 124 |
|
125 | 125 |
self.tasklets = [self._migrater] |
... | ... | |
177 | 177 |
_ExpandNamesForMigration(self) |
178 | 178 |
|
179 | 179 |
self._migrater = \ |
180 |
TLMigrateInstance(self, self.op.instance_name, self.op.cleanup,
|
|
181 |
False, self.op.allow_failover, False, |
|
180 |
TLMigrateInstance(self, self.op.instance_uuid, self.op.instance_name,
|
|
181 |
self.op.cleanup, False, self.op.allow_failover, False,
|
|
182 | 182 |
self.op.allow_runtime_changes, |
183 | 183 |
constants.DEFAULT_SHUTDOWN_TIMEOUT, |
184 | 184 |
self.op.ignore_ipolicy) |
... | ... | |
255 | 255 |
_MIGRATION_POLL_INTERVAL = 1 # seconds |
256 | 256 |
_MIGRATION_FEEDBACK_INTERVAL = 10 # seconds |
257 | 257 |
|
258 |
def __init__(self, lu, instance_name, cleanup, failover, fallback,
|
|
259 |
ignore_consistency, allow_runtime_changes, shutdown_timeout,
|
|
260 |
ignore_ipolicy): |
|
258 |
def __init__(self, lu, instance_uuid, instance_name, cleanup, failover,
|
|
259 |
fallback, ignore_consistency, allow_runtime_changes,
|
|
260 |
shutdown_timeout, ignore_ipolicy):
|
|
261 | 261 |
"""Initializes this class. |
262 | 262 |
|
263 | 263 |
""" |
264 | 264 |
Tasklet.__init__(self, lu) |
265 | 265 |
|
266 | 266 |
# Parameters |
267 |
self.instance_uuid = instance_uuid |
|
267 | 268 |
self.instance_name = instance_name |
268 | 269 |
self.cleanup = cleanup |
269 | 270 |
self.live = False # will be overridden later |
... | ... | |
280 | 281 |
This checks that the instance is in the cluster. |
281 | 282 |
|
282 | 283 |
""" |
283 |
instance_name = ExpandInstanceName(self.lu.cfg, self.instance_name) |
|
284 |
self.instance = self.cfg.GetInstanceInfo(instance_name) |
|
284 |
(self.instance_uuid, self.instance_name) = \ |
|
285 |
ExpandInstanceUuidAndName(self.lu.cfg, self.instance_uuid, |
|
286 |
self.instance_name) |
|
287 |
self.instance = self.cfg.GetInstanceInfo(self.instance_uuid) |
|
285 | 288 |
assert self.instance is not None |
286 | 289 |
cluster = self.cfg.GetClusterInfo() |
287 | 290 |
|
... | ... | |
448 | 451 |
|
449 | 452 |
# FIXME: add a self.ignore_ipolicy option |
450 | 453 |
req = iallocator.IAReqRelocate( |
451 |
name=self.instance_name,
|
|
454 |
inst_uuid=self.instance_uuid,
|
|
452 | 455 |
relocate_from_node_uuids=[self.instance.primary_node]) |
453 | 456 |
ial = iallocator.IAllocator(self.cfg, self.rpc, req) |
454 | 457 |
|
Also available in: Unified diff