from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
+from cinder.volume import configuration as conf
from cinder.volume.drivers.huawei import huawei_iscsi
LOG = logging.getLogger(__name__)
def __init__(self, *args, **kwargs):
super(HuaweiVolumeTestCase, self).__init__(*args, **kwargs)
- self.driver = FakeHuaweiStorage()
+ self.driver = FakeHuaweiStorage(configuration=conf.Configuration(None))
self.driver.do_setup({})
self.driver._test_flg = 'check_for_fail'
self._test_check_for_setup_errors()
from xml.etree import ElementTree as ET
from cinder import exception
-from cinder import flags
from cinder.openstack.common import excutils
from cinder.openstack.common import log as logging
from cinder import utils
default='/etc/cinder/cinder_huawei_conf.xml',
help='config data for cinder huawei plugin')]
-FLAGS = flags.FLAGS
-FLAGS.register_opts(huawei_opt)
-
HOST_GROUP_NAME = 'HostGroup_OpenStack'
HOST_NAME_PREFIX = 'Host_'
HOST_PORT_PREFIX = 'HostPort_'
def __init__(self, *args, **kwargs):
super(HuaweiISCSIDriver, self).__init__(*args, **kwargs)
+ self.configuration.append_config_values(huawei_opt)
self.device_type = {}
self.login_info = {}
self.hostgroup_id = None
def _read_xml(self):
"""Open xml file."""
- filename = FLAGS.cinder_huawei_conf_file
+ filename = self.configuration.cinder_huawei_conf_file
try:
tree = ET.parse(filename)
root = tree.getroot()
if len(en) < 6:
return None
- en = out.split('\r\n')
for i in range(6, len(en) - 2):
r = en[i].split()
if r[1] == hostname:
hostportinfo = []
list_key = ['id', 'name', 'info', 'type', 'hostid',
'linkstatus', 'multioathtype']
- en = out.split('\r\n')
for i in range(6, len(en) - 2):
list_val = en[i].split()
hostport_dic = dict(map(None, list_key, list_val))
mapinfo = []
list_tmp = []
list_key = ['mapid', 'devlunid', 'hostlunid']
- en = out.split('\r\n')
for i in range(6, len(en) - 2):
list_tmp = en[i].split()
list_val = [list_tmp[0], list_tmp[2], list_tmp[4]]