Revision e57602c2 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
7908 | 7908 |
# check memory requirements on the secondary node |
7909 | 7909 |
if (not self.cleanup and |
7910 | 7910 |
(not self.failover or instance.admin_state == constants.ADMINST_UP)): |
7911 |
_CheckNodeFreeMemory(self.lu, target_node, "migrating instance %s" % |
|
7912 |
instance.name, i_be[constants.BE_MAXMEM], |
|
7913 |
instance.hypervisor) |
|
7911 |
self.tgt_free_mem = _CheckNodeFreeMemory(self.lu, target_node, |
|
7912 |
"migrating instance %s" % |
|
7913 |
instance.name, |
|
7914 |
i_be[constants.BE_MINMEM], |
|
7915 |
instance.hypervisor) |
|
7914 | 7916 |
else: |
7915 | 7917 |
self.lu.LogInfo("Not checking memory on the secondary node as" |
7916 | 7918 |
" instance will not be started") |
... | ... | |
7968 | 7970 |
# Failover is never live |
7969 | 7971 |
self.live = False |
7970 | 7972 |
|
7973 |
if not (self.failover or self.cleanup): |
|
7974 |
remote_info = self.rpc.call_instance_info(instance.primary_node, |
|
7975 |
instance.name, |
|
7976 |
instance.hypervisor) |
|
7977 |
remote_info.Raise("Error checking instance on node %s" % |
|
7978 |
instance.primary_node) |
|
7979 |
instance_running = bool(remote_info.payload) |
|
7980 |
if instance_running: |
|
7981 |
self.current_mem = int(remote_info.payload["memory"]) |
|
7982 |
|
|
7971 | 7983 |
def _RunAllocator(self): |
7972 | 7984 |
"""Run the allocator based on input opcode. |
7973 | 7985 |
|
... | ... | |
8213 | 8225 |
" synchronized on target node," |
8214 | 8226 |
" aborting migration" % dev.iv_name) |
8215 | 8227 |
|
8228 |
if self.current_mem > self.tgt_free_mem: |
|
8229 |
self.feedback_fn("* setting instance memory to %s" % self.tgt_free_mem) |
|
8230 |
rpcres = self.rpc.call_instance_balloon_memory(instance.primary_node, |
|
8231 |
instance, |
|
8232 |
self.tgt_free_mem) |
|
8233 |
rpcres.Raise("Cannot modify instance runtime memory") |
|
8234 |
|
|
8216 | 8235 |
# First get the migration information from the remote node |
8217 | 8236 |
result = self.rpc.call_migration_info(source_node, instance) |
8218 | 8237 |
msg = result.fail_msg |
Also available in: Unified diff