Adding live migration server actions
Change-Id: I5e1f5dddaf45d1c6eae8666647425bff748b639e
This commit is contained in:
@@ -419,3 +419,15 @@ def redirect_handler(f):
|
||||
raise e.results
|
||||
return e.results
|
||||
return new_f
|
||||
|
||||
|
||||
def live_migration(context, block_migration, disk_over_commit,
|
||||
instance_id, dest, topic):
|
||||
"""Migrate a server to a new host"""
|
||||
params = {"instance_id": instance_id,
|
||||
"dest": dest,
|
||||
"topic": topic,
|
||||
"block_migration": block_migration,
|
||||
"disk_over_commit": disk_over_commit}
|
||||
return _call_scheduler("live_migration", context=context,
|
||||
params=params)
|
||||
|
||||
@@ -446,11 +446,6 @@ class Scheduler(object):
|
||||
# if disk_over_commit is True,
|
||||
# otherwise virtual disk size < available disk size.
|
||||
|
||||
# Refresh compute_nodes table
|
||||
topic = db.queue_get_for(context, FLAGS.compute_topic, dest)
|
||||
rpc.call(context, topic,
|
||||
{"method": "update_available_resource"})
|
||||
|
||||
# Getting total available disk of host
|
||||
available_gb = self._get_compute_info(context,
|
||||
dest, 'disk_available_least')
|
||||
|
||||
@@ -143,10 +143,6 @@ class SchedulerManager(manager.Manager):
|
||||
'local_gb_used': 64}
|
||||
|
||||
"""
|
||||
# Update latest compute_node table
|
||||
topic = db.queue_get_for(context, FLAGS.compute_topic, host)
|
||||
rpc.call(context, topic, {"method": "update_available_resource"})
|
||||
|
||||
# Getting compute node info and related instances info
|
||||
compute_ref = db.service_get_all_compute_by_host(context, host)
|
||||
compute_ref = compute_ref[0]
|
||||
|
||||
@@ -446,10 +446,6 @@ class SchedulerTestCase(test.TestCase):
|
||||
db.instance_get_all_by_host(self.context, dest).AndReturn(
|
||||
[dict(memory_mb=256), dict(memory_mb=512)])
|
||||
# assert_compute_node_has_enough_disk()
|
||||
db.queue_get_for(self.context, FLAGS.compute_topic,
|
||||
dest).AndReturn('dest_queue1')
|
||||
rpc.call(self.context, 'dest_queue1',
|
||||
{'method': 'update_available_resource'})
|
||||
self.driver._get_compute_info(self.context, dest,
|
||||
'disk_available_least').AndReturn(1025)
|
||||
db.queue_get_for(self.context, FLAGS.compute_topic,
|
||||
@@ -698,10 +694,6 @@ class SchedulerTestCase(test.TestCase):
|
||||
instance, dest)
|
||||
|
||||
# Not enough disk
|
||||
db.queue_get_for(self.context, FLAGS.compute_topic,
|
||||
dest).AndReturn('dest_queue')
|
||||
rpc.call(self.context, 'dest_queue',
|
||||
{'method': 'update_available_resource'})
|
||||
self.driver._get_compute_info(self.context, dest,
|
||||
'disk_available_least').AndReturn(1023)
|
||||
db.queue_get_for(self.context, FLAGS.compute_topic,
|
||||
|
||||
@@ -151,6 +151,7 @@ class BaseTestCase(test.TestCase):
|
||||
type_id = instance_types.get_instance_type_by_name(type_name)['id']
|
||||
inst['instance_type_id'] = type_id
|
||||
inst['ami_launch_index'] = 0
|
||||
inst['memory_mb'] = 0
|
||||
inst['root_gb'] = 0
|
||||
inst['ephemeral_gb'] = 0
|
||||
inst.update(params)
|
||||
|
||||
Reference in New Issue
Block a user