Hello community, here is the log from the commit of package ceph-iscsi for openSUSE:Factory checked in at 2019-02-04 14:26:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ceph-iscsi (Old) and /work/SRC/openSUSE:Factory/.ceph-iscsi.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ceph-iscsi" Mon Feb 4 14:26:16 2019 rev:3 rq:671021 version:3.0+1549277704 Changes: -------- --- /work/SRC/openSUSE:Factory/ceph-iscsi/ceph-iscsi.changes 2019-01-21 11:00:09.195290775 +0100 +++ /work/SRC/openSUSE:Factory/.ceph-iscsi.new.28833/ceph-iscsi.changes 2019-02-04 14:26:19.149027965 +0100 @@ -1,0 +2,8 @@ +Mon Feb 4 10:55:10 UTC 2019 - ncutler@suse.com + +- Update to 3.0+1549277704: + + based on upstream master SHA1 17023339c03f8a8ad289db7689f6d6424c2b860f + * packaging: Move python unbuffered option to systemd unit file + (bsc#1123070) + +------------------------------------------------------------------- Old: ---- ceph-iscsi-3.0+1547720996.tar.gz New: ---- ceph-iscsi-3.0+1549277704.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ceph-iscsi.spec ++++++ --- /var/tmp/diff_new_pack.CQNSxL/_old 2019-02-04 14:26:19.897027611 +0100 +++ /var/tmp/diff_new_pack.CQNSxL/_new 2019-02-04 14:26:19.897027611 +0100 @@ -19,7 +19,7 @@ %endif Name: ceph-iscsi -Version: 3.0+1547720996 +Version: 3.0+1549277704 Release: 1%{?dist} Group: System/Filesystems Summary: Python modules for Ceph iSCSI gateway configuration management ++++++ ceph-iscsi-3.0+1547720996.tar.gz -> ceph-iscsi-3.0+1549277704.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/ceph-iscsi.spec new/ceph-iscsi-3.0+1549277704/ceph-iscsi.spec --- old/ceph-iscsi-3.0+1547720996/ceph-iscsi.spec 2019-01-17 11:29:56.925544738 +0100 +++ new/ceph-iscsi-3.0+1549277704/ceph-iscsi.spec 2019-02-04 11:55:04.493986729 +0100 @@ -19,7 +19,7 @@ %endif Name: ceph-iscsi -Version: 3.0+1547720996 +Version: 3.0+1549277704 Release: 1%{?dist} Group: System/Filesystems Summary: Python modules for Ceph iSCSI gateway configuration management diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/ceph_iscsi_config/client.py new/ceph-iscsi-3.0+1549277704/ceph_iscsi_config/client.py --- old/ceph-iscsi-3.0+1547720996/ceph_iscsi_config/client.py 2019-01-17 11:29:56.685543415 +0100 +++ new/ceph-iscsi-3.0+1549277704/ceph_iscsi_config/client.py 2019-02-04 11:55:04.253985399 +0100 @@ -46,7 +46,6 @@ :return: """ - self.iqn = client_iqn self.target_iqn = target_iqn self.lun_lookup = {} # only used for hostgroup based definitions self.requested_images = [] @@ -87,10 +86,12 @@ self.error_msg = '' try: - normalize_wwn(['iqn'], client_iqn) + client_iqn, iqn_type = normalize_wwn(['iqn'], client_iqn) except RTSLibError as err: self.error = True - self.error_msg = "Invalid client name for iSCSI - {}".format(err) + self.error_msg = "Invalid iSCSI client name - {}".format(err) + + self.iqn = client_iqn # Validate the images list doesn't contain duplicate entries dup_images = set([rbd for rbd in image_list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/ceph_iscsi_config/gateway.py new/ceph-iscsi-3.0+1549277704/ceph_iscsi_config/gateway.py --- old/ceph-iscsi-3.0+1547720996/ceph_iscsi_config/gateway.py 2019-01-17 11:29:56.685543415 +0100 +++ new/ceph-iscsi-3.0+1549277704/ceph_iscsi_config/gateway.py 2019-02-04 11:55:04.257985421 +0100 @@ -5,7 +5,7 @@ from rtslib_fb.target import Target, TPG, NetworkPortal, LUN from rtslib_fb.fabric import ISCSIFabricModule from rtslib_fb import root -from rtslib_fb.utils import RTSLibError +from rtslib_fb.utils import RTSLibError, normalize_wwn from rtslib_fb.alua import ALUATargetPortGroup import ceph_iscsi_config.settings as settings @@ -56,6 +56,11 @@ self.enable_portal = enable_portal # boolean to trigger portal IP creation self.logger = logger # logger object + try: + iqn, iqn_type = normalize_wwn(['iqn'], iqn) + except RTSLibError as err: + self.error = True + self.error_msg = "Invalid iSCSI target name - {}".format(err) self.iqn = iqn # Ensure IPv6 addresses are in the normalized address (not literal) format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/ceph_iscsi_config/lun.py new/ceph-iscsi-3.0+1549277704/ceph_iscsi_config/lun.py --- old/ceph-iscsi-3.0+1547720996/ceph_iscsi_config/lun.py 2019-01-17 11:29:56.685543415 +0100 +++ new/ceph-iscsi-3.0+1549277704/ceph_iscsi_config/lun.py 2019-02-04 11:55:04.257985421 +0100 @@ -71,6 +71,8 @@ """ rbd_deleted = False + extra_error_info = '' + with rados.Rados(conffile=settings.config.cephconf) as cluster: with cluster.open_ioctx(self.pool) as ioctx: rbd_inst = rbd.RBD() @@ -87,6 +89,9 @@ # catch and ignore the busy state - rbd probably still mapped on # another gateway, so we keep trying pass + except rbd.ImageHasSnapshots: + extra_error_info = " - Image has snapshots" + break else: rbd_deleted = True break @@ -98,6 +103,10 @@ return else: self.error = True + self.error_msg = ("Unable to delete the underlying rbd " + "image {}".format(self.image)) + if extra_error_info: + self.error_msg += extra_error_info def rbd_size(self): """ @@ -192,7 +201,7 @@ if rbd_image.features() & RBDDev.required_features() != \ RBDDev.required_features(): - valid_state = False + valid_state = False return valid_state @@ -302,8 +311,7 @@ rbd_image.delete() if rbd_image.error: self.error = True - self.error_msg = ("Unable to delete the underlying rbd " - "image {}".format(self.config_key)) + self.error_msg = rbd_image.error_msg return # remove the definition from the config object diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/gwcli/client.py new/ceph-iscsi-3.0+1549277704/gwcli/client.py --- old/ceph-iscsi-3.0+1547720996/gwcli/client.py 2019-01-17 11:29:56.685543415 +0100 +++ new/ceph-iscsi-3.0+1549277704/gwcli/client.py 2019-02-04 11:55:04.257985421 +0100 @@ -2,13 +2,14 @@ from gwcli.node import UIGroup, UINode -from gwcli.utils import response_message, valid_iqn, APIRequest +from gwcli.utils import response_message, APIRequest from ceph_iscsi_config.client import CHAP import ceph_iscsi_config.settings as settings from ceph_iscsi_config.utils import human_size import rtslib_fb.root as root +from rtslib_fb.utils import normalize_wwn, RTSLibError # this ignores the warning issued when verify=False is used from requests.packages import urllib3 @@ -64,7 +65,9 @@ cli_seed = {"luns": {}, "auth": {}} # is the IQN usable? - if not valid_iqn(client_iqn): + try: + client_iqn, iqn_type = normalize_wwn(['iqn'], client_iqn) + except RTSLibError: self.logger.error("IQN name '{}' is not valid for " "iSCSI".format(client_iqn)) return @@ -112,7 +115,9 @@ self.logger.debug("Client DELETE for {}".format(client_iqn)) # is the IQN usable? - if not valid_iqn(client_iqn): + try: + client_iqn, iqn_type = normalize_wwn(['iqn'], client_iqn) + except RTSLibError: self.logger.error("IQN name '{}' is not valid for " "iSCSI".format(client_iqn)) return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/gwcli/gateway.py new/ceph-iscsi-3.0+1549277704/gwcli/gateway.py --- old/ceph-iscsi-3.0+1547720996/gwcli/gateway.py 2019-01-17 11:29:56.685543415 +0100 +++ new/ceph-iscsi-3.0+1549277704/gwcli/gateway.py 2019-02-04 11:55:04.257985421 +0100 @@ -8,8 +8,7 @@ from gwcli.storage import Disks, TargetDisks from gwcli.client import Clients from gwcli.utils import (this_host, response_message, GatewayAPIError, - GatewayError, APIRequest, console_message, valid_iqn, - get_config) + GatewayError, APIRequest, console_message, get_config) import ceph_iscsi_config.settings as settings from ceph_iscsi_config.utils import (normalize_ip_address, format_lio_yes_no) @@ -17,6 +16,8 @@ from gwcli.ceph import CephGroup +from rtslib_fb.utils import normalize_wwn, RTSLibError + # FIXME - code is using a self signed cert common across all gateways # the embedded urllib3 package will issue warnings when ssl cert validation is # disabled - so this disable_warnings stops the user interface from being @@ -176,7 +177,9 @@ self.logger.debug("CMD: /iscsi create {}".format(target_iqn)) # is the IQN usable? - if not valid_iqn(target_iqn): + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError: self.logger.error("IQN name '{}' is not valid for " "iSCSI".format(target_iqn)) return @@ -213,6 +216,13 @@ self.logger.debug("CMD: /iscsi delete {}".format(target_iqn)) + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError: + self.logger.error("IQN name '{}' is not valid for " + "iSCSI".format(target_iqn)) + return + gw_api = ('{}://localhost:{}/api/' 'target/{}'.format(self.http_mode, settings.config.api_port, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/gwcli/storage.py new/ceph-iscsi-3.0+1549277704/gwcli/storage.py --- old/ceph-iscsi-3.0+1547720996/gwcli/storage.py 2019-01-17 11:29:56.689543437 +0100 +++ new/ceph-iscsi-3.0+1549277704/gwcli/storage.py 2019-02-04 11:55:04.257985421 +0100 @@ -945,7 +945,7 @@ for disk in disks: TargetDisk(self, disk) - def ui_command_add(self, disk=None): + def ui_command_add(self, disk): self.add_disk(disk) def add_disk(self, disk, success_msg='ok'): @@ -975,7 +975,7 @@ rc = 1 return rc - def ui_command_delete(self, disk=None): + def ui_command_delete(self, disk): self.delete_disk(disk) def delete_disk(self, disk): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/gwcli/utils.py new/ceph-iscsi-3.0+1549277704/gwcli/utils.py --- old/ceph-iscsi-3.0+1547720996/gwcli/utils.py 2019-01-17 11:29:56.689543437 +0100 +++ new/ceph-iscsi-3.0+1549277704/gwcli/utils.py 2019-02-04 11:55:04.257985421 +0100 @@ -61,21 +61,6 @@ return {} -def valid_iqn(iqn): - """ - confirm whether the given iqn is in an acceptable format - :param iqn: (str) iqn name to check - :return: (bool) True if iqn is valid for iSCSI - """ - - try: - normalize_wwn(['iqn'], iqn) - except RTSLibError: - return False - - return True - - def valid_gateway(target_iqn, gw_name, gw_ip, config): """ validate the request for a new gateway @@ -250,7 +235,9 @@ if mode == 'create': # iqn must be valid - if not valid_iqn(client_iqn): + try: + normalize_wwn(['iqn'], client_iqn) + except RTSLibError: return ("Invalid IQN name for iSCSI") # iqn must not already exist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/rbd-target-api.py new/ceph-iscsi-3.0+1549277704/rbd-target-api.py --- old/ceph-iscsi-3.0+1547720996/rbd-target-api.py 2019-01-17 11:29:56.689543437 +0100 +++ new/ceph-iscsi-3.0+1549277704/rbd-target-api.py 2019-02-04 11:55:04.257985421 +0100 @@ -247,6 +247,12 @@ -X PUT http://192.168.122.69:5000/api/target/iqn.2003-01.com.redhat.iscsi-gw0 """ + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + if request.method == 'PUT': mode = request.form.get('mode', None) if mode not in [None, 'reconfigure']: @@ -468,6 +474,7 @@ """ if request.method == 'GET': + config.refresh() return jsonify(config.config), 200 @@ -482,6 +489,12 @@ http://192.168.122.69:5000/api/gateways/iqn.2003-01.com.redhat.iscsi-gw:iscs... """ + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + target_config = config.config['targets'][target_iqn] if request.method == 'GET': return jsonify(target_config['portals']), 200 @@ -511,12 +524,19 @@ # could take a while if there are 100's of disks/clients. Future work should # aim to make this synchronisation of the new gateway an async task + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + ip_address = request.form.get('ip_address') nosync = request.form.get('nosync', 'false') skipchecks = request.form.get('skipchecks', 'false') # first confirm that the request is actually valid, if not return a 400 # error with the error description + config.refresh() current_config = config.config if skipchecks.lower() == 'true': @@ -579,6 +599,7 @@ :param gateway_name: (str) gateway name, normally the DNS name **RESTRICTED** """ + config.refresh() target_config = config.config['targets'][target_iqn] if request.method == 'GET': @@ -670,6 +691,12 @@ -X PUT https://192.168.122.69:5000/api/targetlun/iqn.2003-01.com.redhat.iscsi-gw:is... """ + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + target_config = config.config['targets'][target_iqn] portals = [key for key in target_config['portals']] @@ -1144,8 +1171,9 @@ else: status_code = 500 - logger.error("LUN remove failed : {}".format(lun.error_msg)) - return jsonify(message="Failed to remove the LUN"), status_code + error_msg = "Failed to remove the LUN - {}".format(lun.error_msg) + logger.error(error_msg) + return jsonify(message=error_msg), status_code config.refresh() @@ -1453,6 +1481,12 @@ https://192.168.122.69:5000/api/clients/iqn.2003-01.com.redhat.iscsi-gw:iscs... """ + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + target_config = config.config['targets'][target_iqn] client_list = target_config['clients'].keys() response = {"clients": client_list} @@ -1519,6 +1553,18 @@ -X PUT https://192.168.122.69:5000/api/clientauth/iqn.2017-08.org.ceph:iscsi-gw0 """ + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + + try: + client_iqn, iqn_type = normalize_wwn(['iqn'], client_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(client_iqn, err) + return jsonify(message=err_str), 500 + # http_mode = 'https' if settings.config.api_secure else 'http' target_config = config.config['targets'][target_iqn] try: @@ -1595,6 +1641,18 @@ -X PUT https://192.168.122.69:5000/api/clientlun/iqn.2017-08.org.ceph:iscsi-gw0 """ + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + + try: + client_iqn, iqn_type = normalize_wwn(['iqn'], client_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(client_iqn, err) + return jsonify(message=err_str), 500 + # http_mode = 'https' if settings.config.api_secure else 'http' target_config = config.config['targets'][target_iqn] try: @@ -1702,6 +1760,18 @@ method = {"PUT": 'create', "DELETE": 'delete'} + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + + try: + client_iqn, iqn_type = normalize_wwn(['iqn'], client_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(client_iqn, err) + return jsonify(message=err_str), 500 + # http_mode = 'https' if settings.config.api_secure else 'http' target_config = config.config['targets'][target_iqn] try: @@ -1827,6 +1897,12 @@ http://192.168.122.69:5000/api/hostgroups/iqn.2003-01.com.redhat.iscsi-gw:is... """ + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + target_config = config.config['targets'][target_iqn] if request.method == 'GET': return jsonify({"groups": target_config['groups'].keys()}), 200 @@ -1855,6 +1931,12 @@ http_mode = 'https' if settings.config.api_secure else 'http' valid_hostgroup_actions = ['add', 'remove'] + try: + target_iqn, iqn_type = normalize_wwn(['iqn'], target_iqn) + except RTSLibError as err: + err_str = "Invalid iqn {} - {}".format(target_iqn, err) + return jsonify(message=err_str), 500 + target_config = config.config['targets'][target_iqn] try: gateways = get_remote_gateways(target_config['portals'], logger) @@ -2031,6 +2113,7 @@ grp = Group(logger, target_iqn, group_name) grp.purge() if not grp.error: + config.refresh() return jsonify(message="Group '{}' removed".format(group_name)), 200 else: return jsonify(message=grp.error_msg), 400 @@ -2220,7 +2303,7 @@ # check rpm versions are OK for rpm in required_rpms: if not valid_rpm(rpm): - logger.error("RPM check for {} failed") + logger.error("RPM check for {} failed".format(rpm['name'])) errors_found.append("{} rpm must be installed at >= " "{}-{}".format(rpm['name'], rpm['version'], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/rbd-target-gw.py new/ceph-iscsi-3.0+1549277704/rbd-target-gw.py --- old/ceph-iscsi-3.0+1547720996/rbd-target-gw.py 2019-01-17 11:29:56.689543437 +0100 +++ new/ceph-iscsi-3.0+1549277704/rbd-target-gw.py 2019-02-04 11:55:04.257985421 +0100 @@ -1,6 +1,4 @@ -#!/usr/bin/python -u -# NB the python environment is using unbuffered mode (-u), so any "print" -# statements will appear in the syslog 'immediately' +#!/usr/bin/python import signal import logging @@ -322,7 +320,7 @@ try: LUN.define_luns(logger, config, gateway) except CephiSCSIError as err: - halt("{} - Could not define LUNs: {}".format(gateway.iqn, err)) + halt("{} - Could not define LUNs: {}".format(gateway.iqn, err)) logger.info("{} - Processing client configuration".format(gateway.iqn)) try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ceph-iscsi-3.0+1547720996/usr/lib/systemd/system/rbd-target-gw.service new/ceph-iscsi-3.0+1549277704/usr/lib/systemd/system/rbd-target-gw.service --- old/ceph-iscsi-3.0+1547720996/usr/lib/systemd/system/rbd-target-gw.service 2019-01-17 11:29:56.689543437 +0100 +++ new/ceph-iscsi-3.0+1549277704/usr/lib/systemd/system/rbd-target-gw.service 2019-02-04 11:55:04.257985421 +0100 @@ -8,6 +8,7 @@ [Service] LimitNOFILE=1048576 LimitNPROC=1048576 +Environment=PYTHONUNBUFFERED=TRUE EnvironmentFile=-/etc/sysconfig/ceph Type=simple User=root