All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cole Robinson <crobinso@redhat.com>
To: David Ahern <dsahern@gmail.com>
Cc: Mark McLoughlin <markmc@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] don't exit if cdrom media fails to open
Date: Wed, 10 Jun 2009 09:47:14 -0400	[thread overview]
Message-ID: <4A2FB962.5000206@redhat.com> (raw)
In-Reply-To: <4A2EF18A.8080208@gmail.com>

David Ahern wrote:
> 
> Mark McLoughlin wrote:
>> Hi David,
>>
>> On Tue, 2009-06-09 at 07:41 -0600, David Ahern wrote:
>>> This patch allows a VM to continue even if the cdrom image is not
>>> accessible at VM boot time. It allows a boot progression similar to real
>>> hardware (e.g., try cd, then disk).
>>>
>>> For example,
>>>
>>> qemu-system-x86_64 -cdrom /dev/dvd -hda disk.img -boot dc
>>>
>>> If there is no media in the tray, qemu currently exits with the message:
>>> qemu: could not open disk image /dev/dvd
>>>
>>> With this patch, the message is still displayed, but qemu continues. It
>>> first tries to boot from the cdrom and then falls back to the disk.
>>>
>>> Signed-off-by: David Ahern <dsahern@gmail.com>
>>>
>>> ---
>>>
>>> diff --git a/vl.c b/vl.c
>>> index fcf8532..bd3709c 100644
>>> --- a/vl.c
>>> +++ b/vl.c
>>> @@ -152,6 +152,7 @@ int main(int argc, char **argv)
>>>  #include "qemu-char.h"
>>>  #include "cache-utils.h"
>>>  #include "block.h"
>>> +#include "block_int.h"
>>>  #include "dma.h"
>>>  #include "audio/audio.h"
>>>  #include "migration.h"
>>> @@ -2551,7 +2552,8 @@ int drive_init(struct drive_opt *arg, int
>>> snapshot, void *opaque)
>>>      if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) {
>>>          fprintf(stderr, "qemu: could not open disk image %s\n",
>>>                          file);
>>> -        return -1;
>>> +        if (bdrv->type != BDRV_TYPE_CDROM)
>>> +            return -1;
>> I think Cole's patch here:
>>
>>   https://bugzilla.redhat.com/show_bug.cgi?id=473154#c15
>>
>> fixes the same problem? Certainly, it seems to me that any code
>> requiring the path to be e.g. /dev/cd is doomed and should be fixed as
>> Cole suggests?
> 
> Cole's patch works as well. I don't have a preference for how it gets
> done, just that I can start a guest without checking whether there is
> media in the tray and adjusting the qemu invocation.
> 

There is an extra benefit to my patch: /dev/dvd will be treated as a
host cdrom device, so ejecting media in the guest will be mapped to a
physical eject on the host.

I'll touch up my patch and send with a Signed-off-by.

Thanks,
Cole

      reply	other threads:[~2009-06-10 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 13:41 [Qemu-devel] [PATCH] don't exit if cdrom media fails to open David Ahern
2009-06-09 22:22 ` Mark McLoughlin
2009-06-09 23:34   ` David Ahern
2009-06-10 13:47     ` Cole Robinson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A2FB962.5000206@redhat.com \
    --to=crobinso@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=markmc@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.