Skip to contentSkip to conversation

Providing a mechanism to reopen() file based chardevs

Qemu-devel Tony Breeds 3 participants 5 messages Dec 5, 2014 – Dec 9, 2014

lore
Share & tools
lore
#0 lore raw

Hi All,
Openstcak (Nova) has had an issue for a longish time where a running
instance (qemu via libvirt) which has a file based console can fill the disk of the hypervisor causing all guests to stall.

I'm looking at ways to fix this. Clearly it can be done in openstack wothout changing qemu but it seems to be that a better idea would be to teach qemu to reopen() these files when it recieves a sighup and/or something in the monitor.

I like the idea of sighup as it allows systems administrators to use logrotate thereby avoiding baking policy into qemu.

My initial thoughts are that I'd need to add a flag to the chardev (perhaps allowreopen?) and upon reciept of the reopen request I'd I iterate over the open chardevs and reopen them if they have this flag set.

The main target of this would be a console log.

So my main question is would that be something that would be considered for 2.3.0? If so any high level design points I shoudl consider?

- Is the chardev flag a good/bad idea?
- Is it okay to change the action taken by sighup?

Yours Tony.

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 18 lines · Tony Breeds

Hi All, Openstcak (Nova) has had an issue for a longish time where a running instance (qemu via libvirt) which has a file based console can fill the disk of the hypervisor causing all guests to stall.

I'm looking at ways to fix this. Clearly it can be done in openstack wothout changing qemu but it seems to be that a better idea would be to teach qemu to reopen() these files when it recieves a sighup and/or something in the monitor.

I like the idea of sighup as it allows systems administrators to use logrotate thereby avoiding baking policy into qemu.

My initial thoughts are that I'd need to add a flag to the chardev (perhaps allowreopen?) and upon reciept of the reopen request I'd I iterate over the open chardevs and reopen them if they have this flag set.

Quoted 8 lines

The main target of this would be a console log.

So my main question is would that be something that would be considered for 2.3.0? If so any high level design points I shoudl consider?

- Is the chardev flag a good/bad idea? - Is it okay to change the action taken by sighup?

I think so. Should it reopen stdout/stderr too?

If you want to make it optional, you can add a suboption to -msg.

Paolo

#2 lore raw
Quoted 1 line · Paolo Bonzini

I think so. Should it reopen stdout/stderr too?

Thanks for the feedback I'm gald it's something that isn't a clearly terrible idea.

I don't think that's required for my use case, but it's not all about me. If that's something people generally feel is desired I'm happy to try and make it work.

Quoted 1 line

If you want to make it optional, you can add a suboption to -msg.

I'll look at that, based on 5mins of looking I don't think that'll work, but you know the code much better than me so clearly I wont dismiss it.

Yours Tony.

#3 lore raw
In reply to Tony Breeds
Quoted 8 lines · Tony Breeds

Hi All,
Openstcak (Nova) has had an issue for a longish time where a running
instance (qemu via libvirt) which has a file based console can fill the disk of the hypervisor causing all guests to stall.

I'm looking at ways to fix this. Clearly it can be done in openstack wothout changing qemu but it seems to be that a better idea would be to teach qemu to reopen() these files when it recieves a sighup and/or something in the monitor.

My long term desired approach to deal with this problem in OpenStack (and other libvirt based mgmt apps) is to have a separate log daemon in libvirt eg a virtlogd daemon. Take QEMU out of the business of writing to files entirely and instead it would always just be a given a pipe FD which is connected to the daemon. This avoidis the need to give QEMU permission to open files at all, which is inline with our general security strategy for host resources QEMU accesses.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#4 lore raw
Quoted 7 lines · Daniel P. Berrange

My long term desired approach to deal with this problem in OpenStack (and other libvirt based mgmt apps) is to have a separate log daemon in libvirt eg a virtlogd daemon. Take QEMU out of the business of writing to files entirely and instead it would always just be a given a pipe FD which is connected to the daemon. This avoidis the need to give QEMU permission to open files at all, which is inline with our general security strategy for host resources QEMU accesses.

Hi Daniel,
that sounds like a good plan and would certainly address the openstack case
but I still feel like hving something in qemu is a good idea as that doesn't stop an alternate fix in libvirt and it helps users that aren't using libvirt and qemu together.

Having said that I'm willing to be directed by the qemu community. If they feel that a libvirt only fix is best then that's where I'll spend my effort.

Yours Tony.