Skip to contentSkip to conversation

a BETTER missing media fix.

PATCH New Ross Maxfield 1 participant 1 message Apr 13, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 a BETTER missing media fix.

This patch is a better fix for the missing media condition.

This patch better emulates the cdrom device in that the guest continues to initialize without cd media and retains awareness the empty cdrom device. The previous patch removed the awareness of the device. Since ioemu now retains the device entry, one can use the ioemu monitor to 'insert' the media at a later time. Until that time, the guests reports, as one would expect, a cd device with no media.

This patch applies to changeset 9638

- Ross Maxfield
Novell, Inc.

tools/ioemu/vl.c +4 -11
Index: xen-3.0-testing/tools/ioemu/vl.c
===================================================================
@@ -3243,17 +3243,8 @@ int main(int argc, char **argv)
     /* we always create the cdrom drive, even if no disk is there */
     bdrv_init();
     if (has_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);
-        }
+        bs_table[2] = bdrv_new("cdrom");
+        bdrv_set_type_hint(bs_table[2], BDRV_TYPE_CDROM);
     }
 
     /* open the virtual block devices */
@@ -3265,6 +3256,8 @@ int main(int argc, char **argv)
                 bs_table[i] = bdrv_new(buf);
             }
             if (bdrv_open(bs_table[i], hd_filename[i], snapshot) < 0) {
+		if ((i==2) && has_cdrom)
+			continue;
                 fprintf(stderr, "qemu: could not open hard disk image '%s'\n",
                         hd_filename[i]);
                 exit(1);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel