Idan Shaby has uploaded a new change for review. Change subject: storage: move misc module to vdsm storage lib ......................................................................
storage: move misc module to vdsm storage lib This patch moves the module vdsm/storage/misc.py to lib/vdsm/storage/misc.py. Change-Id: I22627bf0d8898c491da44ced4b39e1294a322308 Signed-off-by: Idan Shaby <ish...@redhat.com> --- M lib/vdsm/storage/Makefile.am R lib/vdsm/storage/misc.py M tests/alignmentScanTests.py M tests/functional/virtTests.py M tests/miscTests.py M tests/mountTests.py M tests/storage_rwlock_test.py M vdsm.spec.in M vdsm/API.py M vdsm/alignmentScan.py M vdsm/storage/Makefile.am M vdsm/storage/blockSD.py M vdsm/storage/blockVolume.py M vdsm/storage/clusterlock.py M vdsm/storage/devicemapper.py M vdsm/storage/fileSD.py M vdsm/storage/fileVolume.py M vdsm/storage/fuser.py M vdsm/storage/hba.py M vdsm/storage/hsm.py M vdsm/storage/image.py M vdsm/storage/iscsi.py M vdsm/storage/iscsiadm.py M vdsm/storage/localFsSD.py M vdsm/storage/lvm.py M vdsm/storage/monitor.py M vdsm/storage/multipath.py M vdsm/storage/nfsSD.py M vdsm/storage/resourceManager.py M vdsm/storage/sd.py M vdsm/storage/sdc.py M vdsm/storage/sp.py M vdsm/storage/spbackends.py M vdsm/storage/storageServer.py M vdsm/storage/storage_mailbox.py M vdsm/storage/task.py M vdsm/storage/volume.py 37 files changed, 44 insertions(+), 43 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/56614/1 diff --git a/lib/vdsm/storage/Makefile.am b/lib/vdsm/storage/Makefile.am index b39baf2..bd90ef7 100644 --- a/lib/vdsm/storage/Makefile.am +++ b/lib/vdsm/storage/Makefile.am @@ -26,6 +26,7 @@ constants.py \ exception.py \ fileUtils.py \ + misc.py \ mount.py \ persistent.py \ rwlock.py \ diff --git a/vdsm/storage/misc.py b/lib/vdsm/storage/misc.py similarity index 99% rename from vdsm/storage/misc.py rename to lib/vdsm/storage/misc.py index ea63e20..aa1f6aa 100644 --- a/vdsm/storage/misc.py +++ b/lib/vdsm/storage/misc.py @@ -27,6 +27,8 @@ Various storage misc procedures """ +from __future__ import absolute_import + import contextlib import errno import inspect diff --git a/tests/alignmentScanTests.py b/tests/alignmentScanTests.py index d7891d8..076a559 100644 --- a/tests/alignmentScanTests.py +++ b/tests/alignmentScanTests.py @@ -23,9 +23,9 @@ import tempfile from nose.tools import eq_, raises from nose.plugins.skip import SkipTest +from vdsm.storage.misc import execCmd from testlib import VdsmTestCase as TestCaseBase from testValidation import brokentest, slowtest -from storage.misc import execCmd from alignmentScan import runScanArgs, scanImage, VirtAlignError diff --git a/tests/functional/virtTests.py b/tests/functional/virtTests.py index d76be94..202ffa4 100644 --- a/tests/functional/virtTests.py +++ b/tests/functional/virtTests.py @@ -37,7 +37,7 @@ from vdsm import cpuarch from vdsm.utils import CommandPath from vdsm.virt import vmstatus -from storage.misc import execCmd +from vdsm.storage.misc import execCmd from utils import getProxy, SUCCESS diff --git a/tests/miscTests.py b/tests/miscTests.py index e993f05..8359833 100644 --- a/tests/miscTests.py +++ b/tests/miscTests.py @@ -39,9 +39,9 @@ from vdsm import exception from vdsm import utils from vdsm.storage import fileUtils +from vdsm.storage import misc import storage.outOfProcess as oop -import storage.misc as misc from monkeypatch import MonkeyPatch from testValidation import checkSudo diff --git a/tests/mountTests.py b/tests/mountTests.py index 7903e9e..27e0bf5 100644 --- a/tests/mountTests.py +++ b/tests/mountTests.py @@ -28,13 +28,13 @@ from vdsm import udevadm from vdsm.utils import stopwatch from vdsm.storage import mount +from vdsm.storage.misc import execCmd from nose.plugins.skip import SkipTest from testlib import VdsmTestCase as TestCaseBase from testlib import namedTemporaryDir, temporaryPath from testlib import expandPermutations, permutations -from storage.misc import execCmd from testValidation import ValidateRunningAsRoot import monkeypatch diff --git a/tests/storage_rwlock_test.py b/tests/storage_rwlock_test.py index d1f9fe9..a3e279e 100644 --- a/tests/storage_rwlock_test.py +++ b/tests/storage_rwlock_test.py @@ -32,7 +32,7 @@ # Temporary import of both implementations, to make sure that the test pass # with both before we drop the old one and use the new. -from storage.misc import RWLock as OldRWLock +from vdsm.storage.misc import RWLock as OldRWLock from vdsm.storage.rwlock import RWLock as NewRWLock diff --git a/vdsm.spec.in b/vdsm.spec.in index 4095195..725bf75 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -946,7 +946,6 @@ %{_datadir}/%{vdsm_name}/storage/localFsSD.py* %{_datadir}/%{vdsm_name}/storage/lvm.env %{_datadir}/%{vdsm_name}/storage/lvm.py* -%{_datadir}/%{vdsm_name}/storage/misc.py* %{_datadir}/%{vdsm_name}/storage/multipath.py* %{_datadir}/%{vdsm_name}/storage/nfsSD.py* %{_datadir}/%{vdsm_name}/storage/outOfProcess.py* @@ -1177,6 +1176,7 @@ %{python_sitelib}/%{vdsm_name}/storage/constants.py* %{python_sitelib}/%{vdsm_name}/storage/exception.py* %{python_sitelib}/%{vdsm_name}/storage/fileUtils.py* +%{python_sitelib}/%{vdsm_name}/storage/misc.py* %{python_sitelib}/%{vdsm_name}/storage/mount.py* %{python_sitelib}/%{vdsm_name}/storage/persistent.py* %{python_sitelib}/%{vdsm_name}/storage/rwlock.py* diff --git a/vdsm/API.py b/vdsm/API.py index d474c26..84bb24d 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -39,11 +39,11 @@ from vdsm import supervdsm from vdsm import jobs from vdsm import v2v +from vdsm.storage import misc from vdsm.virt import hoststats from vdsm.virt import vmstatus from vdsm.virt import sampling from vdsm.virt import secret -import storage.misc import storage.clusterlock import storage.volume import storage.sd @@ -192,7 +192,7 @@ 'message': 'Missing required ' 'parameter %s' % (param)}} try: - storage.misc.validateUUID(vmParams['vmId']) + misc.validateUUID(vmParams['vmId']) except: return {'status': {'code': errCode['MissParam'] ['status']['code'], diff --git a/vdsm/alignmentScan.py b/vdsm/alignmentScan.py index 7b1b033..0957c05 100644 --- a/vdsm/alignmentScan.py +++ b/vdsm/alignmentScan.py @@ -21,7 +21,7 @@ from collections import namedtuple from vdsm.utils import CommandPath -from storage.misc import execCmd +from vdsm.storage.misc import execCmd ScanOutput = namedtuple( 'ScanOutput', diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am index cad6053..1a0eae0 100644 --- a/vdsm/storage/Makefile.am +++ b/vdsm/storage/Makefile.am @@ -45,7 +45,6 @@ iscsi.py \ localFsSD.py \ lvm.py \ - misc.py \ monitor.py \ multipath.py \ nfsSD.py \ diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py index 3c7c290..73441a7 100644 --- a/vdsm/storage/blockSD.py +++ b/vdsm/storage/blockSD.py @@ -39,11 +39,11 @@ from vdsm.storage import constants as storage_constants from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc from vdsm.storage import mount from vdsm.storage.persistent import PersistentDict, DictValidator import vdsm.supervdsm as svdsm -import misc import sd import lvm import clusterlock diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py index 8e3dc9f..1b83823 100644 --- a/vdsm/storage/blockVolume.py +++ b/vdsm/storage/blockVolume.py @@ -28,15 +28,15 @@ from vdsm.config import config from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc +from vdsm.storage.misc import deprecated +from vdsm.storage.misc import logskip import vdsm.utils as utils import volume import image import sd import blockSD -import misc -from misc import logskip -from misc import deprecated import task import lvm import resourceManager as rm diff --git a/vdsm/storage/clusterlock.py b/vdsm/storage/clusterlock.py index 4570478..f845f71 100644 --- a/vdsm/storage/clusterlock.py +++ b/vdsm/storage/clusterlock.py @@ -26,12 +26,11 @@ from contextlib import nested import sanlock -import misc - from vdsm import constants from vdsm.config import config from vdsm import utils from vdsm.storage import exception as se +from vdsm.storage import misc MAX_HOST_ID = 250 diff --git a/vdsm/storage/devicemapper.py b/vdsm/storage/devicemapper.py index 86da644..9824666 100644 --- a/vdsm/storage/devicemapper.py +++ b/vdsm/storage/devicemapper.py @@ -19,12 +19,12 @@ # import os -import misc from glob import glob import errno import re from vdsm.constants import EXT_DMSETUP +from vdsm.storage import misc from vdsm.supervdsm import getProxy DMPATH_PREFIX = "/dev/mapper/" diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index bb843a6..86a9c90 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -28,13 +28,13 @@ from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc from vdsm.storage import mount from vdsm.storage.persistent import PersistentDict, DictValidator import sd import sdm.volume_artifacts import fileVolume -import misc import outOfProcess as oop from vdsm import constants from vdsm.utils import stripNewLines diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py index ec9ab3c..7b016ce 100644 --- a/vdsm/storage/fileVolume.py +++ b/vdsm/storage/fileVolume.py @@ -26,8 +26,10 @@ from vdsm import qemuimg from vdsm.commands import grepCmd from vdsm.storage import exception as se +from vdsm.storage import misc from vdsm.storage.constants import FILE_VOLUME_PERMISSIONS from vdsm.storage.constants import LEASE_FILEEXT +from vdsm.storage.misc import deprecated from sdc import sdCache import outOfProcess as oop @@ -35,8 +37,6 @@ import image import sd import fileSD -import misc -from misc import deprecated import task from threadLocal import vars diff --git a/vdsm/storage/fuser.py b/vdsm/storage/fuser.py index 3d5523c..3d92efd 100644 --- a/vdsm/storage/fuser.py +++ b/vdsm/storage/fuser.py @@ -17,9 +17,10 @@ # # Refer to the README and COPYING files for full details of the license # -import misc from vdsm import constants +from vdsm.storage import misc + def fuser(path, mountPoint=False): cmd = [constants.EXT_FUSER] diff --git a/vdsm/storage/hba.py b/vdsm/storage/hba.py index 30beeb3..4fcfe61 100644 --- a/vdsm/storage/hba.py +++ b/vdsm/storage/hba.py @@ -30,8 +30,7 @@ from vdsm import commands from vdsm.config import config from vdsm.infra import zombiereaper - -import misc +from vdsm.storage import misc log = logging.getLogger("Storage.HBA") diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index bd33b25..1bbb2ed 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -46,9 +46,11 @@ from vdsm.config import config from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc from vdsm.storage import mount from vdsm.storage.constants import STORAGE from vdsm.storage.constants import SECTOR_SIZE +from vdsm.storage.misc import deprecated import sp from spbackends import MAX_POOL_DESCRIPTION_SIZE, MAX_DOMAINS @@ -68,8 +70,6 @@ import imagetickets import volume import iscsi -import misc -from misc import deprecated import taskManager import clusterlock from threadLocal import vars diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py index 381b2a1..3f2ad35 100644 --- a/vdsm/storage/image.py +++ b/vdsm/storage/image.py @@ -30,10 +30,10 @@ from vdsm.config import config from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc from sdc import sdCache import sd -import misc import imageSharing from vdsm.exception import ActionStopped import task diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py index 0c4276a..6ffc79b 100644 --- a/vdsm/storage/iscsi.py +++ b/vdsm/storage/iscsi.py @@ -29,10 +29,10 @@ import errno from collections import namedtuple -import misc from vdsm import supervdsm from vdsm.password import ProtectedPassword from vdsm.config import config +from vdsm.storage import misc from vdsm.netinfo.routes import getRouteDeviceTo import devicemapper from threading import RLock diff --git a/vdsm/storage/iscsiadm.py b/vdsm/storage/iscsiadm.py index 03e2e97..d0e9c6c 100644 --- a/vdsm/storage/iscsiadm.py +++ b/vdsm/storage/iscsiadm.py @@ -21,8 +21,8 @@ import re from collections import namedtuple from threading import Lock -import misc from vdsm import constants +from vdsm.storage import misc from vdsm.utils import AsyncProcessOperation # iscsiadm exit statuses diff --git a/vdsm/storage/localFsSD.py b/vdsm/storage/localFsSD.py index b8833d4..fb7b608 100644 --- a/vdsm/storage/localFsSD.py +++ b/vdsm/storage/localFsSD.py @@ -23,10 +23,10 @@ from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc import sd import fileSD -import misc import clusterlock diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py index f9526da..32d3650 100644 --- a/vdsm/storage/lvm.py +++ b/vdsm/storage/lvm.py @@ -39,8 +39,8 @@ from vdsm import constants from vdsm.storage import exception as se +from vdsm.storage import misc -import misc import multipath from vdsm.config import config import devicemapper diff --git a/vdsm/storage/monitor.py b/vdsm/storage/monitor.py index b4a0846..014f46d 100644 --- a/vdsm/storage/monitor.py +++ b/vdsm/storage/monitor.py @@ -26,9 +26,9 @@ from vdsm import concurrent from vdsm import utils from vdsm.config import config +from vdsm.storage import misc from . import clusterlock -from . import misc from .sdc import sdCache diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py index bc43fe6..f17267b 100644 --- a/vdsm/storage/multipath.py +++ b/vdsm/storage/multipath.py @@ -35,9 +35,9 @@ from vdsm import udevadm from vdsm import utils from vdsm.config import config +from vdsm.storage import misc import hba -import misc import iscsi import devicemapper diff --git a/vdsm/storage/nfsSD.py b/vdsm/storage/nfsSD.py index ece3f50..92b9f6c 100644 --- a/vdsm/storage/nfsSD.py +++ b/vdsm/storage/nfsSD.py @@ -22,12 +22,12 @@ from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc from vdsm.storage import mount import sd import fileSD import outOfProcess as oop -import misc class NfsStorageDomain(fileSD.FileStorageDomain): diff --git a/vdsm/storage/resourceManager.py b/vdsm/storage/resourceManager.py index 1ce6881..a7b618e 100644 --- a/vdsm/storage/resourceManager.py +++ b/vdsm/storage/resourceManager.py @@ -27,11 +27,11 @@ from uuid import uuid4 from Queue import Queue -import misc from vdsm.logUtils import SimpleLogAdapter from vdsm import concurrent from vdsm import utils from vdsm.storage import exception as se +from vdsm.storage import misc # Errors diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index 3e261bf..57dd9f7 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -27,10 +27,10 @@ from contextlib import contextmanager from vdsm.storage import exception as se +from vdsm.storage import misc from vdsm.storage.persistent import unicodeEncoder, unicodeDecoder import image -import misc import resourceFactories from resourceFactories import IMAGE_NAMESPACE, VOLUME_NAMESPACE import resourceManager as rm diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py index d068b88..30e03ae 100644 --- a/vdsm/storage/sdc.py +++ b/vdsm/storage/sdc.py @@ -27,10 +27,10 @@ from vdsm.config import config from vdsm.storage import exception as se +from vdsm.storage import misc import multipath import lvm -import misc # Default cache age until forcibly refreshed DEFAULT_REFRESH_INTERVAL = 300 diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index af838de..b6fdf80 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -36,6 +36,7 @@ from vdsm.panic import panic from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc from vdsm.storage import mount from vdsm.storage.constants import STORAGE from vdsm.storage.securable import secured, unsecured @@ -44,7 +45,6 @@ import blockSD import fileSD import sd -import misc from vdsm.config import config from sdc import sdCache import image diff --git a/vdsm/storage/spbackends.py b/vdsm/storage/spbackends.py index 27f2e73..505a988 100644 --- a/vdsm/storage/spbackends.py +++ b/vdsm/storage/spbackends.py @@ -22,6 +22,7 @@ import weakref from vdsm.storage import exception as se +from vdsm.storage import misc from vdsm.storage.persistent import DictValidator from vdsm.storage.persistent import unicodeDecoder from vdsm.storage.persistent import unicodeEncoder @@ -29,7 +30,6 @@ from vdsm.storage.securable import unsecured import blockSD -import misc import sd from sp import LVER_INVALID diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py index 45c5d4e..922ef9c 100644 --- a/vdsm/storage/storageServer.py +++ b/vdsm/storage/storageServer.py @@ -25,7 +25,6 @@ import socket import glob from collections import namedtuple -import misc from functools import partial import six import sys @@ -38,6 +37,7 @@ from vdsm import utils from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc from vdsm.storage import mount from vdsm.storage import sync from vdsm.storage.mount import MountError diff --git a/vdsm/storage/storage_mailbox.py b/vdsm/storage/storage_mailbox.py index baeda1e..e72a067 100644 --- a/vdsm/storage/storage_mailbox.py +++ b/vdsm/storage/storage_mailbox.py @@ -30,10 +30,10 @@ import uuid from vdsm.config import config +from vdsm.storage import misc from vdsm.storage.exception import InvalidParameterException import sd -import misc import task from threadPool import ThreadPool from vdsm import concurrent diff --git a/vdsm/storage/task.py b/vdsm/storage/task.py index ae0b271..8b72eac 100644 --- a/vdsm/storage/task.py +++ b/vdsm/storage/task.py @@ -53,9 +53,9 @@ from functools import wraps from vdsm.storage import exception as se +from vdsm.storage import misc import uuid -import misc import resourceManager from threadLocal import vars from weakref import proxy diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py index b2847da..02fc078 100644 --- a/vdsm/storage/volume.py +++ b/vdsm/storage/volume.py @@ -29,11 +29,11 @@ from vdsm.storage import constants as storage_constants from vdsm.storage import exception as se from vdsm.storage import fileUtils +from vdsm.storage import misc +from vdsm.storage.misc import deprecated import sd from sdc import sdCache -import misc -from misc import deprecated import task from threadLocal import vars import resourceFactories -- To view, visit https://gerrit.ovirt.org/56614 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I22627bf0d8898c491da44ced4b39e1294a322308 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Idan Shaby <ish...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches