rename node_name to host

This commit is contained in:
Vishvananda Ishaya
2010-08-31 16:48:41 -07:00
parent 006655fe03
commit e63eb090a4
5 changed files with 26 additions and 26 deletions

View File

@@ -230,7 +230,7 @@ class CloudController(object):
# instance_id is passed in as a list of instances
instance_ref = db.instance_get_by_str(context, instance_id[0])
return rpc.call('%s.%s' % (FLAGS.compute_topic,
instance_ref['node_name']),
instance_ref['host']),
{"method": "get_console_output",
"args": {"context": None,
"instance_id": instance_ref['id']}})
@@ -257,7 +257,7 @@ class CloudController(object):
v['status'] = '%s (%s, %s, %s, %s)' % (
volume['status'],
volume['user_id'],
'node_name',
'host',
volume['instance_id'],
volume['mountpoint'])
if volume['attach_status'] == 'attached':
@@ -391,7 +391,7 @@ class CloudController(object):
if context.user.is_admin():
i['key_name'] = '%s (%s, %s)' % (i['key_name'],
instance.project_id,
'node_name') # FIXME
'host') # FIXME
i['product_codes_set'] = self._convert_to_set([], 'product_codes')
i['instance_type'] = instance.instance_type
i['launch_time'] = instance.created_at

View File

@@ -206,7 +206,7 @@ DEFINE_integer('auth_token_ttl', 3600, 'Seconds for auth tokens to linger')
# UNUSED
DEFINE_string('node_availability_zone', 'nova',
'availability zone of this node')
DEFINE_string('node_name', socket.gethostname(),
DEFINE_string('host', socket.gethostname(),
'name of this node')
DEFINE_string('sql_connection',

View File

@@ -108,14 +108,14 @@ class ModelTestCase(test.TrialTestCase):
self.assertEqual(x.identifier, 'i-test')
def test_instance_associates_node(self):
"""create, then check that it is listed for the node_name"""
"""create, then check that it is listed for the host"""
instance = self.create_instance()
found = False
for x in model.InstanceDirectory().by_node(FLAGS.node_name):
for x in model.InstanceDirectory().by_node(FLAGS.host):
if x.identifier == 'i-test':
found = True
self.assertFalse(found)
instance['node_name'] = 'test_node'
instance['host'] = 'test_node'
instance.save()
for x in model.InstanceDirectory().by_node('test_node'):
if x.identifier == 'i-test':

View File

@@ -91,7 +91,7 @@ class NetworkTestCase(test.TrialTestCase):
try:
db.floating_ip_get_by_address(None, ip_str)
except exception.NotFound:
db.floating_ip_create(None, ip_str, FLAGS.node_name)
db.floating_ip_create(None, ip_str, FLAGS.host)
float_addr = self.network.allocate_floating_ip(self.context,
self.projects[0].id)
fix_addr = self._create_address(0)

View File

@@ -58,7 +58,7 @@ class ServiceTestCase(test.BaseTestCase):
rpc.AdapterConsumer)
rpc.AdapterConsumer(connection=mox.IgnoreArg(),
topic='fake.%s' % FLAGS.node_name,
topic='fake.%s' % FLAGS.host,
proxy=mox.IsA(service.Service)).AndReturn(
rpc.AdapterConsumer)
@@ -82,37 +82,37 @@ class ServiceTestCase(test.BaseTestCase):
# 'model_disconnected' and report_state doesn't really do much so this
# these are mostly just for coverage
def test_report_state(self):
node_name = 'foo'
host = 'foo'
binary = 'bar'
daemon_ref = {'node_name': node_name,
daemon_ref = {'host': host,
'binary': binary,
'report_count': 0,
'id': 1}
service.db.__getattr__('report_state')
service.db.daemon_get_by_args(None,
node_name,
host,
binary).AndReturn(daemon_ref)
service.db.daemon_update(None, daemon_ref['id'],
mox.ContainsKeyValue('report_count', 1))
self.mox.ReplayAll()
s = service.Service()
rv = yield s.report_state(node_name, binary)
rv = yield s.report_state(host, binary)
def test_report_state_no_daemon(self):
node_name = 'foo'
host = 'foo'
binary = 'bar'
daemon_create = {'node_name': node_name,
daemon_create = {'host': host,
'binary': binary,
'report_count': 0}
daemon_ref = {'node_name': node_name,
daemon_ref = {'host': host,
'binary': binary,
'report_count': 0,
'id': 1}
service.db.__getattr__('report_state')
service.db.daemon_get_by_args(None,
node_name,
host,
binary).AndRaise(exception.NotFound())
service.db.daemon_create(None,
daemon_create).AndReturn(daemon_ref['id'])
@@ -122,38 +122,38 @@ class ServiceTestCase(test.BaseTestCase):
self.mox.ReplayAll()
s = service.Service()
rv = yield s.report_state(node_name, binary)
rv = yield s.report_state(host, binary)
def test_report_state_newly_disconnected(self):
node_name = 'foo'
host = 'foo'
binary = 'bar'
daemon_ref = {'node_name': node_name,
daemon_ref = {'host': host,
'binary': binary,
'report_count': 0,
'id': 1}
service.db.__getattr__('report_state')
service.db.daemon_get_by_args(None,
node_name,
host,
binary).AndRaise(Exception())
self.mox.ReplayAll()
s = service.Service()
rv = yield s.report_state(node_name, binary)
rv = yield s.report_state(host, binary)
self.assert_(s.model_disconnected)
def test_report_state_newly_connected(self):
node_name = 'foo'
host = 'foo'
binary = 'bar'
daemon_ref = {'node_name': node_name,
daemon_ref = {'host': host,
'binary': binary,
'report_count': 0,
'id': 1}
service.db.__getattr__('report_state')
service.db.daemon_get_by_args(None,
node_name,
host,
binary).AndReturn(daemon_ref)
service.db.daemon_update(None, daemon_ref['id'],
mox.ContainsKeyValue('report_count', 1))
@@ -161,6 +161,6 @@ class ServiceTestCase(test.BaseTestCase):
self.mox.ReplayAll()
s = service.Service()
s.model_disconnected = True
rv = yield s.report_state(node_name, binary)
rv = yield s.report_state(host, binary)
self.assert_(not s.model_disconnected)