Skip to content

Commit

Permalink
Merge "fix matching on host-fqname while retrieving hostname from nov…
Browse files Browse the repository at this point in the history
…a obj" into R3.2
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Nov 30, 2017
2 parents 13b9bb3 + 54533ff commit bec5613
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fixtures/nova_test.py
Original file line number Diff line number Diff line change
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 bec5613

Please sign in to comment.