permissions issue with console.log in libvirt

Bug #653852 reported by Jesse Andrews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Soren Hansen

Bug Description

unable to get console output of an instance due to permission issues:

steps to reproduce:

1) install nova from ubuntu packages with KVM on lucid
2) run an instance
2.5) wait for launch
3) get console output

expected: console log
actual: exception is thrown

------

console.log is being created with -rw------- permissions, and upon instance kvm launch, the console.log becomes owned by the libvirt-qemu user.

     os.close(os.open(basepath('console.log'), os.O_CREAT | os.O_WRONLY, 0660))

It appears that 0660 was trying to be set - but the third parameter to os.open is buffer size, not permissions

I've worked around this by changing this to:

        os.close(os.open(basepath('console.log'), os.O_CREAT))
        os.chmod(basepath('console.log'), 0660)

AND adding the nova user to the kvm group, since after instance launch the console.log becomes:

  owner: libvirt-qemu
  group: kvm

Thoughts on how we want to actually do this?

Related branches

Revision history for this message
Jesse Andrews (anotherjesse) wrote :

the file is nova/virt/libvirt_conn.py

Revision history for this message
Jesse Andrews (anotherjesse) wrote :

hmm, on further investigation either I'm missing something or libvirt is forcing permissions to 0600?

Revision history for this message
Dave Walker (davewalker) wrote :

@anotherjesse This does indeed seem to be the case. Touching the file to generate it with what would seem to be the correct permissions is not suitable for the way libvirt currently generates the console.log. It would seem, that this would be better fixed in libvirt IMO.

Changed in nova:
status: New → Confirmed
Revision history for this message
Jay Pipes (jaypipes) wrote :

So, should we file a bug with libvirt then?

Revision history for this message
Soren Hansen (soren) wrote :

The third parameter to os.open is mode, not buffer size. You're mistaking it for open() (the built-in method).

This is a libvirt problem. It does this intentionally, but it's exceedingly annoying. I've just pushed a workaround for it to nova.

Eric Day (eday)
Changed in nova:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.