Re: [libvirt] can't install fedora guest

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

 



On Fri, Feb 06, 2009 at 05:27:47PM +0100, Guido G?nther wrote:
> On Fri, Feb 06, 2009 at 10:33:51AM +0100, Farkas Levente wrote:
> >     if ret is None:raise libvirtError('virDomainCreateLinux() failed',
> > conn=self)
> > libvirtError: internal error unable to start guest:
> I'm currently working around this with:
> 
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 09f69bf..b2f2b47 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -674,8 +674,6 @@ qemudReadMonitorOutput(virConnectPtr conn,
>                                   _("Failure while reading %s startup output"), what);
>                  return -1;
>              }
> -        } else if (ret == 0) {
> -            return 0;
>          } else {
>              got += ret;
>              buf[got] = '\0';
> 
> Didn't find the time to debug this properly yet.

That will cause libvirtd to spin 100% cpu forever, if a guest fails
to start up. eg disk to mis-configured disk

The core problem here, is that ret == 0 has 2 possible implications

 - QEMU has exited, and no more data will be written
 - QEMU is still starting up, and we have read all the data
   written so far, but more may arrive soon.

The current code there is correct for the first scenario, but even
removing it, is not entirely correct for the 2nd scenario. If we
hit ret == 0, and QEMU is still running, we shouldn't spin 100%
CPU in read - we should poll() to wait for more data.

As a quick fix though, we could probably detect whether QEMU has exited
by doing  'kill(vm->pid, 0)' and check for errno == ESRCH - indicates
that the process no longer exists.

eg,

   } else if (ret == 0) {
       if (kill(vm->pid, 0) == -1) {
          if (errno == ERSCH)
             return 0;
          else
             return -1;
       } else {
         continue; /* should really go into poll() at this point */
       }
   } else {

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]