diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-01-25 18:15:45 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-01-25 18:15:45 +0100 |
commit | f715d3b12eb7794040b43dae3b0ee54f1fe5950d (patch) | |
tree | 7a5409e31c29758f3f85413cea28e87e96e6d836 | |
parent | 0b0595f23d7c16403ab0633dd2018da22afdd822 (diff) | |
download | vmexec-f715d3b12eb7794040b43dae3b0ee54f1fe5950d.tar.gz vmexec-f715d3b12eb7794040b43dae3b0ee54f1fe5950d.tar.xz vmexec-f715d3b12eb7794040b43dae3b0ee54f1fe5950d.zip |
vmexec: Added missing options.
-rwxr-xr-x | vmexec | 87 |
1 files changed, 86 insertions, 1 deletions
@@ -38,6 +38,7 @@ class VMExecOpts @options.cmds = [] @options.disk = String.new + # default values @options.port = 2222 @options.user = Etc.getlogin @options.pwd = String.new @@ -45,6 +46,18 @@ class VMExecOpts @options.smp = 1 @options.cpu = "core2duo" @options.net = "virtio" + @options.blk = "virtio" + @options.snp = false + @options.args = [] + + @options.wait = 20 + @options.startup_timeout = 300 + @options.shutdown_timeout = 120 + @options.retires = 0 + + @options.log = String.new + @options.base = String.new + @options.opensolaris = false @options.freebsd = false @options.windows = false @@ -93,7 +106,7 @@ class VMExecOpts @options.user = user end - opts.on("-u", "--password <PASSWORD>", String, + opts.on("-p", "--password <PASSWORD>", String, "The password of the account to log into in the guest. This is only", "for Windows!.") do |passwd| @options.pwd = passwd @@ -129,6 +142,78 @@ class VMExecOpts @options.net = net end + opts.on("--blk=NAME", String, + "Block device to emulate. The default is #{@options.blk}.") do |blk| + @options.blk = blk + end + + opts.on("--snapshot", + "Write to temporary files instead of disk image files. This", + "is useful if want to test always from the same state") do |snapshot| + @options.snp = snapshot + end + + opts.on("--kvm-args=OPT", String, + "Pass additional option OPT to kvm. Specify multiple times", + "to pass more than one option. For example", + "vmexec --kvm-args=-cdrom mycd.iso ...") do |kargs| + @options.args = kargs.split + end + + opts.on("--wait=SECS", Integer, + "How long should we wait before starting to poll the guest", + "ssh or telnet port for it to be up.", + "Default #{@options.wait}.") do |wait| + @options.wait = wait + end + + opts.on("--startup-timeout=SECS", Integer, + "Wait at most this many seconds for the guest OS to respond", + "to ssh. If this time is exceeded assume it has failed to", + "boot correctly. Default #{@options.startup_timeout}.") do |wait| + @options.startup_timeout = wait + end + + opts.on("--shutdown-timeout=SECS", Integer, + "Wait at most this many seconds for the guest OS to", + "shutdown gracefully after sending a shutdown command. If", + "this time is exceeded, assume the guest has failed to", + "shutdown gracefully and kill it forcibly.", + "Default #{@options.shutdown_timeout}.") do |wait| + @options.shutdown_timeout = wait + end + + opts.on("--retries=N", Integer, + "If the guest fails to come up, retry the boot this many", + "times before giving up. This helps if the virtual machine", + "sometimes crashes during boot. Default #{@options.retries}.") do |ret| + @options.retries = ret + end + + opts.on("-l", "--logfile=FILE", String, + "File to redirect the output from kvm into. This includes", + "any (error) messages from kvm, and also includes anything", + "the guest writes to the kvm emulated serial port (it can", + "be useful to set the guest to send boot loader and kernel", + "messages to the serial console and log them with this", + "option). Default is to not log this output anywhere.") do |log| + @options.log = log + end + + opts.on("-b", "--base-img=IMG", String, + "Instead of booting an existing image, create a new", + "copy-on-write image based on IMG. This uses the -b option", + "of qemu-img(1). IMG is not modified in any way. This way,", + "the booted image can be discarded after use, so that each", + "use of IMG is using the same reference image with no risk", + "of 'polution' between different invocations.", + "Note that this DELETES any existing image of the same", + "name as the one specified on the command line to boot! It", + "will be replaced with the image created as a copy of IMG,", + "with any modifications done during the runvm session.") do |base| + @options.base = base + end + # Boolean switches. opts.on("--linux", "This is a Linux VM (default)") do |b| @options.opensolaris = b |