Skip to content

Commit

Permalink
Updating ntp.conf file in Contrail VM launched in the ESXi
Browse files Browse the repository at this point in the history
Added changes for esx_ntp_server in testbed_multibox_example.py

Change-Id: Ibc74315c59efcc4d8fdd3052d63ed53dcfc948ad
  • Loading branch information
a committed Dec 6, 2014
1 parent 0a928ea commit 39191bd
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 39191bd

Please sign in to comment.