fixed based on reviewer's comment.
This commit is contained in:
@@ -567,7 +567,7 @@ class VmCommands(object):
|
|||||||
if (FLAGS.volume_driver != 'nova.volume.driver.AOEDriver' and \
|
if (FLAGS.volume_driver != 'nova.volume.driver.AOEDriver' and \
|
||||||
FLAGS.volume_driver != 'nova.volume.driver.ISCSIDriver'):
|
FLAGS.volume_driver != 'nova.volume.driver.ISCSIDriver'):
|
||||||
msg = _("Support only AOEDriver and ISCSIDriver. Sorry!")
|
msg = _("Support only AOEDriver and ISCSIDriver. Sorry!")
|
||||||
raise exception.Error(msg)
|
raise exception.Error(msg)
|
||||||
|
|
||||||
rpc.call(ctxt,
|
rpc.call(ctxt,
|
||||||
FLAGS.scheduler_topic,
|
FLAGS.scheduler_topic,
|
||||||
@@ -637,8 +637,8 @@ class ServiceCommands(object):
|
|||||||
"args": {"host": host}})
|
"args": {"host": host}})
|
||||||
|
|
||||||
if type(result) != dict:
|
if type(result) != dict:
|
||||||
print 'Unexpected error occurs'
|
print _('An unexpected error has occurred.')
|
||||||
print '[Result]', result
|
print _('[Result]'), result
|
||||||
else:
|
else:
|
||||||
cpu = result['resource']['vcpus']
|
cpu = result['resource']['vcpus']
|
||||||
mem = result['resource']['memory_mb']
|
mem = result['resource']['memory_mb']
|
||||||
@@ -667,7 +667,7 @@ class ServiceCommands(object):
|
|||||||
ctxt = context.get_admin_context()
|
ctxt = context.get_admin_context()
|
||||||
service_refs = db.service_get_all_by_host(ctxt, host)
|
service_refs = db.service_get_all_by_host(ctxt, host)
|
||||||
if len(service_refs) <= 0:
|
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']
|
service_refs = [s for s in service_refs if s['topic'] == 'compute']
|
||||||
if len(service_refs) <= 0:
|
if len(service_refs) <= 0:
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ flags.DEFINE_integer('password_length', 12,
|
|||||||
flags.DEFINE_string('console_host', socket.gethostname(),
|
flags.DEFINE_string('console_host', socket.gethostname(),
|
||||||
'Console proxy host to use to connect to instances on'
|
'Console proxy host to use to connect to instances on'
|
||||||
'this host.')
|
'this host.')
|
||||||
flags.DEFINE_string('live_migration_retry_count', 30,
|
flags.DEFINE_integer('live_migration_retry_count', 30,
|
||||||
("Retry count needed in live_migration."
|
("Retry count needed in live_migration."
|
||||||
" sleep 1 sec for each count"))
|
" sleep 1 sec for each count"))
|
||||||
|
|
||||||
@@ -757,8 +757,9 @@ class ComputeManager(manager.Manager):
|
|||||||
dirpath = FLAGS.instances_path
|
dirpath = FLAGS.instances_path
|
||||||
fd, tmp_file = tempfile.mkstemp(dir=dirpath)
|
fd, tmp_file = tempfile.mkstemp(dir=dirpath)
|
||||||
LOG.debug(_("Creating tmpfile %s to notify to other "
|
LOG.debug(_("Creating tmpfile %s to notify to other "
|
||||||
"compute node that they mounts same storage.") % tmp_file)
|
"compute nodes that they should mount "
|
||||||
os.fdopen(fd, 'w+').close()
|
"the same storage.") % tmp_file)
|
||||||
|
os.close(fd)
|
||||||
return os.path.basename(tmp_file)
|
return os.path.basename(tmp_file)
|
||||||
|
|
||||||
@exception.wrap_exception
|
@exception.wrap_exception
|
||||||
@@ -812,7 +813,7 @@ class ComputeManager(manager.Manager):
|
|||||||
# Getting fixed ips
|
# Getting fixed ips
|
||||||
fixed_ip = self.db.instance_get_fixed_address(context, instance_id)
|
fixed_ip = self.db.instance_get_fixed_address(context, instance_id)
|
||||||
if not fixed_ip:
|
if not fixed_ip:
|
||||||
msg = _("%(instance_id)s(%(ec2_id)s) does'nt have fixed_ip")
|
msg = _("%(instance_id)s(%(ec2_id)s) does not have fixed_ip.")
|
||||||
raise exception.NotFound(msg % locals())
|
raise exception.NotFound(msg % locals())
|
||||||
|
|
||||||
# If any volume is mounted, prepare here.
|
# If any volume is mounted, prepare here.
|
||||||
@@ -929,7 +930,7 @@ class ComputeManager(manager.Manager):
|
|||||||
floating_ip = self.db.instance_get_floating_address(ctxt,
|
floating_ip = self.db.instance_get_floating_address(ctxt,
|
||||||
instance_id)
|
instance_id)
|
||||||
if not floating_ip:
|
if not floating_ip:
|
||||||
LOG.info(_('floating_ip is not found for %s'), i_name)
|
LOG.info(_('No floating_ip is found for %s.'), i_name)
|
||||||
else:
|
else:
|
||||||
floating_ip_ref = self.db.floating_ip_get_by_address(ctxt,
|
floating_ip_ref = self.db.floating_ip_get_by_address(ctxt,
|
||||||
floating_ip)
|
floating_ip)
|
||||||
@@ -937,7 +938,7 @@ class ComputeManager(manager.Manager):
|
|||||||
floating_ip_ref['address'],
|
floating_ip_ref['address'],
|
||||||
{'host': dest})
|
{'host': dest})
|
||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
LOG.info(_('Floating_ip is not found for %s'), i_name)
|
LOG.info(_('No floating_ip is found for %s.'), i_name)
|
||||||
except:
|
except:
|
||||||
LOG.error(_("Live migration: Unexpected error:"
|
LOG.error(_("Live migration: Unexpected error:"
|
||||||
"%s cannot inherit floating ip..") % i_name)
|
"%s cannot inherit floating ip..") % i_name)
|
||||||
@@ -945,12 +946,11 @@ class ComputeManager(manager.Manager):
|
|||||||
# Restore instance/volume state
|
# Restore instance/volume state
|
||||||
self.recover_live_migration(ctxt, instance_ref, dest)
|
self.recover_live_migration(ctxt, instance_ref, dest)
|
||||||
|
|
||||||
LOG.info(_('Migrating %(i_name)s to %(dest)s finishes successfully.')
|
LOG.info(_('Migrating %(i_name)s to %(dest)s finished successfully.')
|
||||||
% locals())
|
% locals())
|
||||||
LOG.info(_("The below error is normally occurs. "
|
LOG.info(_("You may see the error \"libvirt: QEMU error: "
|
||||||
"Just check if instance is successfully migrated.\n"
|
"Domain not found: no domain with matching name.\" "
|
||||||
"libvir: QEMU error : Domain not found: no domain "
|
"This error can be safely ignored."))
|
||||||
"with matching name.."))
|
|
||||||
|
|
||||||
def recover_live_migration(self, ctxt, instance_ref, host=None):
|
def recover_live_migration(self, ctxt, instance_ref, host=None):
|
||||||
"""Recovers Instance/volume state from migrating -> running.
|
"""Recovers Instance/volume state from migrating -> running.
|
||||||
|
|||||||
@@ -192,8 +192,8 @@ def service_get_all_compute_by_host(context, host):
|
|||||||
all()
|
all()
|
||||||
|
|
||||||
if not result:
|
if not result:
|
||||||
raise exception.NotFound(_("%s does not exist or not "
|
raise exception.NotFound(_("%s does not exist or is not "
|
||||||
"compute node.") % host)
|
"a compute node.") % host)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,6 @@ class Scheduler(object):
|
|||||||
"args": {'cpu_info': oservice_ref['cpu_info']}})
|
"args": {'cpu_info': oservice_ref['cpu_info']}})
|
||||||
|
|
||||||
except rpc.RemoteError:
|
except rpc.RemoteError:
|
||||||
ec2_id = instance_ref['hostname']
|
|
||||||
src = instance_ref['host']
|
src = instance_ref['host']
|
||||||
logging.exception(_("host %(dest)s is not compatible with "
|
logging.exception(_("host %(dest)s is not compatible with "
|
||||||
"original host %(src)s.") % locals())
|
"original host %(src)s.") % locals())
|
||||||
@@ -259,9 +258,10 @@ class Scheduler(object):
|
|||||||
mem_avail = mem_total - mem_used
|
mem_avail = mem_total - mem_used
|
||||||
mem_inst = instance_ref['memory_mb']
|
mem_inst = instance_ref['memory_mb']
|
||||||
if mem_avail <= mem_inst:
|
if mem_avail <= mem_inst:
|
||||||
raise exception.NotEmpty(_("%(ec2_id)s is not capable to "
|
raise exception.NotEmpty(_("Unable to migrate %(ec2_id)s "
|
||||||
"migrate %(dest)s (host:%(mem_avail)s "
|
"to destination: %(dest)s "
|
||||||
" <= instance:%(mem_inst)s)")
|
"(host:%(mem_avail)s "
|
||||||
|
"<= instance:%(mem_inst)s)")
|
||||||
% locals())
|
% locals())
|
||||||
|
|
||||||
def mounted_on_same_shared_storage(self, context, instance_ref, dest):
|
def mounted_on_same_shared_storage(self, context, instance_ref, dest):
|
||||||
@@ -292,7 +292,7 @@ class Scheduler(object):
|
|||||||
|
|
||||||
except rpc.RemoteError:
|
except rpc.RemoteError:
|
||||||
ipath = FLAGS.instances_path
|
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 "
|
"same shared storage between %(src)s "
|
||||||
"and %(dest)s.") % locals())
|
"and %(dest)s.") % locals())
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ class ComputeTestCase(test.TestCase):
|
|||||||
Use this when any testcase executed later than test_run_terminate
|
Use this when any testcase executed later than test_run_terminate
|
||||||
"""
|
"""
|
||||||
vol1 = models.Volume()
|
vol1 = models.Volume()
|
||||||
vol1.__setitem__('id', 1)
|
vol1['id'] = 1
|
||||||
vol2 = models.Volume()
|
vol2 = models.Volume()
|
||||||
vol2.__setitem__('id', 2)
|
vol2['id'] = 2
|
||||||
instance_ref = models.Instance()
|
instance_ref = models.Instance()
|
||||||
instance_ref.__setitem__('id', 1)
|
instance_ref['id'] = 1
|
||||||
instance_ref.__setitem__('volumes', [vol1, vol2])
|
instance_ref['volumes'] = [vol1, vol2]
|
||||||
instance_ref.__setitem__('hostname', 'i-00000001')
|
instance_ref['hostname'] = 'i-00000001'
|
||||||
instance_ref.__setitem__('host', 'dummy')
|
instance_ref['host'] = 'dummy'
|
||||||
return instance_ref
|
return instance_ref
|
||||||
|
|
||||||
def test_create_instance_defaults_display_name(self):
|
def test_create_instance_defaults_display_name(self):
|
||||||
@@ -114,9 +114,9 @@ class ComputeTestCase(test.TestCase):
|
|||||||
"""Make sure create associates security groups"""
|
"""Make sure create associates security groups"""
|
||||||
group = self._create_group()
|
group = self._create_group()
|
||||||
instance_ref = models.Instance()
|
instance_ref = models.Instance()
|
||||||
instance_ref.__setitem__('id', 1)
|
instance_ref['id'] = 1
|
||||||
instance_ref.__setitem__('volumes', [{'id': 1}, {'id': 2}])
|
instance_ref['volumes'] = [{'id': 1}, {'id': 2}]
|
||||||
instance_ref.__setitem__('hostname', 'i-00000001')
|
instance_ref['hostname'] = 'i-00000001'
|
||||||
return instance_ref
|
return instance_ref
|
||||||
|
|
||||||
def test_create_instance_defaults_display_name(self):
|
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):
|
def test_pre_live_migration_instance_has_no_volume(self):
|
||||||
"""Confirm log meg when instance doesn't mount any volumes."""
|
"""Confirm log meg when instance doesn't mount any volumes."""
|
||||||
i_ref = self._get_dummy_instance()
|
i_ref = self._get_dummy_instance()
|
||||||
i_ref.__setitem__('volumes', [])
|
i_ref['volumes'] = []
|
||||||
c = context.get_admin_context()
|
c = context.get_admin_context()
|
||||||
|
|
||||||
self._setup_other_managers()
|
self._setup_other_managers()
|
||||||
@@ -501,7 +501,7 @@ class ComputeTestCase(test.TestCase):
|
|||||||
def test_live_migration_dest_raises_exception_no_volume(self):
|
def test_live_migration_dest_raises_exception_no_volume(self):
|
||||||
"""Same as above test(input pattern is different) """
|
"""Same as above test(input pattern is different) """
|
||||||
i_ref = self._get_dummy_instance()
|
i_ref = self._get_dummy_instance()
|
||||||
i_ref.__setitem__('volumes', [])
|
i_ref['volumes'] = []
|
||||||
c = context.get_admin_context()
|
c = context.get_admin_context()
|
||||||
topic = db.queue_get_for(c, FLAGS.compute_topic, i_ref['host'])
|
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):
|
def test_live_migration_works_correctly_no_volume(self):
|
||||||
"""Confirm live_migration() works as expected correctly."""
|
"""Confirm live_migration() works as expected correctly."""
|
||||||
i_ref = self._get_dummy_instance()
|
i_ref = self._get_dummy_instance()
|
||||||
i_ref.__setitem__('volumes', [])
|
i_ref['volumes'] = []
|
||||||
c = context.get_admin_context()
|
c = context.get_admin_context()
|
||||||
topic = db.queue_get_for(c, FLAGS.compute_topic, i_ref['host'])
|
topic = db.queue_get_for(c, FLAGS.compute_topic, i_ref['host'])
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,8 @@ class SchedulerTestCase(test.TestCase):
|
|||||||
try:
|
try:
|
||||||
scheduler.show_host_resources(ctxt, dest)
|
scheduler.show_host_resources(ctxt, dest)
|
||||||
except exception.NotFound, e:
|
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)
|
self.assertTrue(c1)
|
||||||
|
|
||||||
def _dic_is_equal(self, dic1, dic2, keys=None):
|
def _dic_is_equal(self, dic1, dic2, keys=None):
|
||||||
@@ -786,7 +787,7 @@ class SimpleDriverTestCase(test.TestCase):
|
|||||||
i_ref,
|
i_ref,
|
||||||
'somewhere')
|
'somewhere')
|
||||||
except exception.NotEmpty, e:
|
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)
|
self.assertTrue(c)
|
||||||
db.instance_destroy(self.context, instance_id)
|
db.instance_destroy(self.context, instance_id)
|
||||||
|
|||||||
@@ -42,24 +42,6 @@ class FakeManager(manager.Manager):
|
|||||||
def test_method(self):
|
def test_method(self):
|
||||||
return 'manager'
|
return 'manager'
|
||||||
|
|
||||||
# temporary variable to store host/binary/self.mox
|
|
||||||
# from each method to fake class.
|
|
||||||
global_host = None
|
|
||||||
global_binary = None
|
|
||||||
global_mox = None
|
|
||||||
|
|
||||||
|
|
||||||
class FakeComputeManager(compute_manager.ComputeManager):
|
|
||||||
"""Fake computemanager manager for tests"""
|
|
||||||
|
|
||||||
def __init__(self, compute_driver=None, *args, **kwargs):
|
|
||||||
global ghost, gbinary, gmox
|
|
||||||
self.update_available_resource(mox.IgnoreArg())
|
|
||||||
gmox.ReplayAll()
|
|
||||||
super(FakeComputeManager, self).__init__(compute_driver,
|
|
||||||
*args,
|
|
||||||
**kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class ExtendedService(service.Service):
|
class ExtendedService(service.Service):
|
||||||
def test_method(self):
|
def test_method(self):
|
||||||
@@ -275,37 +257,38 @@ class ServiceTestCase(test.TestCase):
|
|||||||
"""Confirm compute updates their record of compute-service table."""
|
"""Confirm compute updates their record of compute-service table."""
|
||||||
host = 'foo'
|
host = 'foo'
|
||||||
binary = 'nova-compute'
|
binary = 'nova-compute'
|
||||||
topic = 'compute1'
|
topic = 'compute'
|
||||||
service_create = {'host': host,
|
|
||||||
'binary': binary,
|
|
||||||
'topic': topic,
|
|
||||||
'report_count': 0,
|
|
||||||
'availability_zone': 'nova'}
|
|
||||||
service_ref = {'host': host,
|
|
||||||
'binary': binary,
|
|
||||||
'topic': topic,
|
|
||||||
'report_count': 0,
|
|
||||||
'availability_zone': 'nova',
|
|
||||||
'id': 1}
|
|
||||||
|
|
||||||
service.db.service_get_by_args(mox.IgnoreArg(),
|
|
||||||
host,
|
|
||||||
binary).AndRaise(exception.NotFound())
|
|
||||||
service.db.service_create(mox.IgnoreArg(),
|
|
||||||
service_create).AndReturn(service_ref)
|
|
||||||
self.mox.StubOutWithMock(compute_manager.ComputeManager,
|
|
||||||
'update_available_resource')
|
|
||||||
|
|
||||||
global ghost, gbinary, gmox
|
|
||||||
ghost = host
|
|
||||||
gbinary = binary
|
|
||||||
gmox = self.mox
|
|
||||||
|
|
||||||
|
# Any mocks are not working without UnsetStubs() here.
|
||||||
|
self.mox.UnsetStubs()
|
||||||
|
ctxt = context.get_admin_context()
|
||||||
|
service_ref = db.service_create(ctxt, {'host': host,
|
||||||
|
'binary': binary,
|
||||||
|
'topic': topic})
|
||||||
serv = service.Service(host,
|
serv = service.Service(host,
|
||||||
binary,
|
binary,
|
||||||
topic,
|
topic,
|
||||||
'nova.tests.test_service.FakeComputeManager')
|
'nova.compute.manager.ComputeManager')
|
||||||
# ReplayAll has been executed FakeComputeManager.__init__()
|
|
||||||
#self.mox.ReplayAll()
|
# This testcase want to test calling update_available_resource.
|
||||||
|
# No need to call periodic call, then below variable must be set 0.
|
||||||
|
serv.report_interval = 0
|
||||||
|
serv.periodic_interval = 0
|
||||||
|
|
||||||
|
# Creating mocks
|
||||||
|
self.mox.StubOutWithMock(service.rpc.Connection, 'instance')
|
||||||
|
service.rpc.Connection.instance(new=mox.IgnoreArg())
|
||||||
|
service.rpc.Connection.instance(new=mox.IgnoreArg())
|
||||||
|
self.mox.StubOutWithMock(serv.manager.driver,
|
||||||
|
'update_available_resource')
|
||||||
|
serv.manager.driver.update_available_resource(mox.IgnoreArg(), host)
|
||||||
|
|
||||||
|
# Just doing start()-stop(), not confirm new db record is created,
|
||||||
|
# because update_available_resource() works only in libvirt environment.
|
||||||
|
# This testcase confirms update_available_resource() is called.
|
||||||
|
# Otherwise, mox complains.
|
||||||
|
self.mox.ReplayAll()
|
||||||
serv.start()
|
serv.start()
|
||||||
serv.stop()
|
serv.stop()
|
||||||
|
|
||||||
|
db.service_destroy(ctxt, service_ref['id'])
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ class LibvirtConnTestCase(test.TestCase):
|
|||||||
self.assertEquals(uri, testuri)
|
self.assertEquals(uri, testuri)
|
||||||
db.instance_destroy(user_context, instance_ref['id'])
|
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."""
|
"""Confirm compute_node table is updated successfully."""
|
||||||
org_path = FLAGS.instances_path = ''
|
org_path = FLAGS.instances_path = ''
|
||||||
FLAGS.instances_path = '.'
|
FLAGS.instances_path = '.'
|
||||||
@@ -314,7 +314,7 @@ class LibvirtConnTestCase(test.TestCase):
|
|||||||
compute_node = service_ref['compute_node'][0]
|
compute_node = service_ref['compute_node'][0]
|
||||||
|
|
||||||
if sys.platform.upper() == 'LINUX2':
|
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['memory_mb'] > 0)
|
||||||
self.assertTrue(compute_node['local_gb'] > 0)
|
self.assertTrue(compute_node['local_gb'] > 0)
|
||||||
self.assertTrue(compute_node['vcpus_used'] == 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(len(compute_node['hypervisor_type']) > 0)
|
||||||
self.assertTrue(compute_node['hypervisor_version'] > 0)
|
self.assertTrue(compute_node['hypervisor_version'] > 0)
|
||||||
else:
|
else:
|
||||||
self.assertTrue(compute_node['vcpus'] > 0)
|
self.assertTrue(compute_node['vcpus'] >= 0)
|
||||||
self.assertTrue(compute_node['memory_mb'] == 0)
|
self.assertTrue(compute_node['memory_mb'] == 0)
|
||||||
self.assertTrue(compute_node['local_gb'] > 0)
|
self.assertTrue(compute_node['local_gb'] > 0)
|
||||||
self.assertTrue(compute_node['vcpus_used'] == 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)
|
self.volume.check_for_export(self.context, self.instance_id)
|
||||||
except exception.ProcessExecutionError, e:
|
except exception.ProcessExecutionError, e:
|
||||||
volume_id = volume_id_list[0]
|
volume_id = volume_id_list[0]
|
||||||
msg = _("""Cannot confirm exported volume id:%(volume_id)s."""
|
msg = _("Cannot confirm exported volume id:%(volume_id)s. "
|
||||||
"""vblade process for e%(shelf_id)s.%(blade_id)s """
|
"vblade process for e%(shelf_id)s.%(blade_id)s "
|
||||||
"""isn't running.""") % locals()
|
"isn't running.") % locals()
|
||||||
|
|
||||||
msg_is_match = (0 <= e.message.find(msg))
|
msg_is_match = (0 <= e.message.find(msg))
|
||||||
|
|
||||||
self.assertTrue(msg_is_match)
|
self.assertTrue(msg_is_match)
|
||||||
|
|||||||
@@ -860,7 +860,14 @@ class LibvirtConnection(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return multiprocessing.cpu_count()
|
# On certain platforms, this will raise a NotImplementedError.
|
||||||
|
try:
|
||||||
|
return multiprocessing.cpu_count()
|
||||||
|
except NotImplementedError:
|
||||||
|
LOG.warn(_("Cannot get the number of cpu, because this "
|
||||||
|
"function is not implemented for this platform. "
|
||||||
|
"This error can be safely ignored for now."))
|
||||||
|
return 0
|
||||||
|
|
||||||
def get_memory_mb_total(self):
|
def get_memory_mb_total(self):
|
||||||
"""Get the total memory size(MB) of physical computer.
|
"""Get the total memory size(MB) of physical computer.
|
||||||
@@ -1042,9 +1049,9 @@ class LibvirtConnection(object):
|
|||||||
try:
|
try:
|
||||||
service_ref = db.service_get_all_compute_by_host(ctxt, host)[0]
|
service_ref = db.service_get_all_compute_by_host(ctxt, host)[0]
|
||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
msg = _(("""Cannot update compute manager specific info,"""
|
raise exception.Invalid(_("Cannot update compute manager "
|
||||||
""" Because no service record found."""))
|
"specific info, because no service "
|
||||||
raise exception.Invalid(msg)
|
"record was found."))
|
||||||
|
|
||||||
# Updating host information
|
# Updating host information
|
||||||
dic = {'vcpus': self.get_vcpu_total(),
|
dic = {'vcpus': self.get_vcpu_total(),
|
||||||
@@ -1059,11 +1066,11 @@ class LibvirtConnection(object):
|
|||||||
|
|
||||||
compute_node_ref = service_ref['compute_node']
|
compute_node_ref = service_ref['compute_node']
|
||||||
if not compute_node_ref:
|
if not compute_node_ref:
|
||||||
LOG.info(_('Compute_service record is created for %s ') % host)
|
LOG.info(_('Compute_service record created for %s ') % host)
|
||||||
dic['service_id'] = service_ref['id']
|
dic['service_id'] = service_ref['id']
|
||||||
db.compute_node_create(ctxt, dic)
|
db.compute_node_create(ctxt, dic)
|
||||||
else:
|
else:
|
||||||
LOG.info(_('Compute_service record is updated for %s ') % host)
|
LOG.info(_('Compute_service record updated for %s ') % host)
|
||||||
db.compute_node_update(ctxt, compute_node_ref[0]['id'], dic)
|
db.compute_node_update(ctxt, compute_node_ref[0]['id'], dic)
|
||||||
|
|
||||||
def compare_cpu(self, cpu_info):
|
def compare_cpu(self, cpu_info):
|
||||||
@@ -1081,8 +1088,7 @@ class LibvirtConnection(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.info(_('Checking cpu_info: instance was launched this cpu.\n%s')
|
LOG.info(_('Instance launched has CPU info:\n%s') % cpu_info)
|
||||||
% cpu_info)
|
|
||||||
dic = utils.loads(cpu_info)
|
dic = utils.loads(cpu_info)
|
||||||
xml = str(Template(self.cpuinfo_xml, searchList=dic))
|
xml = str(Template(self.cpuinfo_xml, searchList=dic))
|
||||||
LOG.info(_('to xml...\n:%s ' % xml))
|
LOG.info(_('to xml...\n:%s ' % xml))
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class AOEDriver(VolumeDriver):
|
|||||||
break
|
break
|
||||||
if not exported:
|
if not exported:
|
||||||
# Instance will be terminated in this case.
|
# Instance will be terminated in this case.
|
||||||
desc = _("Cannot confirm exported volume id:%(volume_id)s."
|
desc = _("Cannot confirm exported volume id:%(volume_id)s. "
|
||||||
"vblade process for e%(shelf_id)s.%(blade_id)s "
|
"vblade process for e%(shelf_id)s.%(blade_id)s "
|
||||||
"isn't running.") % locals()
|
"isn't running.") % locals()
|
||||||
raise exception.ProcessExecutionError(out, _err, cmd=cmd,
|
raise exception.ProcessExecutionError(out, _err, cmd=cmd,
|
||||||
|
|||||||
Reference in New Issue
Block a user