Skip to content

Commit

Permalink
fix matching on host-fqname while retrieving hostname
Browse files Browse the repository at this point in the history
from nova obj

Needed for RHOSP installation where nova services are registered with host-fqdn and contrail uses hostname
Closes-Bug: #1730492

Change-Id: I1a149eb083f17b7d9a39c8ad75bca6e47623ba07
  • Loading branch information
Senthilnathan Murugappan committed Nov 6, 2017
1 parent 52d9138 commit 54533ff
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fixtures/nova_test.py
Expand Up @@ -691,6 +691,15 @@ def get_vm_list(self, name_pattern='', project_id=None):

# end get_vm_list

def get_host_name(self, host_name):
for host in self.inputs.compute_names:
if host_name == host:
return host_name
if host in host_name.split('.'):
return host
else:
return host_name

def get_nova_host_of_vm(self, vm_obj):
if 'OS-EXT-SRV-ATTR:hypervisor_hostname' not in vm_obj.__dict__:
vm_obj = self.admin_obj.get_vm_by_id(vm_obj.id)
Expand All @@ -701,7 +710,7 @@ def get_nova_host_of_vm(self, vm_obj):
if hypervisor.hypervisor_type == 'QEMU' or \
hypervisor.hypervisor_type == 'docker':
host_name = vm_obj.__dict__['OS-EXT-SRV-ATTR:host']
return host_name
return self.get_host_name(host_name)
if 'VMware' in hypervisor.hypervisor_type:
host_name = vcenter_libs.get_contrail_vm_by_vm_uuid(self.inputs,vm_obj.id)
return host_name
Expand Down

0 comments on commit 54533ff

Please sign in to comment.