import contextlib
import os
import re
+import stat
from oslo.config import cfg
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__)
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
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([
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