Permission denied when getting console output

Bug #955351 reported by justinsb on 2012-03-14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Adam Gandelman

Bug Description

I get a 500 error when calling get_console_output.

I think the problem is permissions on the console output (again).

This patch is fairly recent, but I don't see why it would have broken anything. Maybe the old XML selector code was broken, and so the patch fixed that but then exposed the failure to chmod:

I think if we find one of the XML elements (which we are), we're skipping the chmod.

Here's the permissions on the file:

stack@openstack1:/opt/stack/nova$ ls -l /opt/stack/nova/instances/instance-00000005/console.log
-rw-rw---- 1 libvirt-qemu kvm 0 2012-03-14 02:10 /opt/stack/nova/instances/instance-00000005/console.log


2012-03-14 11:35:29 DEBUG nova.rpc.amqp [req-3079f4b9-bf0f-4691-8e33-752ffbd5ae81 5e85278d16324d08957e9637fed9cb31 12827e8912574bebb583859c945e28b9] unpacked context: {'request_id': u'req-3079f4b9-bf0f-4691-8e33-752ffbd5ae81', 'user_id': u'5e85278d16324d08957e9637fed9cb31', 'roles': [u'Member', u'anotherrole'], 'timestamp': '2012-03-14T18:35:27.347856', 'is_admin': False, 'auth_token': u'41ec90b5cfce4345bee7e64c2ec1fc28', 'project_id': u'12827e8912574bebb583859c945e28b9', 'remote_address': u'', 'read_deleted': u'no'} from (pid=22121) unpack_context /opt/stack/nova/nova/rpc/
2012-03-14 11:35:29 AUDIT nova.compute.manager [req-3079f4b9-bf0f-4691-8e33-752ffbd5ae81 5e85278d16324d08957e9637fed9cb31 12827e8912574bebb583859c945e28b9] Get console output for instance 45efea23-eda6-4cb3-b6ea-d3ddff37a6f5
2012-03-14 11:35:30 ERROR nova.rpc.amqp [-] Exception during message handling
(nova.rpc.amqp): TRACE: Traceback (most recent call last):
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/rpc/", line 252, in _process_data
(nova.rpc.amqp): TRACE: rval = node_func(context=ctxt, **node_args)
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/", line 114, in wrapped
(nova.rpc.amqp): TRACE: return f(*args, **kw)
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/compute/", line 177, in decorated_function
(nova.rpc.amqp): TRACE: sys.exc_info())
(nova.rpc.amqp): TRACE: File "/usr/lib/python2.7/", line 24, in __exit__
(nova.rpc.amqp): TRACE:
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/compute/", line 171, in decorated_function
(nova.rpc.amqp): TRACE: return function(self, context, instance_uuid, *args, **kwargs)
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/compute/", line 1622, in get_console_output
(nova.rpc.amqp): TRACE: output = self.driver.get_console_output(instance_ref)
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/", line 114, in wrapped
(nova.rpc.amqp): TRACE: return f(*args, **kw)
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/virt/libvirt/", line 932, in get_console_output
(nova.rpc.amqp): TRACE: return libvirt_utils.load_file(path)
(nova.rpc.amqp): TRACE: File "/opt/stack/nova/nova/virt/libvirt/", line 223, in load_file
(nova.rpc.amqp): TRACE: with open(path, 'r+') as fp:
(nova.rpc.amqp): TRACE: IOError: [Errno 13] Permission denied: '/opt/stack/nova/instances/instance-00000005/console.log'
(nova.rpc.amqp): TRACE:
2012-03-14 11:35:30 ERROR nova.rpc.amqp [-] Returning exception [Errno 13] Permission denied: '/opt/stack/nova/instances/instance-00000005/console.log' to caller
2012-03-14 11:35:30 ERROR nova.rpc.amqp [-] ['Traceback (most recent call last):\n', ' File "/opt/stack/nova/nova/rpc/", line 252, in _process_data\n rval = node_func(context=ctxt, **node_args)\n', ' File "/opt/stack/nova/nova/", line 114, in wrapped\n return f(*args, **kw)\n', ' File "/opt/stack/nova/nova/compute/", line 177, in decorated_function\n sys.exc_info())\n', ' File "/usr/lib/python2.7/", line 24, in __exit__\n\n', ' File "/opt/stack/nova/nova/compute/", line 171, in decorated_function\n return function(self, context, instance_uuid, *args, **kwargs)\n', ' File "/opt/stack/nova/nova/compute/", line 1622, in get_console_output\n output = self.driver.get_console_output(instance_ref)\n', ' File "/opt/stack/nova/nova/", line 114, in wrapped\n return f(*args, **kw)\n', ' File "/opt/stack/nova/nova/virt/libvirt/", line 932, in get_console_output\n return libvirt_utils.load_file(path)\n', ' File "/opt/stack/nova/nova/virt/libvirt/", line 223, in load_file\n with open(path, \'r+\') as fp:\n', "IOError: [Errno 13] Permission denied: '/opt/stack/nova/instances/instance-00000005/console.log'\n"]

Changed in nova:
milestone: none → essex-rc1
importance: Undecided → High
status: New → Triaged
Changed in nova:
assignee: nobody → Adam Gandelman (gandelman-a)
status: Triaged → In Progress

Submitter: Jenkins
Branch: master

commit 9a40d6e714246b40b5b41f65197941fe29eb8ff1
Author: Adam Gandelman <email address hidden>
Date: Wed Mar 14 14:49:23 2012 -0700

    libvirt/ Set console.log permissions

    A required call to libvirt_utils.chown() was lost in
    this weeks changes to get_console_output() for file
    based console logs.

    Fixes bug 955351

    Change-Id: Ib8da92c1ff025f10a939c33b87495ffdef0d4da3

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-03-20
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: essex-rc1 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers