Copy lib, config directories only once per run and node

With this patch, we keep track whether we have updated the config and
lib directories on the target node for this st.py run already. If so,
we leave these directories alone.

Change-Id: Ie79cf083361d5f818dd42085fabe5b9d975112d7
This commit is contained in:
Roger Luethi 2017-07-02 13:58:33 +02:00
parent bb26a284be
commit f7fb90ef05
2 changed files with 10 additions and 2 deletions

View File

@ -196,6 +196,8 @@ class VMconfig(object):
self._ssh_port = None
self.http_port = None
self.get_config_from_file()
# Did this run already update VM's config, lib directories?
self.updated = False
self.pxe_tmp_ip = None
if provider == "virtualbox":
# TODO is IPaddress class worth using?

View File

@ -61,8 +61,12 @@ def ssh_process_autostart(vm_name):
logger.info(" Connected to ssh server.")
sys.stdout.flush()
ssh.vm_ssh(vm_name, "rm -rf osbash lib config autostart")
ssh.vm_scp_to_vm(vm_name, conf.lib_dir, conf.config_dir)
if conf.vm[vm_name].updated:
ssh.vm_ssh(vm_name, "rm -rf autostart")
else:
logging.debug("Updating config, lib directories for VM %s.", vm_name)
ssh.vm_ssh(vm_name, "rm -rf autostart config lib")
ssh.vm_scp_to_vm(vm_name, conf.config_dir, conf.lib_dir)
for script_path in sorted(glob(join(conf.autostart_dir, "*.sh"))):
ssh_exec_script(vm_name, script_path)
@ -138,6 +142,8 @@ def autostart_and_wait(vm_name):
logger.exception("ssh_process_autostart")
raise
# ssh_process_autostart has updated the directories
conf.vm[vm_name].updated = True
wait_for_autofiles()
if not conf.wbatch: