From 9a9f1439a87ed0810816a5a91b1017d6acf7facd Mon Sep 17 00:00:00 2001 From: Manuel Montecelo Date: Tue, 8 Jun 2021 18:42:58 +0200 Subject: [PATCH] TT#105151 Run installer under "eatmydata", unless disabled by parameter Run the installer under "eatmydata" to speed up the process. Also add some more information about timing. In some VMs that we install daily ({ce,pro,carrier}-trunk.mgm) we have the following timings: ce-runner, no eatmydata: 162 seconds, 2 mins 42 secs ce-runner, with eatmydata: 142 seconds, 2 mins 22 secs pro-runner, no eatmydata: 246 seconds, 4 mins 06 secs pro-runner, with eatmydata: 217 seconds, 3 mins 37 secs So in these machines, for CE we save about 20 seconds, which is not much in total but it's about 12.5% saving; and in Pro about 30 seconds (and twice, once per machine, so about a minute in total), which is about 12.2% as well. In Carrier, which is mostly equivalent to Pro in this respect and typically at least 8 machines, it would mean about 4 mins in total. When installing in hardware in previous days, maybe due to the disks being slower, the total installation time was slightly slower: pro-hardware (Lenovo ThinkSystem SR250), with eatmydata: 226 seconds, 3 mins 46 secs Installing without eatmydata was not measured yet in hardware, but given that the time to install is similar to the case of pro-runner, probably the performance gain is similar too. This looks like a relevant saving, the risk of things going wrong are minimal, so enable it by default. Change-Id: I8267fad08ff337c02801fb8fad0433d9b6d9f4c2 (cherry picked from commit d6b5097a8699f4ca278630a6b289285d573860ea) --- templates/scripts/includes/deployment.sh | 36 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index c8c17e4..bfa91bd 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -1271,6 +1271,7 @@ PRO_EDITION=false CE_EDITION=false CARRIER_EDITION=false NGCP_INSTALLER=false +EATMYDATA=true PUPPET='' PUPPET_SERVER=puppet.mgm.sipwise.com PUPPET_GIT_REPO='' @@ -1489,6 +1490,11 @@ if checkBootParam nongcp ; then NGCP_INSTALLER=false fi +if checkBootParam noeatmydata ; then + echo "Will NOT use 'eatmydata' when installing packages" + EATMYDATA=false +fi + # configure static network in installed system? if checkBootParam ngcpnw.dhcp || pgrep dhclient &>/dev/null ; then DHCP=true @@ -1639,6 +1645,7 @@ for param in "$@" ; do *nongcp*) NGCP_INSTALLER=false;; *noinstall*) NGCP_INSTALLER=false;; *ngcpinst*) NGCP_INSTALLER=true;; + *noeatmydata*) EATMYDATA=false;; *ngcphostname=*) TARGET_HOSTNAME="${param//ngcphostname=/}";; *ngcpeaddr=*) EADDR="${param//ngcpeaddr=/}";; *ngcpip1=*) IP1="${param//ngcpip1=/}";; @@ -1788,6 +1795,7 @@ echo " Install NW iface: $INSTALL_DEV Install IP: $INSTALL_IP Use DHCP in host: $DHCP + Use 'eatmydata': $EATMYDATA Installing in chassis? $CHASSIS @@ -1994,7 +2002,11 @@ DEBOPT_OPTIONS=("--no-merged-usr") # install only "Essential:yes" packages plus apt (explicitly included in minbase variant), # systemd + network related packages -DEBOPT_OPTIONS+=("--variant=minbase --include=systemd,systemd-sysv,init,isc-dhcp-client,ifupdown") +pkg_eatmydata="" +if "${EATMYDATA}"; then + pkg_eatmydata=",eatmydata" +fi +DEBOPT_OPTIONS+=("--variant=minbase --include=systemd,systemd-sysv,init,isc-dhcp-client,ifupdown${pkg_eatmydata}") # TT#61152 Add configuration Acquire::Retries=3, for apt to retry downloads DEBOPT_OPTIONS+=("--aptopt='Acquire::Retries=3'") @@ -2170,9 +2182,27 @@ if "$NGCP_INSTALLER" ; then echo "Generating ngcp-installer run script ..." cat > "${TARGET}/tmp/ngcp-installer-deployment.sh" << "EOT" #!/bin/bash -echo "Running ngcp-installer via grml-chroot." -ngcp-installer 2>&1 + +echo -n "Running ngcp-installer via grml-chroot, starting at: " +date +'%F %T %Z' +ngcp_installer_start=$(date +'%s') + +ngcp_installer_cmd="ngcp-installer" +if command -v eatmydata &>/dev/null; then + echo "Running ngcp-installer with 'eatmydata'" + ngcp_installer_cmd="eatmydata ${ngcp_installer_cmd}" +else + echo "Running ngcp-installer without 'eatmydata'" +fi +${ngcp_installer_cmd} 2>&1 RC=$? + +echo -n "Finishing ngcp-installer at: " +date +'%F %T %Z' +ngcp_installer_end=$(date +'%s') + +echo "ngcp-installer total run: $((ngcp_installer_end - ngcp_installer_start)) seconds" + if [ "${RC}" = "0" ]; then echo "OK, ngcp-installer finished successfully, continue netscript deployment." else