Use hostname of machine for ``binding_host_id``
The current implementation relies on DNS to resolve the hostname associated with the ``private-address`` IP of the unit. This does not always provide a reliable result. Change-Id: I3a3a3cddd35354944196a155ca0b239e680333d3 Closes-Bug: #1823000
This commit is contained in:
parent
a7cd44e9b5
commit
d011c6b1eb
|
@ -22,6 +22,7 @@
|
|||
# port.
|
||||
|
||||
import neutronclient
|
||||
import socket
|
||||
import subprocess
|
||||
|
||||
from keystoneauth1 import identity as keystone_identity
|
||||
|
@ -33,7 +34,6 @@ from novaclient import client as nova_client
|
|||
import charm.openstack.octavia as octavia # for constants
|
||||
|
||||
import charmhelpers.core as ch_core
|
||||
import charmhelpers.contrib.network.ip as ch_net_ip
|
||||
|
||||
|
||||
NEUTRON_TEMP_EXCS = (keystone_exceptions.catalog.EndpointNotFound,
|
||||
|
@ -212,8 +212,7 @@ def get_hm_port(identity_service, local_unit_name, local_unit_address):
|
|||
# avoid race with OVS agent attempting to bind port
|
||||
# before it is created in the local units OVSDB
|
||||
'admin_state_up': False,
|
||||
'binding:host_id': ch_net_ip.get_hostname(
|
||||
local_unit_address, fqdn=False),
|
||||
'binding:host_id': socket.gethostname(),
|
||||
'device_owner': 'Octavia:health-mgr',
|
||||
'security_groups': [
|
||||
health_secgrp['id'],
|
||||
|
|
|
@ -134,7 +134,8 @@ class TestAPICrud(test_utils.PatchHelper):
|
|||
health_secgrp_uuid = 'fake-secgrp-uuid'
|
||||
nc.list_security_groups.return_value = {
|
||||
'security_groups': [{'id': health_secgrp_uuid}]}
|
||||
self.patch_object(api_crud.ch_net_ip, 'get_hostname')
|
||||
self.patch_object(api_crud.socket, 'gethostname')
|
||||
self.gethostname.return_value = 'fakehostname'
|
||||
port_uuid = 'fake-port-uuid'
|
||||
port_mac_address = 'fake-mac-address'
|
||||
nc.create_port.return_value = {
|
||||
|
@ -155,7 +156,7 @@ class TestAPICrud(test_utils.PatchHelper):
|
|||
{
|
||||
'port': {
|
||||
'admin_state_up': False,
|
||||
'binding:host_id': self.get_hostname(),
|
||||
'binding:host_id': 'fakehostname',
|
||||
'device_owner': 'Octavia:health-mgr',
|
||||
'security_groups': ['fake-secgrp-uuid'],
|
||||
'name': 'octavia-health-manager-'
|
||||
|
|
Loading…
Reference in New Issue