Francesco Romani has uploaded a new change for review.

Change subject: lib: move exception.py under common
......................................................................

lib: move exception.py under common

The commit fc732ae broke the rule that code under lib/vdsm/common
should depend only on code under the same subtree.

The good news is that the code moved in fc732ae depends only on
a few modules; one of them is exception.py, which makes sense
to move under common/ anyway.

This patch does that.

Change-Id: I7742aa7dafe0e0e29044536ad19fbddbcab0f420
Signed-off-by: Francesco Romani <[email protected]>
---
M lib/vdsm/Makefile.am
M lib/vdsm/commands.py
M lib/vdsm/common/api.py
R lib/vdsm/common/exception.py
M lib/vdsm/define.py
M lib/vdsm/gluster/exception.py
M lib/vdsm/hooks.py
M lib/vdsm/jobs.py
M lib/vdsm/qemuimg.py
M lib/vdsm/rpc/Bridge.py
M lib/vdsm/rpc/bindingxmlrpc.py
M lib/vdsm/storage/exception.py
M lib/yajsonrpc/__init__.py
M tests/api_test.py
M tests/bridgeTests.py
M tests/exception_test.py
M tests/jobsTests.py
M tests/miscTests.py
M tests/qemuimgTests.py
M tests/storage_exception_test.py
M tests/storage_sdm_create_volume_test.py
M vdsm.spec.in
M vdsm/API.py
M vdsm/storage/blockSD.py
M vdsm/storage/blockVolume.py
M vdsm/storage/fileVolume.py
M vdsm/storage/image.py
M vdsm/storage/sdm/api/create_volume.py
28 files changed, 28 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/63952/1

diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am
index 3e3fa68..fa50d1e 100644
--- a/lib/vdsm/Makefile.am
+++ b/lib/vdsm/Makefile.am
@@ -31,7 +31,6 @@
        cpuinfo.py \
        define.py \
        dmidecodeUtil.py \
-       exception.py \
        executor.py \
        health.py \
        hooks.py \
diff --git a/lib/vdsm/commands.py b/lib/vdsm/commands.py
index 471ac26..9245a8b 100644
--- a/lib/vdsm/commands.py
+++ b/lib/vdsm/commands.py
@@ -31,8 +31,8 @@
 import time
 from . import cmdutils
 from .compat import CPopen
-from .exception import ActionStopped
 from .utils import NoIntrPoll, stripNewLines, terminating
+from vdsm.common.exception import ActionStopped
 from vdsm import constants
 
 # Buffsize is 1K because I tested it on some use cases and 1K was fastest. If
diff --git a/lib/vdsm/common/api.py b/lib/vdsm/common/api.py
index 354b665..603455a 100644
--- a/lib/vdsm/common/api.py
+++ b/lib/vdsm/common/api.py
@@ -22,7 +22,8 @@
 from functools import wraps
 import logging
 
-from vdsm import exception
+from . import exception
+
 from vdsm import response
 
 
diff --git a/lib/vdsm/exception.py b/lib/vdsm/common/exception.py
similarity index 100%
rename from lib/vdsm/exception.py
rename to lib/vdsm/common/exception.py
diff --git a/lib/vdsm/define.py b/lib/vdsm/define.py
index d75e919..56a2cd0 100644
--- a/lib/vdsm/define.py
+++ b/lib/vdsm/define.py
@@ -19,7 +19,7 @@
 #
 
 from __future__ import absolute_import
-from . import exception
+from vdsm.common import exception
 
 # TODO: Drop after callers changed to raise the exceptions
 errCode = {
diff --git a/lib/vdsm/gluster/exception.py b/lib/vdsm/gluster/exception.py
index 43ad1da..9a28999 100644
--- a/lib/vdsm/gluster/exception.py
+++ b/lib/vdsm/gluster/exception.py
@@ -32,7 +32,7 @@
 #
 from __future__ import absolute_import
 
-from vdsm.exception import VdsmException
+from vdsm.common.exception import VdsmException
 
 
 class GlusterException(VdsmException):
diff --git a/lib/vdsm/hooks.py b/lib/vdsm/hooks.py
index 03363ae..96969fd 100644
--- a/lib/vdsm/hooks.py
+++ b/lib/vdsm/hooks.py
@@ -32,8 +32,8 @@
 import sys
 import tempfile
 
+from vdsm.common import exception
 from . import commands
-from . import exception
 from .constants import P_VDSM_HOOKS, P_VDSM, P_VDSM_RUN
 
 _LAUNCH_FLAGS_FILE = 'launchflags'
diff --git a/lib/vdsm/jobs.py b/lib/vdsm/jobs.py
index cdc787c..3ad5511 100644
--- a/lib/vdsm/jobs.py
+++ b/lib/vdsm/jobs.py
@@ -22,7 +22,7 @@
 import logging
 import threading
 
-from vdsm import exception
+from vdsm.common import exception
 from vdsm import response
 
 
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index 53a02c7..61ebec3 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -25,7 +25,7 @@
 import re
 import signal
 
-from . import exception
+from vdsm.common import exception
 from . import utils
 from . import cmdutils
 from . import commands
diff --git a/lib/vdsm/rpc/Bridge.py b/lib/vdsm/rpc/Bridge.py
index f264e8d..aa83177 100644
--- a/lib/vdsm/rpc/Bridge.py
+++ b/lib/vdsm/rpc/Bridge.py
@@ -25,9 +25,9 @@
 import yajsonrpc
 from api import vdsmapi
 
+from vdsm.common.exception import VdsmException
 from vdsm.config import config
 from vdsm.network.netinfo.addresses import getDeviceByIP
-from vdsm.exception import VdsmException
 
 
 try:
diff --git a/lib/vdsm/rpc/bindingxmlrpc.py b/lib/vdsm/rpc/bindingxmlrpc.py
index 1d31033..83b5c56 100644
--- a/lib/vdsm/rpc/bindingxmlrpc.py
+++ b/lib/vdsm/rpc/bindingxmlrpc.py
@@ -27,6 +27,7 @@
 import threading
 import re
 
+from vdsm.common.exception import VdsmException
 from vdsm.password import (ProtectedPassword,
                            protect_passwords,
                            unprotect_passwords)
@@ -37,7 +38,6 @@
 from vdsm.logUtils import Suppressed
 from vdsm.network.netinfo.addresses import getDeviceByIP
 import API
-from vdsm.exception import VdsmException
 
 try:
     from gluster.api import getGlusterMethods
diff --git a/lib/vdsm/storage/exception.py b/lib/vdsm/storage/exception.py
index 23e2628..dcd2922 100644
--- a/lib/vdsm/storage/exception.py
+++ b/lib/vdsm/storage/exception.py
@@ -33,7 +33,7 @@
 
 from __future__ import absolute_import
 
-from vdsm.exception import GeneralException
+from vdsm.common.exception import GeneralException
 from vdsm.storage.securable import SecureError
 SPM_STATUS_ERROR = (654, "Not SPM")
 
diff --git a/lib/yajsonrpc/__init__.py b/lib/yajsonrpc/__init__.py
index 7f56ccf..3a822ae 100644
--- a/lib/yajsonrpc/__init__.py
+++ b/lib/yajsonrpc/__init__.py
@@ -21,10 +21,10 @@
 
 from vdsm.compat import json
 
+from vdsm.common import exception
 from vdsm.logUtils import Suppressed
 from vdsm.password import protect_passwords, unprotect_passwords
 from vdsm.utils import monotonic_time, traceback
-from vdsm import exception
 
 
 __all__ = ["betterAsyncore", "stompreactor", "stomp"]
diff --git a/tests/api_test.py b/tests/api_test.py
index d482815..93e542e 100644
--- a/tests/api_test.py
+++ b/tests/api_test.py
@@ -18,10 +18,10 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
-from vdsm import exception
 from vdsm import response
 
 from vdsm.common import api
+from vdsm.common import exception
 
 from testlib import VdsmTestCase as TestCaseBase
 
diff --git a/tests/bridgeTests.py b/tests/bridgeTests.py
index 12d0654..d989f10 100644
--- a/tests/bridgeTests.py
+++ b/tests/bridgeTests.py
@@ -20,7 +20,7 @@
 #
 import imp
 
-from vdsm.exception import GeneralException
+from vdsm.common.exception import GeneralException
 from vdsm.rpc.Bridge import DynamicBridge
 from yajsonrpc import JsonRpcError
 
diff --git a/tests/exception_test.py b/tests/exception_test.py
index 0e28bda..dab0c29 100644
--- a/tests/exception_test.py
+++ b/tests/exception_test.py
@@ -19,7 +19,8 @@
 #
 
 from testlib import VdsmTestCase
-from vdsm.exception import VdsmException, GeneralException, ActionStopped
+from vdsm.common.exception import VdsmException, GeneralException
+from vdsm.common.exception import ActionStopped
 
 
 class TestVdsmException(VdsmTestCase):
diff --git a/tests/jobsTests.py b/tests/jobsTests.py
index c2e9999..cb390f9 100644
--- a/tests/jobsTests.py
+++ b/tests/jobsTests.py
@@ -19,7 +19,8 @@
 
 import uuid
 
-from vdsm import jobs, response, exception
+from vdsm.common import exception
+from vdsm import jobs, response
 
 from testlib import VdsmTestCase, expandPermutations, permutations
 from testlib import wait_for_job
diff --git a/tests/miscTests.py b/tests/miscTests.py
index ec7f7e0..55739d4 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -36,8 +36,8 @@
 
 from vdsm import cmdutils
 from vdsm import commands
-from vdsm import exception
 from vdsm import utils
+from vdsm.common import exception
 from vdsm.storage import fileUtils
 from vdsm.storage import misc
 
diff --git a/tests/qemuimgTests.py b/tests/qemuimgTests.py
index 991919a..d7d9fab 100644
--- a/tests/qemuimgTests.py
+++ b/tests/qemuimgTests.py
@@ -27,9 +27,9 @@
 from testlib import permutations, expandPermutations
 from testlib import make_config
 from testlib import namedTemporaryDir
+from vdsm.common import exception
 from vdsm import qemuimg
 from vdsm import commands
-from vdsm import exception
 
 QEMU_IMG = qemuimg._qemuimg.cmd
 
diff --git a/tests/storage_exception_test.py b/tests/storage_exception_test.py
index 8d2eb0a..46e311f 100644
--- a/tests/storage_exception_test.py
+++ b/tests/storage_exception_test.py
@@ -20,7 +20,7 @@
 
 from __future__ import absolute_import
 
-from vdsm.exception import GeneralException
+from vdsm.common.exception import GeneralException
 from vdsm.storage import exception as storage_exception
 
 from testlib import VdsmTestCase as TestCaseBase
diff --git a/tests/storage_sdm_create_volume_test.py 
b/tests/storage_sdm_create_volume_test.py
index 2a191eb..ebc2db0 100644
--- a/tests/storage_sdm_create_volume_test.py
+++ b/tests/storage_sdm_create_volume_test.py
@@ -27,7 +27,7 @@
 from testlib import VdsmTestCase, recorded, expandPermutations, permutations
 from testlib import wait_for_job
 
-from vdsm import exception
+from vdsm.common import exception
 from vdsm import jobs
 from vdsm.storage import constants as sc
 from vdsm.storage import exception as se
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f234b09..bad404a 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1157,7 +1157,6 @@
 %{python_sitelib}/%{vdsm_name}/dsaversion.py*
 %{python_sitelib}/%{vdsm_name}/define.py*
 %{python_sitelib}/%{vdsm_name}/dmidecodeUtil.py*
-%{python_sitelib}/%{vdsm_name}/exception.py*
 %{python_sitelib}/%{vdsm_name}/executor.py*
 # gluster.exception is used in many places like Bridge.py. So it is required
 # even without vdsm-gluster package
diff --git a/vdsm/API.py b/vdsm/API.py
index 57a30df..5b52d8d 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -28,7 +28,6 @@
 from vdsm import utils
 from clientIF import clientIF
 from vdsm import constants
-from vdsm import exception
 from vdsm import logUtils
 from vdsm import hooks
 from vdsm import hostdev
@@ -37,6 +36,7 @@
 from vdsm import throttledlog
 from vdsm import jobs
 from vdsm import v2v
+from vdsm.common import exception
 from vdsm.host import api as hostapi
 from vdsm.logUtils import AllVmStatsValue, Suppressed
 from vdsm.storage import clusterlock
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index b19252a..0ad5488 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -33,9 +33,9 @@
 
 from vdsm import cmdutils
 from vdsm import concurrent
+from vdsm.common import exception
 from vdsm.config import config
 from vdsm import constants
-from vdsm import exception
 from vdsm import utils
 from vdsm.storage import blkdiscard
 from vdsm.storage import clusterlock
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index cf0536a..2596abc 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -25,7 +25,7 @@
 from vdsm import cmdutils
 from vdsm import qemuimg
 from vdsm import constants
-from vdsm import exception
+from vdsm.common import exception
 from vdsm.config import config
 from vdsm.storage import blkdiscard
 from vdsm.storage import constants as sc
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 93e6e98..ad62eec 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -22,7 +22,7 @@
 import os
 import sanlock
 
-from vdsm import exception
+from vdsm.common import exception
 from vdsm import qemuimg
 from vdsm.commands import grepCmd
 from vdsm.storage import constants as sc
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 6faea2f..d70d25a 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -37,7 +37,7 @@
 from sdc import sdCache
 import sd
 import imageSharing
-from vdsm.exception import ActionStopped
+from vdsm.common.exception import ActionStopped
 import task
 import resourceManager as rm
 
diff --git a/vdsm/storage/sdm/api/create_volume.py 
b/vdsm/storage/sdm/api/create_volume.py
index ada1d94..e3df1cc 100644
--- a/vdsm/storage/sdm/api/create_volume.py
+++ b/vdsm/storage/sdm/api/create_volume.py
@@ -20,7 +20,7 @@
 
 from __future__ import absolute_import
 
-from vdsm import exception
+from vdsm.common import exception
 from vdsm.storage import constants as sc
 from vdsm.storage import exception as se
 


-- 
To view, visit https://gerrit.ovirt.org/63952
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7742aa7dafe0e0e29044536ad19fbddbcab0f420
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to