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

Guido Günther agx at sigxcpu.org
Sun Jan 11 13:09:26 UTC 2009


On Mon, Dec 15, 2008 at 11:27:27AM +0000, Daniel P. Berrange wrote:
[..snip..] 
> > +        vm->stdin_fd  = qemudGetProcFD(vm->pid, 0);
> > +        vm->stdout_fd = qemudGetProcFD(vm->pid, 1);
> > +        vm->stderr_fd = qemudGetProcFD(vm->pid, 2);
> 
> NACK, to these 3 lines - since we go to trouble of creating the statefile,
> we should store the FD numbers in the statefile too, instead of relying
> in the linux specific /proc code.
This is (as far as I know) the last blocker for merging the forking of
qemus/kvms and reattaching them after libvirtd restart (so the vms
survive a libvirtd crash/restart)[1]. While I can safe the path to
std{in,out,err} in the domain status file easily this would still be
/proc/<pid>/fd/{1,2,3} which is not portable.

After reading the monitor path on vm startup we only need the above fds
to decect vm shutdown in qemudDispatchVMEvent(). This could be replaced
by simply dup'ing the fds and using inotify on the pid file in
/var/run/libvirt/qemu/ to detect vm shutdown instead - but this isn't
portable outside of Linux either.

Any other options I'm overlooking? Note that the current code doesn't
break any non Linux port, it's just that the VMs won't get reattached
after daemon restart.
 -- Guido

[1] http://honk.sigxcpu.org/projects/libvirt/daemon-restart/




More information about the libvir-list mailing list