summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-09-26 09:58:46 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-09-26 09:58:46 +0100
commit3c7b3634b2c86a4c41fec044ccb59a1fe3224e66 (patch)
tree086ada16b045bb61450ac44b84c712a180c44064 /src
parent67030c6ef2b89ab98ed30d2ddc8a180c28395312 (diff)
downloadlibguestfs-3c7b3634b2c86a4c41fec044ccb59a1fe3224e66.tar.gz
libguestfs-3c7b3634b2c86a4c41fec044ccb59a1fe3224e66.tar.xz
libguestfs-3c7b3634b2c86a4c41fec044ccb59a1fe3224e66.zip
docs: Show how to use a qemu wrapper to edit the qemu command line.
Diffstat (limited to 'src')
-rw-r--r--src/guestfs.pod23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/guestfs.pod b/src/guestfs.pod
index 7ff313d1..7580498b 100644
--- a/src/guestfs.pod
+++ b/src/guestfs.pod
@@ -952,6 +952,29 @@ For example:
Note that libguestfs also calls qemu with the -help and -version
options in order to determine features.
+Wrappers can also be used to edit the options passed to qemu. In the
+following example, the C<-machine ...> option (C<-machine> and the
+following argument) are removed from the command line and replaced
+with C<-machine pc,accel=tcg>. The while loop iterates over the
+options until it finds the right one to remove, putting the remaining
+options into the C<args> array.
+
+ #!/bin/bash -
+
+ i=0
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ -machine)
+ shift 2;;
+ *)
+ args[i]="$1"
+ (( i++ ))
+ shift ;;
+ esac
+ done
+
+ exec qemu-kvm -machine pc,accel=tcg "${args[@]}"
+
=head2 ATTACHING TO RUNNING DAEMONS
I<Note (1):> This is B<highly experimental> and has a tendency to eat