Skip to content
Snippets Groups Projects
Commit 7610d884 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

hv_xen: Test removing config from "auto" directory


Test whether any existing configuration file named after the instance is
removed from Xen's “auto” directory.

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 74a50c46
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ import unittest
import tempfile
import shutil
import random
import os
from ganeti import constants
from ganeti import objects
......@@ -365,6 +366,23 @@ class _TestXenHypervisor(object):
"", "This command failed", None,
NotImplemented, NotImplemented)
def testRemovingAutoConfigFile(self):
name = "inst8206.example.com"
cfgfile = utils.PathJoin(self.tmpdir, name)
autodir = utils.PathJoin(self.tmpdir, "auto")
autocfgfile = utils.PathJoin(autodir, name)
os.mkdir(autodir)
utils.WriteFile(autocfgfile, data="")
hv = self._GetHv()
self.assertTrue(os.path.isfile(autocfgfile))
hv._WriteConfigFile(name, "content")
self.assertFalse(os.path.exists(autocfgfile))
self.assertEqual(utils.ReadFile(cfgfile), "content")
def _MakeTestClass(cls, cmd):
"""Makes a class for testing.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment