From 1fbb19fab9785de6344462a41903952647ac43a7 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 4 Mar 2013 11:44:10 +0100
Subject: [PATCH] Fix handling of disabled (shared) file storage

The vcluster changes broke the disabling of file storage; we can
workaround by (manually) skipping the virtualisation of file storage
paths if they are not enabled.

Note that tests/QA are still broken with disabled file storage; this
patch only fixes production code.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/pathutils.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/pathutils.py b/lib/pathutils.py
index fe531808e..30acd8bad 100644
--- a/lib/pathutils.py
+++ b/lib/pathutils.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,9 +29,15 @@ from ganeti import vcluster
 
 
 # Build-time constants
-DEFAULT_FILE_STORAGE_DIR = vcluster.AddNodePrefix(_autoconf.FILE_STORAGE_DIR)
-DEFAULT_SHARED_FILE_STORAGE_DIR = \
-  vcluster.AddNodePrefix(_autoconf.SHARED_FILE_STORAGE_DIR)
+if _autoconf.ENABLE_FILE_STORAGE:
+  DEFAULT_FILE_STORAGE_DIR = vcluster.AddNodePrefix(_autoconf.FILE_STORAGE_DIR)
+else:
+  DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
+if _autoconf.ENABLE_SHARED_FILE_STORAGE:
+  DEFAULT_SHARED_FILE_STORAGE_DIR = \
+    vcluster.AddNodePrefix(_autoconf.SHARED_FILE_STORAGE_DIR)
+else:
+  DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
 EXPORT_DIR = vcluster.AddNodePrefix(_autoconf.EXPORT_DIR)
 OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
 ES_SEARCH_PATH = _autoconf.ES_SEARCH_PATH
-- 
GitLab