def _check_conf_file(self): """Check the config file, make sure the essential items are set.""" root = huawei_utils.parse_xml_file(self.xml_conf) check_list = [ 'Storage/HVSURL', 'Storage/UserName', 'Storage/UserPassword' ] for item in check_list: if not huawei_utils.is_xml_item_exist(root, item): err_msg = (_('_check_conf_file: Config file invalid. ' '%s must be set.') % item) LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg) # make sure storage pool is set if not huawei_utils.is_xml_item_exist(root, 'LUN/StoragePool'): err_msg = _('_check_conf_file: Config file invalid. ' 'StoragePool must be set.') LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg) # make sure host os type valid if huawei_utils.is_xml_item_exist(root, 'Host', 'OSType'): os_list = huawei_utils.os_type.keys() if not huawei_utils.is_xml_item_valid(root, 'Host', os_list, 'OSType'): err_msg = (_('_check_conf_file: Config file invalid. ' 'Host OSType invalid.\n' 'The valid values are: %(os_list)s') % { 'os_list': os_list }) LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg)
def _check_conf_file(self): """Check the config file, make sure the essential items are set.""" root = huawei_utils.parse_xml_file(self.xml_conf) check_list = ['Storage/HVSURL', 'Storage/UserName', 'Storage/UserPassword'] for item in check_list: if not huawei_utils.is_xml_item_exist(root, item): err_msg = (_('_check_conf_file: Config file invalid. ' '%s must be set.') % item) LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg) # make sure storage pool is set if not huawei_utils.is_xml_item_exist(root, 'LUN/StoragePool'): err_msg = _('_check_conf_file: Config file invalid. ' 'StoragePool must be set.') LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg) # make sure host os type valid if huawei_utils.is_xml_item_exist(root, 'Host', 'OSType'): os_list = huawei_utils.os_type.keys() if not huawei_utils.is_xml_item_valid(root, 'Host', os_list, 'OSType'): err_msg = (_('_check_conf_file: Config file invalid. ' 'Host OSType invalid.\n' 'The valid values are: %(os_list)s') % {'os_list': os_list}) LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg)
def _check_conf_file(self): """Check the config file, make sure the essential items are set.""" root = huawei_utils.parse_xml_file(self.xml_conf) check_list = ["Storage/HVSURL", "Storage/UserName", "Storage/UserPassword"] for item in check_list: if not huawei_utils.is_xml_item_exist(root, item): err_msg = _("_check_conf_file: Config file invalid. " "%s must be set.") % item LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg) # make sure storage pool is set if not huawei_utils.is_xml_item_exist(root, "LUN/StoragePool"): err_msg = _("_check_conf_file: Config file invalid. " "StoragePool must be set.") LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg) # make sure host os type valid if huawei_utils.is_xml_item_exist(root, "Host", "OSType"): os_list = huawei_utils.os_type.keys() if not huawei_utils.is_xml_item_valid(root, "Host", os_list, "OSType"): err_msg = _( "_check_conf_file: Config file invalid. " "Host OSType invalid.\n" "The valid values are: %(os_list)s" ) % {"os_list": os_list} LOG.error(err_msg) raise exception.InvalidInput(reason=err_msg)