From bc1a24e880b5b4421f7c5a4896708fb4528f58d4 Mon Sep 17 00:00:00 2001 From: "Blake J. Harnden" Date: Thu, 3 Aug 2017 09:48:26 -0700 Subject: [PATCH] fixed some refactoring issues with xen and bsd code --- daemon/core/bsd/vnode.py | 6 +++--- daemon/core/xen/xen.py | 4 ++-- daemon/tests/test_core.py | 4 ++-- daemon/tests/test_gui.py | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/daemon/core/bsd/vnode.py b/daemon/core/bsd/vnode.py index df8c1c4b..44ddbcf8 100644 --- a/daemon/core/bsd/vnode.py +++ b/daemon/core/bsd/vnode.py @@ -196,7 +196,7 @@ class SimpleJailNode(PyCoreNode): ifindex = self.newifindex() if ifname is None: ifname = "eth%d" % ifindex - sessionid = self.session.shortsessionid() + sessionid = self.session.short_session_id() name = "n%s_%s_%s" % (self.objid, ifindex, sessionid) localname = name ifclass = VEth @@ -306,10 +306,10 @@ class SimpleJailNode(PyCoreNode): dirname = dirname.replace("/", ".") if file: pathname = os.path.join(path, file) - sym = os.path.join(self.session.sessiondir, "@.conf", dirname, file) + sym = os.path.join(self.session.session_dir, "@.conf", dirname, file) else: pathname = path - sym = os.path.join(self.session.sessiondir, "@.conf", dirname) + sym = os.path.join(self.session.session_dir, "@.conf", dirname) if os.path.islink(pathname): if os.readlink(pathname) == sym: diff --git a/daemon/core/xen/xen.py b/daemon/core/xen/xen.py index 0ba0ace6..aaa39bec 100644 --- a/daemon/core/xen/xen.py +++ b/daemon/core/xen/xen.py @@ -174,7 +174,7 @@ class XenNode(PyCoreNode): # LxcNode initialization # self.makenodedir() if self.nodedir is None: - self.nodedir = os.path.join(session.sessiondir, self.name + ".conf") + self.nodedir = os.path.join(session.session_dir, self.name + ".conf") self.mountdir = self.nodedir + self.getconfigitem('mount_path') if not os.path.isdir(self.mountdir): os.makedirs(self.mountdir) @@ -201,7 +201,7 @@ class XenNode(PyCoreNode): self.lock.acquire() try: if self.up: - raise Exception, "already up" + raise Exception("already up") self.createlogicalvolume() self.createpartitions() persistdev = self.createfilesystems() diff --git a/daemon/tests/test_core.py b/daemon/tests/test_core.py index 7a5f0563..5aa927d1 100644 --- a/daemon/tests/test_core.py +++ b/daemon/tests/test_core.py @@ -14,8 +14,7 @@ from mock import MagicMock from conftest import EMANE_SERVICES from core.data import ConfigData -from core.data import EventData -from core.enumerations import MessageFlags, ConfigTlvs, EventTypes +from core.enumerations import MessageFlags from core.mobility import BasicRangeModel from core.netns import nodes from core.netns import vnodeclient @@ -361,6 +360,7 @@ class TestCore: def node_update(_): event.set() + core.session.node_handlers.append(node_update) # instantiate session diff --git a/daemon/tests/test_gui.py b/daemon/tests/test_gui.py index 8d99bef4..5fa0f7ed 100644 --- a/daemon/tests/test_gui.py +++ b/daemon/tests/test_gui.py @@ -1,6 +1,7 @@ """ Unit tests for testing with a CORE switch. """ + import threading from core.api import coreapi, dataconversion