WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [Xen-changelog] If the 'cdrom=' option is specified in t

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: [Xen-changelog] If the 'cdrom=' option is specified in the definition file but media is
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Mon, 10 Apr 2006 13:29:13 -0500
Cc: Ross Maxfield <rmaxfiel@xxxxxxxxxx>
Delivery-date: Mon, 10 Apr 2006 11:29:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <E1FT0P3-00015M-0U@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1FT0P3-00015M-0U@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mail/News 1.5 (X11/20060309)
Xen patchbot -3.0-testing wrote:
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID fd526926e0d1c0671295aa7f4b952186c9345173
# Parent  408f51a850f47af4db20f43f281935909d502511
If the 'cdrom=' option is specified in the definition file but media is not found in the CD drive then main() in vl.c exits and the guest appears to hang. This patch modifies vl.c slightly to check for the presents of media. If the cdrom cannot be opened then the cd entry is removed from hd_filename[] and bs_table[] allowing the guest to continue initializing. If the guest requires the CD media then the guest should report, gracefully
or otherwise, that it's missing.

From: Ross Maxfield <rmaxfiel@xxxxxxxxxx>

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

Doesn't this need a Signed-off-by: Ross Maxfield <rmaxfiel@xxxxxxxxxx>?

Regards,

Anthony Liguori

diff -r 408f51a850f4 -r fd526926e0d1 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Mon Apr 10 16:14:36 2006
+++ b/tools/ioemu/vl.c  Mon Apr 10 16:17:07 2006
@@ -3243,8 +3243,17 @@
     /* we always create the cdrom drive, even if no disk is there */
     bdrv_init();
     if (has_cdrom) {
-        bs_table[2] = bdrv_new("cdrom");
-        bdrv_set_type_hint(bs_table[2], BDRV_TYPE_CDROM);
+        int fd;
+        if ( (fd = open(hd_filename[2], O_RDONLY | O_BINARY)) < 0) {
+                hd_filename[2]=NULL;
+                bs_table[2]=NULL;
+                fprintf(logfile, "Could not open CD %s.\n", hd_filename[i]);
+        }
+        else {
+                close(fd);
+                bs_table[2] = bdrv_new("cdrom");
+                bdrv_set_type_hint(bs_table[2], BDRV_TYPE_CDROM);
+        }
     }
/* open the virtual block devices */

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


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