rename node_name to host
This commit is contained in:
		@@ -230,7 +230,7 @@ class CloudController(object):
 | 
				
			|||||||
        # instance_id is passed in as a list of instances
 | 
					        # instance_id is passed in as a list of instances
 | 
				
			||||||
        instance_ref = db.instance_get_by_str(context, instance_id[0])
 | 
					        instance_ref = db.instance_get_by_str(context, instance_id[0])
 | 
				
			||||||
        return rpc.call('%s.%s' % (FLAGS.compute_topic,
 | 
					        return rpc.call('%s.%s' % (FLAGS.compute_topic,
 | 
				
			||||||
                                   instance_ref['node_name']),
 | 
					                                   instance_ref['host']),
 | 
				
			||||||
                        {"method": "get_console_output",
 | 
					                        {"method": "get_console_output",
 | 
				
			||||||
                         "args": {"context": None,
 | 
					                         "args": {"context": None,
 | 
				
			||||||
                                  "instance_id": instance_ref['id']}})
 | 
					                                  "instance_id": instance_ref['id']}})
 | 
				
			||||||
@@ -257,7 +257,7 @@ class CloudController(object):
 | 
				
			|||||||
            v['status'] = '%s (%s, %s, %s, %s)' % (
 | 
					            v['status'] = '%s (%s, %s, %s, %s)' % (
 | 
				
			||||||
                volume['status'],
 | 
					                volume['status'],
 | 
				
			||||||
                volume['user_id'],
 | 
					                volume['user_id'],
 | 
				
			||||||
                'node_name',
 | 
					                'host',
 | 
				
			||||||
                volume['instance_id'],
 | 
					                volume['instance_id'],
 | 
				
			||||||
                volume['mountpoint'])
 | 
					                volume['mountpoint'])
 | 
				
			||||||
        if volume['attach_status'] == 'attached':
 | 
					        if volume['attach_status'] == 'attached':
 | 
				
			||||||
@@ -391,7 +391,7 @@ class CloudController(object):
 | 
				
			|||||||
            if context.user.is_admin():
 | 
					            if context.user.is_admin():
 | 
				
			||||||
                i['key_name'] = '%s (%s, %s)' % (i['key_name'],
 | 
					                i['key_name'] = '%s (%s, %s)' % (i['key_name'],
 | 
				
			||||||
                    instance.project_id,
 | 
					                    instance.project_id,
 | 
				
			||||||
                    'node_name') # FIXME
 | 
					                    'host') # FIXME
 | 
				
			||||||
            i['product_codes_set'] = self._convert_to_set([], 'product_codes')
 | 
					            i['product_codes_set'] = self._convert_to_set([], 'product_codes')
 | 
				
			||||||
            i['instance_type'] = instance.instance_type
 | 
					            i['instance_type'] = instance.instance_type
 | 
				
			||||||
            i['launch_time'] = instance.created_at
 | 
					            i['launch_time'] = instance.created_at
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -206,7 +206,7 @@ DEFINE_integer('auth_token_ttl', 3600, 'Seconds for auth tokens to linger')
 | 
				
			|||||||
# UNUSED
 | 
					# UNUSED
 | 
				
			||||||
DEFINE_string('node_availability_zone', 'nova',
 | 
					DEFINE_string('node_availability_zone', 'nova',
 | 
				
			||||||
              'availability zone of this node')
 | 
					              'availability zone of this node')
 | 
				
			||||||
DEFINE_string('node_name', socket.gethostname(),
 | 
					DEFINE_string('host', socket.gethostname(),
 | 
				
			||||||
              'name of this node')
 | 
					              'name of this node')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEFINE_string('sql_connection',
 | 
					DEFINE_string('sql_connection',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -108,14 +108,14 @@ class ModelTestCase(test.TrialTestCase):
 | 
				
			|||||||
        self.assertEqual(x.identifier, 'i-test')
 | 
					        self.assertEqual(x.identifier, 'i-test')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_instance_associates_node(self):
 | 
					    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()
 | 
					        instance = self.create_instance()
 | 
				
			||||||
        found = False
 | 
					        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':
 | 
					            if x.identifier == 'i-test':
 | 
				
			||||||
                found = True
 | 
					                found = True
 | 
				
			||||||
        self.assertFalse(found)
 | 
					        self.assertFalse(found)
 | 
				
			||||||
        instance['node_name'] = 'test_node'
 | 
					        instance['host'] = 'test_node'
 | 
				
			||||||
        instance.save()
 | 
					        instance.save()
 | 
				
			||||||
        for x in model.InstanceDirectory().by_node('test_node'):
 | 
					        for x in model.InstanceDirectory().by_node('test_node'):
 | 
				
			||||||
            if x.identifier == 'i-test':
 | 
					            if x.identifier == 'i-test':
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,7 +91,7 @@ class NetworkTestCase(test.TrialTestCase):
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            db.floating_ip_get_by_address(None, ip_str)
 | 
					            db.floating_ip_get_by_address(None, ip_str)
 | 
				
			||||||
        except exception.NotFound:
 | 
					        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,
 | 
					        float_addr = self.network.allocate_floating_ip(self.context,
 | 
				
			||||||
                                                       self.projects[0].id)
 | 
					                                                       self.projects[0].id)
 | 
				
			||||||
        fix_addr = self._create_address(0)
 | 
					        fix_addr = self._create_address(0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ class ServiceTestCase(test.BaseTestCase):
 | 
				
			|||||||
                                    rpc.AdapterConsumer)
 | 
					                                    rpc.AdapterConsumer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rpc.AdapterConsumer(connection=mox.IgnoreArg(),
 | 
					        rpc.AdapterConsumer(connection=mox.IgnoreArg(),
 | 
				
			||||||
                            topic='fake.%s' % FLAGS.node_name,
 | 
					                            topic='fake.%s' % FLAGS.host,
 | 
				
			||||||
                            proxy=mox.IsA(service.Service)).AndReturn(
 | 
					                            proxy=mox.IsA(service.Service)).AndReturn(
 | 
				
			||||||
                                    rpc.AdapterConsumer)
 | 
					                                    rpc.AdapterConsumer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -82,37 +82,37 @@ class ServiceTestCase(test.BaseTestCase):
 | 
				
			|||||||
    # 'model_disconnected' and report_state doesn't really do much so this
 | 
					    # 'model_disconnected' and report_state doesn't really do much so this
 | 
				
			||||||
    # these are mostly just for coverage
 | 
					    # these are mostly just for coverage
 | 
				
			||||||
    def test_report_state(self):
 | 
					    def test_report_state(self):
 | 
				
			||||||
        node_name = 'foo'
 | 
					        host = 'foo'
 | 
				
			||||||
        binary = 'bar'
 | 
					        binary = 'bar'
 | 
				
			||||||
        daemon_ref = {'node_name': node_name,
 | 
					        daemon_ref = {'host': host,
 | 
				
			||||||
                      'binary': binary,
 | 
					                      'binary': binary,
 | 
				
			||||||
                      'report_count': 0,
 | 
					                      'report_count': 0,
 | 
				
			||||||
                      'id': 1}
 | 
					                      'id': 1}
 | 
				
			||||||
        service.db.__getattr__('report_state')
 | 
					        service.db.__getattr__('report_state')
 | 
				
			||||||
        service.db.daemon_get_by_args(None,
 | 
					        service.db.daemon_get_by_args(None,
 | 
				
			||||||
                                      node_name,
 | 
					                                      host,
 | 
				
			||||||
                                      binary).AndReturn(daemon_ref)
 | 
					                                      binary).AndReturn(daemon_ref)
 | 
				
			||||||
        service.db.daemon_update(None, daemon_ref['id'],
 | 
					        service.db.daemon_update(None, daemon_ref['id'],
 | 
				
			||||||
                                 mox.ContainsKeyValue('report_count', 1))
 | 
					                                 mox.ContainsKeyValue('report_count', 1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.mox.ReplayAll()
 | 
					        self.mox.ReplayAll()
 | 
				
			||||||
        s = service.Service()
 | 
					        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):
 | 
					    def test_report_state_no_daemon(self):
 | 
				
			||||||
        node_name = 'foo'
 | 
					        host = 'foo'
 | 
				
			||||||
        binary = 'bar'
 | 
					        binary = 'bar'
 | 
				
			||||||
        daemon_create = {'node_name': node_name,
 | 
					        daemon_create = {'host': host,
 | 
				
			||||||
                      'binary': binary,
 | 
					                      'binary': binary,
 | 
				
			||||||
                      'report_count': 0}
 | 
					                      'report_count': 0}
 | 
				
			||||||
        daemon_ref = {'node_name': node_name,
 | 
					        daemon_ref = {'host': host,
 | 
				
			||||||
                      'binary': binary,
 | 
					                      'binary': binary,
 | 
				
			||||||
                      'report_count': 0,
 | 
					                      'report_count': 0,
 | 
				
			||||||
                      'id': 1}
 | 
					                      'id': 1}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        service.db.__getattr__('report_state')
 | 
					        service.db.__getattr__('report_state')
 | 
				
			||||||
        service.db.daemon_get_by_args(None,
 | 
					        service.db.daemon_get_by_args(None,
 | 
				
			||||||
                                      node_name,
 | 
					                                      host,
 | 
				
			||||||
                                      binary).AndRaise(exception.NotFound())
 | 
					                                      binary).AndRaise(exception.NotFound())
 | 
				
			||||||
        service.db.daemon_create(None,
 | 
					        service.db.daemon_create(None,
 | 
				
			||||||
                                 daemon_create).AndReturn(daemon_ref['id'])
 | 
					                                 daemon_create).AndReturn(daemon_ref['id'])
 | 
				
			||||||
@@ -122,38 +122,38 @@ class ServiceTestCase(test.BaseTestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self.mox.ReplayAll()
 | 
					        self.mox.ReplayAll()
 | 
				
			||||||
        s = service.Service()
 | 
					        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):
 | 
					    def test_report_state_newly_disconnected(self):
 | 
				
			||||||
        node_name = 'foo'
 | 
					        host = 'foo'
 | 
				
			||||||
        binary = 'bar'
 | 
					        binary = 'bar'
 | 
				
			||||||
        daemon_ref = {'node_name': node_name,
 | 
					        daemon_ref = {'host': host,
 | 
				
			||||||
                      'binary': binary,
 | 
					                      'binary': binary,
 | 
				
			||||||
                      'report_count': 0,
 | 
					                      'report_count': 0,
 | 
				
			||||||
                      'id': 1}
 | 
					                      'id': 1}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        service.db.__getattr__('report_state')
 | 
					        service.db.__getattr__('report_state')
 | 
				
			||||||
        service.db.daemon_get_by_args(None,
 | 
					        service.db.daemon_get_by_args(None,
 | 
				
			||||||
                                      node_name,
 | 
					                                      host,
 | 
				
			||||||
                                      binary).AndRaise(Exception())
 | 
					                                      binary).AndRaise(Exception())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.mox.ReplayAll()
 | 
					        self.mox.ReplayAll()
 | 
				
			||||||
        s = service.Service()
 | 
					        s = service.Service()
 | 
				
			||||||
        rv = yield s.report_state(node_name, binary)
 | 
					        rv = yield s.report_state(host, binary)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assert_(s.model_disconnected)
 | 
					        self.assert_(s.model_disconnected)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_report_state_newly_connected(self):
 | 
					    def test_report_state_newly_connected(self):
 | 
				
			||||||
        node_name = 'foo'
 | 
					        host = 'foo'
 | 
				
			||||||
        binary = 'bar'
 | 
					        binary = 'bar'
 | 
				
			||||||
        daemon_ref = {'node_name': node_name,
 | 
					        daemon_ref = {'host': host,
 | 
				
			||||||
                      'binary': binary,
 | 
					                      'binary': binary,
 | 
				
			||||||
                      'report_count': 0,
 | 
					                      'report_count': 0,
 | 
				
			||||||
                      'id': 1}
 | 
					                      'id': 1}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        service.db.__getattr__('report_state')
 | 
					        service.db.__getattr__('report_state')
 | 
				
			||||||
        service.db.daemon_get_by_args(None,
 | 
					        service.db.daemon_get_by_args(None,
 | 
				
			||||||
                                      node_name,
 | 
					                                      host,
 | 
				
			||||||
                                      binary).AndReturn(daemon_ref)
 | 
					                                      binary).AndReturn(daemon_ref)
 | 
				
			||||||
        service.db.daemon_update(None, daemon_ref['id'],
 | 
					        service.db.daemon_update(None, daemon_ref['id'],
 | 
				
			||||||
                                 mox.ContainsKeyValue('report_count', 1))
 | 
					                                 mox.ContainsKeyValue('report_count', 1))
 | 
				
			||||||
@@ -161,6 +161,6 @@ class ServiceTestCase(test.BaseTestCase):
 | 
				
			|||||||
        self.mox.ReplayAll()
 | 
					        self.mox.ReplayAll()
 | 
				
			||||||
        s = service.Service()
 | 
					        s = service.Service()
 | 
				
			||||||
        s.model_disconnected = True
 | 
					        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)
 | 
					        self.assert_(not s.model_disconnected)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user