From df99f3a99bc562f03c091af1a267b9c846b62713 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Mon, 5 Nov 2012 18:49:23 +0100 Subject: [PATCH] pathutils: Add directory for remote commands Also add tests to ensure it's never allowed as a file storage path. A constant for the lock file is also added. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/pathutils.py | 4 ++++ test/ganeti.bdev_unittest.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/pathutils.py b/lib/pathutils.py index ca78ea8c4..9570831b7 100644 --- a/lib/pathutils.py +++ b/lib/pathutils.py @@ -88,6 +88,10 @@ USER_SCRIPTS_DIR = CONF_DIR + "/scripts" VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password" HOOKS_BASE_DIR = CONF_DIR + "/hooks" FILE_STORAGE_PATHS_FILE = CONF_DIR + "/file-storage-paths" +REMOTE_COMMANDS_DIR = CONF_DIR + "/remote-commands" + +#: Locked in exclusive mode while noded verifies a remote command +REMOTE_COMMANDS_LOCK_FILE = LOCK_DIR + "/ganeti-remote-commands.lock" #: Lock file for watcher, locked in shared mode by watcher; lock in exclusive # mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call} diff --git a/test/ganeti.bdev_unittest.py b/test/ganeti.bdev_unittest.py index d58ee226f..00347f683 100755 --- a/test/ganeti.bdev_unittest.py +++ b/test/ganeti.bdev_unittest.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2006, 2007, 2010 Google Inc. +# Copyright (C) 2006, 2007, 2010, 2012 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,6 +29,7 @@ from ganeti import bdev from ganeti import errors from ganeti import constants from ganeti import utils +from ganeti import pathutils import testutils @@ -391,6 +392,10 @@ class TestComputeWrongFileStoragePathsInternal(unittest.TestCase): self.assertEqual(vfsp(["/usr/sbin/vim", "/srv/file-storage"]), ["/usr/sbin/vim"]) + self.assertTrue(vfsp([pathutils.REMOTE_COMMANDS_DIR]), + msg=("Remote commands directory should never be valid" + "for file storage")) + class TestComputeWrongFileStoragePaths(testutils.GanetiTestCase): def test(self): -- GitLab