summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedric.brandily <cedric.brandily@thalesgroup.com>2017-05-18 21:26:09 +0200
committerStephen Finucane <sfinucan@redhat.com>2017-05-30 08:17:26 +0000
commit9d299ae50ea52c63811eba11ee974643c17079ad (patch)
treec30151d8ce6c684dc6ae3f590afc4c33a40fe9c6
parentd756b78e303753e1b88e0691aa0fd13d2edaf1f0 (diff)
Correct _ensure_console_log_for_instance implementation
_ensure_console_log_for_instance[1] ensures VM console.log existence. A change[2] updated in order to succeed if the file exists without nova being able to read it (typically happens when libvirt rewrites uid/gid) by ignoring EPERM errors. It seems the method should ignore EACCES errors. Indeed EACCES errors are raised when an action is not permitted because of insufficient permissions where EPERM errors when an action is not permitted at all. [1] nova.virt.libvirt.driver [2] https://review.openstack.org/392643 Closes-Bug: #1691831 Change-Id: Ifc075a0fd91fc87651fcb306d6439be5369009b6 (cherry picked from commit 3072b0afbc157eef5e72f191525296cfa2b014cb)
Notes
Notes (review): Verified+1: IBM PowerKVM CI <kvmpower@linux.vnet.ibm.com> Code-Review+1: Cedric Brandily <zzelle@gmail.com> Code-Review+2: Matt Riedemann <mriedem.os@gmail.com> Code-Review+2: Sylvain Bauza <sbauza@redhat.com> Workflow+1: Sylvain Bauza <sbauza@redhat.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Sat, 03 Jun 2017 21:20:25 +0000 Reviewed-on: https://review.openstack.org/469013 Project: openstack/nova Branch: refs/heads/stable/newton
-rw-r--r--nova/tests/unit/virt/libvirt/test_driver.py2
-rw-r--r--nova/virt/libvirt/driver.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py
index 3a121f6..45018f5 100644
--- a/nova/tests/unit/virt/libvirt/test_driver.py
+++ b/nova/tests/unit/virt/libvirt/test_driver.py
@@ -10868,7 +10868,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
10868 with test.nested( 10868 with test.nested(
10869 mock.patch.object(drvr, '_get_console_log_path'), 10869 mock.patch.object(drvr, '_get_console_log_path'),
10870 mock.patch.object(fake_libvirt_utils, 'file_open', 10870 mock.patch.object(fake_libvirt_utils, 'file_open',
10871 side_effect=IOError(errno.EPERM, 'exc')) 10871 side_effect=IOError(errno.EACCES, 'exc'))
10872 ) as (mock_path, mock_open): 10872 ) as (mock_path, mock_open):
10873 drvr._ensure_console_log_for_instance(mock.ANY) 10873 drvr._ensure_console_log_for_instance(mock.ANY)
10874 mock_path.assert_called_once() 10874 mock_path.assert_called_once()
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 9b1cab2..0d2d0ce 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -2874,7 +2874,7 @@ class LibvirtDriver(driver.ComputeDriver):
2874 # NOTE(sfinucan): We can safely ignore permission issues here and 2874 # NOTE(sfinucan): We can safely ignore permission issues here and
2875 # assume that it is libvirt that has taken ownership of this file. 2875 # assume that it is libvirt that has taken ownership of this file.
2876 except IOError as ex: 2876 except IOError as ex:
2877 if ex.errno != errno.EPERM: 2877 if ex.errno != errno.EACCES:
2878 raise 2878 raise
2879 LOG.debug('Console file already exists: %s.', console_file) 2879 LOG.debug('Console file already exists: %s.', console_file)
2880 2880