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

Re: [libvirt] [PATCH 5/5] read saved vm status on libvirtd startup



On Mon, Jan 12, 2009 at 04:37:50PM +0100, Guido G?nther wrote:
> On Mon, Jan 12, 2009 at 11:30:19AM +0000, Daniel P. Berrange wrote:
> > There's different needs for each file descriptor
> > 
> >  - stdin_fd  - this is only ever used for incoming migration data
> >    all other times it is hooked up to /dev/null. So we don't need
> >    to keep this FD around at all
> Agreed.
> 
> >  - stdout_fd - AFAIK, the only time we get any data on stdout is
> >    when we run qemu -help to check support args. Current code will
> >    read & log all data on stdout, but I believe this is effectively
> >    nothing and so we could just hook it to /dev/null & ignore it
> We can just dup that one too while at it in case qemu/kvm should dump
> anything else there.
> 
> >  - stderr_fd - libvirtd reads this FD & logs the data to the domain
> >    logfile in /var/log/libvirt/qemu/$NAME.log. Instead of having
> >    the daemon process this logging, we can just dup() the file straight
> >    onto the logfile FD, so data will be logged even when libvirtd is
> >    not running. The only minor complication is that we need to parse
> >    the logfile to get the monitor TTY path.
> There's one more thing (which was my intial reason for asking): we also use
> this fd in qemudDispatchVMEvent() to detect vm shutdown:
> 
>       if (events & VIR_EVENT_HANDLE_READABLE) {
>             if (qemudVMData(driver, vm, fd) < 0)
>                 failed = 1;
>         } else {
>             quit = 1;
>         }
>     }
> 
>     if (failed || quit) {
>         event = virDomainEventNewFromObj(vm,
>                                          VIR_DOMAIN_EVENT_STOPPED,
>                                          quit ?
>                                          VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN
> :
>                                          VIR_DOMAIN_EVENT_STOPPED_FAILED);
>         qemudShutdownVMDaemon(NULL, driver, vm);
>         if (!vm->persistent) {
>             virDomainRemoveInactive(&driver->domains,
>                                     vm);
>             vm = NULL;
>         }
> 
> Using the monitor fd for this instead should work. Would that be o.k.?

Yeah, I thought it was already using the monitor FD for this !

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 :|


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