Skip to content

Commit

Permalink
Merge "code is added to choose the harware version based on the esxi …
Browse files Browse the repository at this point in the history
…os server."
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 11, 2016
2 parents 8c2f586 + 95deb0e commit af80e54
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fabfile/tasks/vcenter_prov.py
Expand Up @@ -170,7 +170,7 @@ def add_sr_iov_nics(self, si, esxi_info, host, dv_port_name, vm_name):
if out.failed:
raise Exception("Unable to add sriov interface for physical nic %s on esxi host %s" %(sr_iov_nic, ip))
esxi_version_info = str(out)
esxi_version = esxi_version_info.split()[2]
esxi_version = esxi_version_info.split()[2][:3]
cmd = "vmkchdev -l | grep %s" %sr_iov_nic
out = run(cmd)
if out.failed:
Expand All @@ -179,7 +179,7 @@ def add_sr_iov_nics(self, si, esxi_info, host, dv_port_name, vm_name):
if len(nic_info) == 0:
raise Exception("Unable to add sriov interface for physical nic %s on esxi host %s" %(sr_iov_nic, ip))
pci_id = nic_info.split()[0]
if (esxi_version == '5.5.0'):
if (esxi_version == '5.5'):
pci_id = pci_id[5:]
devices = []
nicspec = self.pyVmomi.vim.vm.device.VirtualDeviceSpec()
Expand Down
14 changes: 14 additions & 0 deletions fabfile/tasks/vmware.py
Expand Up @@ -65,6 +65,19 @@ def create_vmx (esxi_host, vm_name):
vm_mac = esxi_host['contrail_vm']['mac']
assert vm_mac, "MAC address for contrail-compute-vm must be specified"

cmd = "vmware -v"
out = run(cmd)
if out.failed:
raise Exception("Unable to get the vmware version")
esxi_version_info = str(out)
esxi_version = esxi_version_info.split()[2][:3]
if (esxi_version == '5.5'):
hw_version = 10
elif (esxi_version == '6.0'):
hw_version = 11
else:
hw_version = 9

if mode is 'vcenter':
eth0_type = "vmxnet3"
ext_params = compute_vmx_template.vcenter_ext_template
Expand All @@ -77,6 +90,7 @@ def create_vmx (esxi_host, vm_name):
ext_params += data_intf

template_vals = { '__vm_name__' : vm_name,
'__hw_version__' : hw_version,
'__vm_mac__' : vm_mac,
'__fab_pg__' : fab_pg,
'__eth0_type__' : eth0_type,
Expand Down
2 changes: 1 addition & 1 deletion fabfile/templates/compute_vmx_template.py
Expand Up @@ -3,7 +3,7 @@
template = string.Template(
'''.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "10"
virtualHW.version = "$__hw_version__"
vmci0.present = "TRUE"
hpet0.present = "TRUE"
nvram = "$__vm_name__.nvram"
Expand Down

0 comments on commit af80e54

Please sign in to comment.