]> xenbits.xen.org Git - xenclient/toolstack.git/commitdiff
Passing the bsg device to qemu if we find any cdrom drive.:wq
authorAlexandre Bique <alexandre.bique@citrix.com>
Tue, 4 Aug 2009 11:50:06 +0000 (11:50 +0000)
committerAndrew McNeil <andrewmcn@bob.uk.xensource.com>
Thu, 3 Sep 2009 16:36:41 +0000 (17:36 +0100)
scripts/qemu-dm-wrapper

index f80a32a2c6a5151b18644f3dafacee49de5d798a..c947f4c9bbb149633bb7ced4fbec1fa1c29bef41 100755 (executable)
@@ -23,7 +23,18 @@ export QEMU_ALSA_VOL_CTRL=vm-${ALSA_VMID}
 
 name="qemu-$DOMID"
 
+# let's find the bsg device if there is one.
+{
+    BSG_DEVICE=/dev/bsg/$(grep -B2 CD-ROM /proc/scsi/scsi | head -n 1 | sed -e 's/^.*scsi\([0-9]\).* \([0-9]\+\) .* \([0-9]\+\) .* \([0-9]\+\)/\1:\2:\3:\4/g' -e 's/0\([0-9]\)/\1/g')
+    if [[ -c $BSG_DEVICE ]]; then
+        CDROM_PT_ARG="-cdrom-pt $BSG_DEVICE"
+    else
+        CDROM_PT_ARG=""
+    fi
+} >/dev/null 2>&1
+
+
 logger -t $name "Using domid: $DOMID"
-logger -t $name "Arguments: $*"
+logger -t $name "Arguments: $* $CDROM_PT_ARG"
 xenstore-write /local/domain/$DOMID/qemu-pid $$
-exec /usr/lib/xen/bin/qemu-dm -name qemu-$DOMID $*
+exec /usr/lib/xen/bin/qemu-dm -name qemu-$DOMID $* $CDROM_PT_ARG