From 41808571f148c6d3720bcf09d997fe932d259f6c Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Wed, 19 Sep 2012 23:52:22 +0100 Subject: optimize slightly device lookup with LXC umounts Only canonicalize the path once, rather than for each entry in /proc/mounts. Change-Id: I6e582b44f171a1c4cc151d615e9dcfae1e590a53 Reported-by: Kevin L. Mitchell --- nova/virt/disk/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index 16bd9fe04..0cddcfa69 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -208,10 +208,11 @@ class _DiskImage(object): @staticmethod def _device_for_path(path): device = None + path = os.path.realpath(path) with open("/proc/mounts", 'r') as ifp: for line in ifp: fields = line.split() - if fields[1] == os.path.realpath(path): + if fields[1] == path: device = fields[0] break return device -- cgit