fixed based on reviewer's comment.
This commit is contained in:
@@ -637,8 +637,8 @@ class ServiceCommands(object):
|
||||
"args": {"host": host}})
|
||||
|
||||
if type(result) != dict:
|
||||
print 'Unexpected error occurs'
|
||||
print '[Result]', result
|
||||
print _('An unexpected error has occurred.')
|
||||
print _('[Result]'), result
|
||||
else:
|
||||
cpu = result['resource']['vcpus']
|
||||
mem = result['resource']['memory_mb']
|
||||
@@ -667,7 +667,7 @@ class ServiceCommands(object):
|
||||
ctxt = context.get_admin_context()
|
||||
service_refs = db.service_get_all_by_host(ctxt, host)
|
||||
if len(service_refs) <= 0:
|
||||
raise exception.Invalid(_('%s does not exists.') % host)
|
||||
raise exception.Invalid(_('%s does not exist.') % host)
|
||||
|
||||
service_refs = [s for s in service_refs if s['topic'] == 'compute']
|
||||
if len(service_refs) <= 0:
|
||||
|
||||
@@ -226,7 +226,6 @@ class Scheduler(object):
|
||||
"args": {'cpu_info': oservice_ref['cpu_info']}})
|
||||
|
||||
except rpc.RemoteError:
|
||||
ec2_id = instance_ref['hostname']
|
||||
src = instance_ref['host']
|
||||
logging.exception(_("host %(dest)s is not compatible with "
|
||||
"original host %(src)s.") % locals())
|
||||
@@ -259,8 +258,9 @@ class Scheduler(object):
|
||||
mem_avail = mem_total - mem_used
|
||||
mem_inst = instance_ref['memory_mb']
|
||||
if mem_avail <= mem_inst:
|
||||
raise exception.NotEmpty(_("%(ec2_id)s is not capable to "
|
||||
"migrate %(dest)s (host:%(mem_avail)s "
|
||||
raise exception.NotEmpty(_("Unable to migrate %(ec2_id)s "
|
||||
"to destination: %(dest)s "
|
||||
"(host:%(mem_avail)s "
|
||||
"<= instance:%(mem_inst)s)")
|
||||
% locals())
|
||||
|
||||
@@ -292,7 +292,7 @@ class Scheduler(object):
|
||||
|
||||
except rpc.RemoteError:
|
||||
ipath = FLAGS.instances_path
|
||||
logging.error(_("Cannot comfirm tmpfile at %(ipath)s is on "
|
||||
logging.error(_("Cannot confirm tmpfile at %(ipath)s is on "
|
||||
"same shared storage between %(src)s "
|
||||
"and %(dest)s.") % locals())
|
||||
raise
|
||||
|
||||
@@ -89,14 +89,14 @@ class ComputeTestCase(test.TestCase):
|
||||
Use this when any testcase executed later than test_run_terminate
|
||||
"""
|
||||
vol1 = models.Volume()
|
||||
vol1.__setitem__('id', 1)
|
||||
vol1['id'] = 1
|
||||
vol2 = models.Volume()
|
||||
vol2.__setitem__('id', 2)
|
||||
vol2['id'] = 2
|
||||
instance_ref = models.Instance()
|
||||
instance_ref.__setitem__('id', 1)
|
||||
instance_ref.__setitem__('volumes', [vol1, vol2])
|
||||
instance_ref.__setitem__('hostname', 'i-00000001')
|
||||
instance_ref.__setitem__('host', 'dummy')
|
||||
instance_ref['id'] = 1
|
||||
instance_ref['volumes'] = [vol1, vol2]
|
||||
instance_ref['hostname'] = 'i-00000001'
|
||||
instance_ref['host'] = 'dummy'
|
||||
return instance_ref
|
||||
|
||||
def test_create_instance_defaults_display_name(self):
|
||||
@@ -114,9 +114,9 @@ class ComputeTestCase(test.TestCase):
|
||||
"""Make sure create associates security groups"""
|
||||
group = self._create_group()
|
||||
instance_ref = models.Instance()
|
||||
instance_ref.__setitem__('id', 1)
|
||||
instance_ref.__setitem__('volumes', [{'id': 1}, {'id': 2}])
|
||||
instance_ref.__setitem__('hostname', 'i-00000001')
|
||||
instance_ref['id'] = 1
|
||||
instance_ref['volumes'] = [{'id': 1}, {'id': 2}]
|
||||
instance_ref['hostname'] = 'i-00000001'
|
||||
return instance_ref
|
||||
|
||||
def test_create_instance_defaults_display_name(self):
|
||||
@@ -390,7 +390,7 @@ class ComputeTestCase(test.TestCase):
|
||||
def test_pre_live_migration_instance_has_no_volume(self):
|
||||
"""Confirm log meg when instance doesn't mount any volumes."""
|
||||
i_ref = self._get_dummy_instance()
|
||||
i_ref.__setitem__('volumes', [])
|
||||
i_ref['volumes'] = []
|
||||
c = context.get_admin_context()
|
||||
|
||||
self._setup_other_managers()
|
||||
@@ -501,7 +501,7 @@ class ComputeTestCase(test.TestCase):
|
||||
def test_live_migration_dest_raises_exception_no_volume(self):
|
||||
"""Same as above test(input pattern is different) """
|
||||
i_ref = self._get_dummy_instance()
|
||||
i_ref.__setitem__('volumes', [])
|
||||
i_ref['volumes'] = []
|
||||
c = context.get_admin_context()
|
||||
topic = db.queue_get_for(c, FLAGS.compute_topic, i_ref['host'])
|
||||
|
||||
@@ -526,7 +526,7 @@ class ComputeTestCase(test.TestCase):
|
||||
def test_live_migration_works_correctly_no_volume(self):
|
||||
"""Confirm live_migration() works as expected correctly."""
|
||||
i_ref = self._get_dummy_instance()
|
||||
i_ref.__setitem__('volumes', [])
|
||||
i_ref['volumes'] = []
|
||||
c = context.get_admin_context()
|
||||
topic = db.queue_get_for(c, FLAGS.compute_topic, i_ref['host'])
|
||||
|
||||
|
||||
@@ -119,7 +119,8 @@ class SchedulerTestCase(test.TestCase):
|
||||
try:
|
||||
scheduler.show_host_resources(ctxt, dest)
|
||||
except exception.NotFound, e:
|
||||
c1 = (0 <= e.message.find('does not exist or not compute node'))
|
||||
c1 = (e.message.find(_("does not exist or is not a "
|
||||
"compute node.")) >= 0)
|
||||
self.assertTrue(c1)
|
||||
|
||||
def _dic_is_equal(self, dic1, dic2, keys=None):
|
||||
@@ -786,7 +787,7 @@ class SimpleDriverTestCase(test.TestCase):
|
||||
i_ref,
|
||||
'somewhere')
|
||||
except exception.NotEmpty, e:
|
||||
c = (e.message.find('is not capable to migrate') >= 0)
|
||||
c = (e.message.find('Unable to migrate') >= 0)
|
||||
|
||||
self.assertTrue(c)
|
||||
db.instance_destroy(self.context, instance_id)
|
||||
|
||||
@@ -283,7 +283,7 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
self.assertEquals(uri, testuri)
|
||||
db.instance_destroy(user_context, instance_ref['id'])
|
||||
|
||||
def tes1t_update_available_resource_works_correctly(self):
|
||||
def test_update_available_resource_works_correctly(self):
|
||||
"""Confirm compute_node table is updated successfully."""
|
||||
org_path = FLAGS.instances_path = ''
|
||||
FLAGS.instances_path = '.'
|
||||
@@ -314,7 +314,7 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
compute_node = service_ref['compute_node'][0]
|
||||
|
||||
if sys.platform.upper() == 'LINUX2':
|
||||
self.assertTrue(compute_node['vcpus'] > 0)
|
||||
self.assertTrue(compute_node['vcpus'] >= 0)
|
||||
self.assertTrue(compute_node['memory_mb'] > 0)
|
||||
self.assertTrue(compute_node['local_gb'] > 0)
|
||||
self.assertTrue(compute_node['vcpus_used'] == 0)
|
||||
@@ -323,7 +323,7 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
self.assertTrue(len(compute_node['hypervisor_type']) > 0)
|
||||
self.assertTrue(compute_node['hypervisor_version'] > 0)
|
||||
else:
|
||||
self.assertTrue(compute_node['vcpus'] > 0)
|
||||
self.assertTrue(compute_node['vcpus'] >= 0)
|
||||
self.assertTrue(compute_node['memory_mb'] == 0)
|
||||
self.assertTrue(compute_node['local_gb'] > 0)
|
||||
self.assertTrue(compute_node['vcpus_used'] == 0)
|
||||
|
||||
@@ -284,9 +284,10 @@ class AOETestCase(DriverTestCase):
|
||||
self.volume.check_for_export(self.context, self.instance_id)
|
||||
except exception.ProcessExecutionError, e:
|
||||
volume_id = volume_id_list[0]
|
||||
msg = _("""Cannot confirm exported volume id:%(volume_id)s."""
|
||||
"""vblade process for e%(shelf_id)s.%(blade_id)s """
|
||||
"""isn't running.""") % locals()
|
||||
msg = _("Cannot confirm exported volume id:%(volume_id)s. "
|
||||
"vblade process for e%(shelf_id)s.%(blade_id)s "
|
||||
"isn't running.") % locals()
|
||||
|
||||
msg_is_match = (0 <= e.message.find(msg))
|
||||
|
||||
self.assertTrue(msg_is_match)
|
||||
|
||||
Reference in New Issue
Block a user