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