From 76c364d9e8bb05bf8677d85657ca7267be549572 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 22 Jan 2013 14:25:52 +0100
Subject: [PATCH] hv_xen: Compose file name outside error handling

In _ReadConfigFile, the filename should be prepared outside the
try/except block. Fixes bad code formatting, too.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
---
 lib/hypervisor/hv_xen.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index 20c7230c0..84c87d2a9 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -137,11 +137,13 @@ class XenHypervisor(hv_base.BaseHypervisor):
     """Returns the contents of the instance config file.
 
     """
+    filename = XenHypervisor._ConfigFileName(instance_name)
+
     try:
-      file_content = utils.ReadFile(
-                       XenHypervisor._ConfigFileName(instance_name))
+      file_content = utils.ReadFile(filename)
     except EnvironmentError, err:
       raise errors.HypervisorError("Failed to load Xen config file: %s" % err)
+
     return file_content
 
   @staticmethod
-- 
GitLab