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

Side by Side Diff: lib/cros_vm_lib.sh

Issue 5988006: Add new script to stop a kvm using vm library and use in harness. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Fix docstring Created 10 years 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 | « bin/cros_stop_vm ('k') | 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 sudo kvm -m 1024 \ 79 sudo kvm -m 1024 \
80 -vga std \ 80 -vga std \
81 -pidfile "${KVM_PID_FILE}" \ 81 -pidfile "${KVM_PID_FILE}" \
82 -daemonize \ 82 -daemonize \
83 ${net_option} \ 83 ${net_option} \
84 ${nographics} \ 84 ${nographics} \
85 ${snapshot} \ 85 ${snapshot} \
86 -net user,hostfwd=tcp::${FLAGS_ssh_port}-:22 \ 86 -net user,hostfwd=tcp::${FLAGS_ssh_port}-:22 \
87 -hda "${1}" 87 -hda "${1}"
88 88
89 info "KVM started with pid stored in ${KVM_PID_FILE}"
89 LIVE_VM_IMAGE="${1}" 90 LIVE_VM_IMAGE="${1}"
90 fi 91 fi
91 } 92 }
92 93
93 # Checks to see if we can access the target virtual machine with ssh. 94 # Checks to see if we can access the target virtual machine with ssh.
94 function ssh_ping() { 95 function ssh_ping() {
95 "$(dirname $0)"/../ssh_test.sh \ 96 "$(dirname $0)"/../ssh_test.sh \
96 --ssh_port=${FLAGS_ssh_port} \ 97 --ssh_port=${FLAGS_ssh_port} \
97 --remote=127.0.0.1 >&2 98 --remote=127.0.0.1 >&2
98 } 99 }
(...skipping 25 matching lines...) Expand all
124 if [ -n "${pid}" ]; then 125 if [ -n "${pid}" ]; then
125 echo "Killing ${pid}" >&2 126 echo "Killing ${pid}" >&2
126 blocking_kill ${pid} 1 16 || blocking_kill 9 1 127 blocking_kill ${pid} 1 16 || blocking_kill 9 1
127 sudo rm "${KVM_PID_FILE}" 128 sudo rm "${KVM_PID_FILE}"
128 else 129 else
129 echo "No kvm pid found to stop." >&2 130 echo "No kvm pid found to stop." >&2
130 return 1 131 return 1
131 fi 132 fi
132 fi 133 fi
133 } 134 }
OLDNEW
« no previous file with comments | « bin/cros_stop_vm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698