Remove Brick's iscsi dependency on cinder
This patch removes Brick's iscsi/iscsi.py's dependence on cinder. Brick can't contain cinder dependencies as it will be used in nova. Fixes Bug #1209012 Change-Id: I046b5a53baecce81ba184cb7f30ec450f4738dae
This commit is contained in:
parent
580c993f1e
commit
9cb2af6bc9
|
@ -23,6 +23,7 @@ Helper code for the iSCSI volume driver.
|
|||
import contextlib
|
||||
import os
|
||||
import re
|
||||
import stat
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
|
@ -30,7 +31,6 @@ from cinder import exception
|
|||
from cinder.openstack.common import fileutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils as putils
|
||||
from cinder.volume import utils as volume_utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -236,9 +236,13 @@ class IetAdm(TargetAdmin):
|
|||
def __init__(self, execute=putils.execute):
|
||||
super(IetAdm, self).__init__('ietadm', execute)
|
||||
|
||||
def _is_block(self, path):
|
||||
mode = os.stat(path).st_mode
|
||||
return stat.S_ISBLK(mode)
|
||||
|
||||
def _iotype(self, path):
|
||||
if CONF.iscsi_iotype == 'auto':
|
||||
return 'blockio' if volume_utils.is_block(path) else 'fileio'
|
||||
return 'blockio' if self._is_block(path) else 'fileio'
|
||||
else:
|
||||
return CONF.iscsi_iotype
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ class IetAdmAutoIOTestCase(test.TestCase, TargetAdminTestCase):
|
|||
def setUp(self):
|
||||
super(IetAdmAutoIOTestCase, self).setUp()
|
||||
TargetAdminTestCase.setUp(self)
|
||||
self.stubs.Set(volume_utils, 'is_block', lambda _: True)
|
||||
self.stubs.Set(iscsi.IetAdm, '_is_block', lambda a, b: True)
|
||||
self.flags(iscsi_helper='ietadm')
|
||||
self.flags(iscsi_iotype='auto')
|
||||
self.script_template = "\n".join([
|
||||
|
|
|
@ -142,11 +142,6 @@ def notify_about_snapshot_usage(context, snapshot, event_suffix,
|
|||
notifier_api.INFO, usage_info)
|
||||
|
||||
|
||||
def is_block(path):
|
||||
mode = os.stat(path).st_mode
|
||||
return stat.S_ISBLK(mode)
|
||||
|
||||
|
||||
def _calculate_count(size_in_m):
|
||||
blocksize = CONF.volume_dd_blocksize
|
||||
# Check if volume_dd_blocksize is valid
|
||||
|
|
Loading…
Reference in New Issue