[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen-unstable] Fix to eject cdrom on HVM Domain



commit 2836e73adcd994de071f4eec1aa538a5ca849118
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Fri Sep 4 16:19:54 2009 +0100

    Fix to eject cdrom on HVM Domain
    
    We tried to eject cdrom(/dev/hdc) on HVM Domain.
    But, cdrom media are not ejected from the cdrom device on HostOS.
    
    The module to eject the cdrom device has already been implemented in
    qemu-dm.
     But, all devices are opened as raw device for VBD.
    Therefore, the module to eject the cdrom device is not work.
    
    The cdrom device was corrected to open as a physical device on HostOS.
    When eject is executed on HVM Domain, cdrom media are ejected from the
    cdrom device on HostOS.
    
    This patch corrected the problem.
    Signed-off-by: Takanori Kasai <kasai.takanori@xxxxxxxxxxxxxx>
---
 xenstore.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/xenstore.c b/xenstore.c
index aee96f0..bdc25c3 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -107,7 +107,14 @@ static void insert_media(void *opaque)
     for (i = 0; i < MAX_DRIVES + 1; i++) {
         bs = drives_table[i].bdrv;
         if (media_filename[i] && bs && bs->filename[0] == '\0') {
-            bdrv_open2(bs, media_filename[i], 0, &bdrv_raw);
+            BlockDriver *format;
+            if ( strstart(media_filename[i], "/dev/cd", NULL) 
+              || strstart(media_filename[i], "/dev/scd", NULL)) 
+                format = &bdrv_host_device;
+            else 
+                format = &bdrv_raw;
+
+            bdrv_open2(bs, media_filename[i], 0, format);
             pstrcpy(bs->filename, sizeof(bs->filename), media_filename[i]);
             free(media_filename[i]);
             media_filename[i] = NULL;
@@ -533,7 +540,11 @@ void xenstore_parse_domain_config(int hvm_domid)
                } else if (!strcmp(drv,"file")) {
                    format = &bdrv_raw;
                } else if (!strcmp(drv,"phy")) {
-                   format = &bdrv_raw;
+                    if (strstart(params, "/dev/cd", NULL) 
+                     || strstart(params, "/dev/scd", NULL)) 
+                        format = &bdrv_host_device;
+                    else
+                        format = &bdrv_raw;
                } else {
                    format = bdrv_find_format(drv);
                    if (!format) {
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.