mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix master installer.
Sometimes, when we start a new instance, the file lock on "apt" is locked. Add a loop to the master installer. In addition, the "apt-get install" fails to register runsc in docker, so run the appropriate scripts to get that to happen. Also, add some helpful log messages. PiperOrigin-RevId: 296497357
This commit is contained in:
committed by
Copybara-Service
parent
a155a23480
commit
3733499952
@@ -43,6 +43,8 @@ from benchmarks.harness import machine_mocks
|
||||
from benchmarks.harness import ssh_connection
|
||||
from benchmarks.harness import tunnel_dispatcher
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Machine(object):
|
||||
"""The machine object is the primary object for benchmarks.
|
||||
@@ -236,9 +238,10 @@ class RemoteMachine(Machine):
|
||||
archive=archive, dir=harness.REMOTE_INSTALLERS_PATH))
|
||||
self._has_installers = True
|
||||
|
||||
# Execute the remote installer.
|
||||
self.run("sudo {dir}/{file}".format(
|
||||
dir=harness.REMOTE_INSTALLERS_PATH, file=installer))
|
||||
# Execute the remote installer.
|
||||
self.run("sudo {dir}/{file}".format(
|
||||
dir=harness.REMOTE_INSTALLERS_PATH, file=installer))
|
||||
|
||||
if results:
|
||||
results[index] = True
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
"""SSHConnection handles the details of SSH connections."""
|
||||
|
||||
|
||||
import logging
|
||||
import os
|
||||
import warnings
|
||||
|
||||
@@ -24,6 +24,8 @@ from benchmarks import harness
|
||||
# Get rid of paramiko Cryptography Warnings.
|
||||
warnings.filterwarnings(action="ignore", module=".*paramiko.*")
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def send_one_file(client: paramiko.SSHClient, path: str,
|
||||
remote_dir: str) -> str:
|
||||
@@ -94,10 +96,13 @@ class SSHConnection:
|
||||
The contents of stdout and stderr.
|
||||
"""
|
||||
with self._client() as client:
|
||||
log.info("running command: %s", cmd)
|
||||
_, stdout, stderr = client.exec_command(command=cmd)
|
||||
stdout.channel.recv_exit_status()
|
||||
log.info("returned status: %d", stdout.channel.recv_exit_status())
|
||||
stdout = stdout.read().decode("utf-8")
|
||||
stderr = stderr.read().decode("utf-8")
|
||||
log.info("stdout: %s", stdout)
|
||||
log.info("stderr: %s", stderr)
|
||||
return stdout, stderr
|
||||
|
||||
def send_workload(self, name: str) -> str:
|
||||
|
||||
@@ -15,6 +15,21 @@
|
||||
# limitations under the License.
|
||||
|
||||
# Install runsc from the master branch.
|
||||
set -e
|
||||
|
||||
curl -fsSL https://gvisor.dev/archive.key | sudo apt-key add -
|
||||
add-apt-repository "deb https://storage.googleapis.com/gvisor/releases release main"
|
||||
apt-get update && apt-get install -y runsc
|
||||
while true; do
|
||||
if apt-get update; then
|
||||
apt-get install -y runsc
|
||||
break
|
||||
fi
|
||||
result=$?
|
||||
# Check if apt update failed to aquire the file lock.
|
||||
if [[ $result -ne 100 ]]; then
|
||||
exit $result
|
||||
fi
|
||||
done
|
||||
runsc install
|
||||
service docker restart
|
||||
|
||||
|
||||
Reference in New Issue
Block a user