Skip to content

Commit

Permalink
Merge "Updating ntp.conf file in Contrail VM launched in the ESXi Add…
Browse files Browse the repository at this point in the history
…ed changes for esx_ntp_server in testbed_multibox_example.py"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Dec 7, 2014
2 parents cc1a8f8 + 39191bd commit 1b21bd9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fabfile/tasks/esxi_prov.py
Expand Up @@ -318,6 +318,26 @@ def _install_contrailvm_pkg(self, ip, user, passwd, domain, server ,
sftp.put(pkg, "/tmp/contrail_pkg")
sftp.close()

#Set up ntp
ntp_cmd = ('ntpdate "%s"') %(self.ntp_server)
out, err = execute_cmd_out(ssh_session, ntp_cmd)
ntp_cmd = ('mv /etc/ntp.conf /etc/ntp.conf.orig')
out, err = execute_cmd_out(ssh_session, ntp_cmd)
ntp_cmd = ('touch /var/lib/ntp/drift')
out, err = execute_cmd_out(ssh_session, ntp_cmd)
ntp_cmd = ('echo "driftfile /var/lib/ntp/drift" >> /etc/ntp.conf')
out, err = execute_cmd_out(ssh_session, ntp_cmd)
ntp_cmd = ('echo "server %s" >> /etc/ntp.conf') % (self.ntp_server)
out, err = execute_cmd_out(ssh_session, ntp_cmd)
ntp_cmd = ('echo "restrict 127.0.0.1" >> /etc/ntp.conf')
out, err = execute_cmd_out(ssh_session, ntp_cmd)
ntp_cmd = ('echo "restrict -6 ::1" >> /etc/ntp.conf')
out, err = execute_cmd_out(ssh_session, ntp_cmd)
ntp_cmd = ('service ntp restart')
out, err = execute_cmd_out(ssh_session, ntp_cmd)

# end ntp setup

install_cmd = ("/usr/bin/dpkg -i %s") % ("/tmp/contrail_pkg")
out, err = execute_cmd_out(ssh_session, install_cmd)
setup_cmd = "/opt/contrail/contrail_packages/setup.sh"
Expand Down
1 change: 1 addition & 0 deletions fabfile/tasks/vmware.py
Expand Up @@ -126,6 +126,7 @@ def provision_esxi(deb, compute_vm_info):
vm_params['domain'] = _get_var(compute_vm_info['domain'])
vm_params['vm_password'] = _get_var(compute_vm_info['password'])
vm_params['vm_server'] = _get_var(compute_vm_info['esx_vm_name'])
vm_params['ntp_server'] = _get_var(compute_vm_info['esx_ntp_server'])
if deb is not None:
vm_params['vm_deb'] = deb
else:
Expand Down
2 changes: 2 additions & 0 deletions fabfile/testbeds/testbed_multibox_example.py
Expand Up @@ -346,6 +346,7 @@
# contrailvm_ip the contrailvm ip to be associated with the virtual mac
# esx_vm_name: the contrailvm name which is brought up on esxi
# esx_data_store: the datastore on esxi where the vmdk is copied to
# esx_ntp_server: the ntp server ip address to be used by the contrail vm
#example: 'esx_datastore' : "/vmfs/volumes/b3s40-ds1",
# esx_vmdk: the absolute path of the contrail-vmdk used to spawn vm
#OR
Expand All @@ -369,6 +370,7 @@
'contrailvm_ip': "1.1.1.2",
'esx_vm_name' : "ContrailVM-sumne1",
'esx_datastore' : "/vmfs/volumes/b3s40-ds1",
'esx_ntp_server' : "2.2.2.3",
'vmdk_download_path' : "http://127.0.0.1/vmware/vmdk/ContrailVM-disk1.vmdk",
'password' : 'c0ntrail123',
'domain' : 'englab.juniper.net',
Expand Down

0 comments on commit 1b21bd9

Please sign in to comment.