Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: lib/cros_vm_lib.sh

Issue 6750012: Fix vm lib to work both in/out chroot. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Fix sp Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 # 4 #
5 # Common vm functions for use in crosutils. 5 # Common vm functions for use in crosutils.
6 6
7 DEFINE_string kvm_pid "" \ 7 DEFINE_string kvm_pid "" \
8 "Use this pid file. If it exists and is set, use the vm specified by pid." 8 "Use this pid file. If it exists and is set, use the vm specified by pid."
9 DEFINE_boolean no_graphics ${FLAGS_FALSE} "Runs the KVM instance silently." 9 DEFINE_boolean no_graphics ${FLAGS_FALSE} "Runs the KVM instance silently."
10 DEFINE_boolean persist "${FLAGS_FALSE}" "Persist vm." 10 DEFINE_boolean persist "${FLAGS_FALSE}" "Persist vm."
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 -net user,hostfwd=tcp::${FLAGS_ssh_port}-:22 \ 84 -net user,hostfwd=tcp::${FLAGS_ssh_port}-:22 \
85 -hda "${1}" 85 -hda "${1}"
86 86
87 info "KVM started with pid stored in ${KVM_PID_FILE}" 87 info "KVM started with pid stored in ${KVM_PID_FILE}"
88 LIVE_VM_IMAGE="${1}" 88 LIVE_VM_IMAGE="${1}"
89 fi 89 fi
90 } 90 }
91 91
92 # Checks to see if we can access the target virtual machine with ssh. 92 # Checks to see if we can access the target virtual machine with ssh.
93 function ssh_ping() { 93 function ssh_ping() {
94 "${SCRIPT_ROOT}/ssh_test.sh" \ 94 # TODO(sosa): Remove outside chroot use once all callers work inside chroot.
95 local cmd
96 if [ $INSIDE_CHROOT -ne 1 ]; then
97 cmd="${GCLIENT_ROOT}/src/scripts/ssh_test.sh"
98 else
99 cmd=/usr/lib/crosutils/ssh_test.sh
100 fi
101 "${cmd}" \
95 --ssh_port=${FLAGS_ssh_port} \ 102 --ssh_port=${FLAGS_ssh_port} \
96 --remote=127.0.0.1 >&2 103 --remote=127.0.0.1 >&2
97 } 104 }
98 105
99 # Tries to ssh into live image $1 times. After first failure, a try involves 106 # Tries to ssh into live image $1 times. After first failure, a try involves
100 # shutting down and restarting kvm. 107 # shutting down and restarting kvm.
101 function retry_until_ssh() { 108 function retry_until_ssh() {
102 local can_ssh_into=1 109 local can_ssh_into=1
103 local max_retries=3 110 local max_retries=3
104 local retries=0 111 local retries=0
(...skipping 19 matching lines...) Expand all
124 if [ -n "${pid}" ]; then 131 if [ -n "${pid}" ]; then
125 echo "Killing ${pid}" >&2 132 echo "Killing ${pid}" >&2
126 blocking_kill ${pid} 1 16 || blocking_kill 9 1 133 blocking_kill ${pid} 1 16 || blocking_kill 9 1
127 sudo rm "${KVM_PID_FILE}" 134 sudo rm "${KVM_PID_FILE}"
128 else 135 else
129 echo "No kvm pid found to stop." >&2 136 echo "No kvm pid found to stop." >&2
130 return 1 137 return 1
131 fi 138 fi
132 fi 139 fi
133 } 140 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698